Page 1 of 1

Changing the brightness of a graphics.draw object?

Posted: Sat Jun 15, 2013 4:46 pm
by Calahagus
Just as the title says. Is there a function that I can use to change how bright an image I draw is, or do I have to do that outside of LOVE?

Re: Changing the brightness of a graphics.draw object?

Posted: Sat Jun 15, 2013 4:57 pm
by veethree
To do that within love you'd need a shader i think.

Re: Changing the brightness of a graphics.draw object?

Posted: Sat Jun 15, 2013 5:16 pm
by nordbjerg
Well, you could make a function that convert HSL into RGB.

https://love2d.org/wiki/HSL_color

Re: Changing the brightness of a graphics.draw object?

Posted: Sat Jun 15, 2013 5:46 pm
by Robin
If you just want to darken it, you can use setColor with a gray color.

Re: Changing the brightness of a graphics.draw object?

Posted: Sat Jun 15, 2013 6:11 pm
by Boolsheet
You can use the 'combine' color mode. See love.graphics.setColorMode and ColorMode. If I remember correctly, it does something like this.

Code: Select all

resulting color = color of texture + (color set with setColor - 128)
So setting a color of (128, 128, 128) means no change. Values above that get added, values below get subtracted.

Sadly, this function will be removed in the next version of LÖVE as we move on the the wondrous world of shaders.

Re: Changing the brightness of a graphics.draw object?

Posted: Sat Jun 15, 2013 9:06 pm
by Calahagus
Robin wrote:If you just want to darken it, you can use setColor with a gray color.
This worked perfectly, should have thought of it myself. Thanks!