Shearing images

Hello,
Is it possible to use something like shear(x,y)? As far as I can tell, it’s impossible besides writing code that takes a strip of pixels of the image and shifts it over (which I could imagine is extremely slow).
Thanks!

Should I just write the function?

Once thats done, it wouldn’t be hard to do squease(top%,bottom%,left%,right%).

Not currently, not without doing what you suggest, which would indeed be slow. I suggested it a while ago - there’s been talk about letting us do arbitrary transforms (which would include sheer), but nothing yet.

Hmm. If I have leftover time, I’ll look into it… How hard could it be? But the speed… :0&

Thanks for answering @Bortels

Yeah, I did the Pic() library - it’s gonna be slow. But - if you’re only doing it in setup, maybe not so bad.

There was some talk about making the new mesh() stuff in 1.3 be able to do that, maybe kinda sorta - but I don’t think it made it in.

Alright. Thanks.

Alright.Thanks!

1.3 has the Mesh API, which will make shearing very easy.

@Simeon - What’s this all about right here? If you could share whatever it is, please do so.
Thanks!

Shearing images with mesh:

function setup()
    m = mesh()
    m.texture = "Small World:Icon"

    w,h = spriteSize(m.texture)

    parameter("Shear",-100,100,0)
end

function setQuad(m, ll, tl, tr, br)
    local verts = { ll, tl, br, br, tl, tr }
    local tex = { vec2(0,1), vec2(0,0), vec2(1,1),
                  vec2(1,1), vec2(0,0), vec2(1,0) }
    m.vertices = verts
    m.texCoords = tex
end

function draw()
    background(40,40,50)

    fill(255)
    translate(WIDTH/2, HEIGHT/2)

    -- Sheared quad
    setQuad( m, vec2( -w/2 - Shear, -h/2 ), vec2( -w/2 + Shear, h/2 ),
                vec2(  w/2 + Shear,  h/2 ), vec2(  w/2 - Shear, -h/2 ) )

    m:draw()
end

AWSOME! Thanks! Posted it on Wiki. I think I’ll turn it into a function and eventually add some other transitions like squeeze.
Thanks!