Page 1 of 1

Compositing?

Posted: Mon Nov 23, 2009 2:43 am
by tunzi
Sorry if this has been asked before, but does Love support (or will it) any sort of compositing?

The basic problem is this: take an arbitrary polygon and then fill it with a tiled image. Use the boundaries of the polygon to clip parts of the tiles that extend beyond.

The solution wouldn't have to be a full system like Cairo's compositing; a simple secondary screen buffer would suffice. Then you could paint alpha over the extra tile portions with a triangle to get the correctly painted polygon. Then it's just a matter of copying the secondary buffer into the primary screen buffer.

Any ideas for solving this problem with existing Love functions are also welcome.

Re: Compositing?

Posted: Mon Nov 23, 2009 11:43 am
by napco
Well, no in LOVE 0.5.0 and yes, i think, in 0.6.0. The problem is that the potato (0.6.0 documentation) is still incomplete.

Re: Compositing?

Posted: Tue Nov 24, 2009 2:59 pm
by tunzi
Well I don't know about potatoes, but the wiki did answer my question; 0.6.0 will indeed have two possible solutions:

Framebuffers:

Code: Select all

fb = love.graphics.newFrameBuffer( width, height )
love.graphics.setFrameBuffer( fb )
love.graphics.draw( image, x, y ) -- draws into fb.
love.graphics.setFrameBuffer() -- Change back to screen.
love.graphics.draw( fb, 0, 0, 0, 2, 2) -- Draw the framebuffer to the screen (scaled).
Pixel manipulation:

Code: Select all

- Create new image data from file. Let's say 
-- ball.png is 128x128.
ball = love.image.newImageData("ball.png")
 
r, g, b, a = ball:getPixel(0, 0)
ball:setPixel(0, 0, 255, 0, 0, 255)

Re: Compositing?

Posted: Tue Nov 24, 2009 5:47 pm
by rude
No, 0.6.0 will not have that. But it is coming.