Compositing?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
tunzi
Prole
Posts: 4
Joined: Sat Nov 21, 2009 10:21 pm

Compositing?

Post 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.
User avatar
napco
Party member
Posts: 129
Joined: Fri Jun 12, 2009 9:28 pm
Location: Ital... ehm...

Re: Compositing?

Post 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.
User avatar
tunzi
Prole
Posts: 4
Joined: Sat Nov 21, 2009 10:21 pm

Re: Compositing?

Post 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)
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Compositing?

Post by rude »

No, 0.6.0 will not have that. But it is coming.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 9 guests