I really can't figure out why love.graphics.setColor doesn't have any effect on the images I draw.
Is it not supposed to do this?
Is something wrong with the image?
I guess I could live without this, but it'd be greatly appreciated if it could be added, if it isn't already that is.
Drawing images unaffected by setColor
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Dr. Magnusson
- Prole
- Posts: 22
- Joined: Sun Jul 20, 2008 6:10 pm
Re: Drawing images unaffected by setColor
Is your image an actual IMAGE object or is it one of the love.graphics.draw/circle/polygon objects?
I wouldnt think that the setColor function would affect imported bmps or anything like that
I wouldnt think that the setColor function would affect imported bmps or anything like that
- Dr. Magnusson
- Prole
- Posts: 22
- Joined: Sun Jul 20, 2008 6:10 pm
Re: Drawing images unaffected by setColor
It is an imported png. I use it for corners so I guess I could use scissor'd circles for the corners then.
Thanks
Thanks
Re: Drawing images unaffected by setColor
I'm pretty sure this does work. Have you tried using love.graphics.setColorMode( love.color_modulate )? Use "love.color_normal" to set it back to normal.
http://love2d.org/docs/love_graphics_se ... ode_1.html
http://love2d.org/docs/love_graphics_se ... ode_1.html
Re: Drawing images unaffected by setColor
We chose not to color the images by default.
As usual, I'm sure some will like it that way, and some won't. It is subject to debate though, as "everything is affected by setColor" is easier to remember than "some thing are affected, and other things aren't".
Yup, I'll add this to the ever-growing "API Review" list.
As usual, I'm sure some will like it that way, and some won't. It is subject to debate though, as "everything is affected by setColor" is easier to remember than "some thing are affected, and other things aren't".
Yup, I'll add this to the ever-growing "API Review" list.
- Dr. Magnusson
- Prole
- Posts: 22
- Joined: Sun Jul 20, 2008 6:10 pm
Re: Drawing images unaffected by setColor
Thank you rude.
I was originally planning on using the image in question for drawing rounded corners on a box. Since the idea was that these boxes should be able to have any color, it really wouldn't be very effecient if you had to make a different image for each shade (16581375 combinations, excluding alpha).
This time we were able to find a way around it using the scissoring method, but I doubt all uses for colored images have such easy and resource-cheap solutions.
I was originally planning on using the image in question for drawing rounded corners on a box. Since the idea was that these boxes should be able to have any color, it really wouldn't be very effecient if you had to make a different image for each shade (16581375 combinations, excluding alpha).
This time we were able to find a way around it using the scissoring method, but I doubt all uses for colored images have such easy and resource-cheap solutions.
-
- Party member
- Posts: 101
- Joined: Mon Aug 11, 2008 5:19 am
Re: Drawing images unaffected by setColor
color_modulate is very handy. I've wanted to do similar things myself, and didn't realize how easy they already were to do.
I think the documentation for love.setColor should be expanded upon, to explain with a couple sentences exactly what it does. For example:
"getColorMode returns an int. 0 indicates love.color_normal, 1 indicatens love.color_modulate."
(Are there more than just color_modulate and color_normal?)
"setColor: This sets the color to be used when drawing text or shape primitives. Applying setColorMode can apply this default color to images as well."
Documentation is the least exciting, but possibly the most important part of a lovely project like this one.
--Mr. Strange
I think the documentation for love.setColor should be expanded upon, to explain with a couple sentences exactly what it does. For example:
"getColorMode returns an int. 0 indicates love.color_normal, 1 indicatens love.color_modulate."
(Are there more than just color_modulate and color_normal?)
"setColor: This sets the color to be used when drawing text or shape primitives. Applying setColorMode can apply this default color to images as well."
Documentation is the least exciting, but possibly the most important part of a lovely project like this one.
--Mr. Strange
Re: Drawing images unaffected by setColor
Ancient thread, I know ... but I can't find a clear answer to this: is love.graphics.setColor() supposed to affect love.graphics.draw()? If so, how?
It appears that each channel is counted as either zero or not zero, i.e. anything from 1 - 255 is counted as 255. Is this the expected behaviour?
Code: Select all
love.graphics.setColor(255, 255, 255, 255)
love.graphics.draw(myimage) -- this displays the normally colored image
love.graphics.setColor(0, 0, 0, 255)
love.graphics.draw(myimage) -- this displays image as a black rectangle
love.graphics.setColor(0, 255, 255, 255)
love.graphics.draw(myimage) -- this displays image colored as cyan (no red channel present)
love.graphics.setColor(1, 255, 255, 255)
love.graphics.draw(myimage) -- unexpectedly, this also displays the full normally colored image
-
- Party member
- Posts: 512
- Joined: Wed Oct 05, 2016 11:53 am
Re: Drawing images unaffected by setColor
Yes, love.graphics.setColor() should affect how drawables (images, quads, meshes, etc) should be drawn, and you pass it values between [0,255] (works as expected for me in 0.10.2). However, I read that 0.11 version of love will use values between [0,1] (link).
Hard to say what is going on with your code, so can you provide an example .love file that shows the behavior you're encountering?
Hard to say what is going on with your code, so can you provide an example .love file that shows the behavior you're encountering?
Re: Drawing images unaffected by setColor
are you using the unreleased 0.11.0? Color ranges are 0-1 there. Since it clamps above the range, it looks the same at 1 and 255.Dr. Peeps wrote: ↑Wed Mar 08, 2017 8:53 pm Ancient thread, I know ... but I can't find a clear answer to this: is love.graphics.setColor() supposed to affect love.graphics.draw()? If so, how?
It appears that each channel is counted as either zero or not zero, i.e. anything from 1 - 255 is counted as 255. Is this the expected behaviour?Code: Select all
love.graphics.setColor(255, 255, 255, 255) love.graphics.draw(myimage) -- this displays the normally colored image love.graphics.setColor(0, 0, 0, 255) love.graphics.draw(myimage) -- this displays image as a black rectangle love.graphics.setColor(0, 255, 255, 255) love.graphics.draw(myimage) -- this displays image colored as cyan (no red channel present) love.graphics.setColor(1, 255, 255, 255) love.graphics.draw(myimage) -- unexpectedly, this also displays the full normally colored image
https://love2d.org/wiki/0.11.0#Other_changes
Who is online
Users browsing this forum: No registered users and 207 guests