Hey Thiago,
under your draw function you will call your ofImage.draw. If you want your image to be displayed in it’s original color, you need to use ofSetColor(255,255,255); above ofImage.draw. This means that anything that comes after ofImage.draw will also be drawn in white - since 255,255,255 stands for white. If you want other things after ofImage.draw to be drawn in red, for example, you would have to call ofSetColor(255,0,0) after drawing your ofImage.
But I still don’t quite understand what it does if I have ofSetColor set to something else before I call ofImage.draw. I originally thought it was turning all the white or transparent pixels into the set color, but now I think that it adds a tint to the whole image somehow.
This is what I want to know, so I can add info to the ofSetColor entry of the wiki.
And also if anything on other classes (say, some function in ofVideoPlayer) has this kind of dependency on ofSetColor as well.
Has anyone come up with an answer explaining how ofSetColor affects ofImage::draw()?
I’m writing a Mandelbrot fractal explorer as a way of learning OF, so far so good. However, I too am puzzled about how ofSetColor affects the rendering of ofImages. I currently have a greyscale fractal (not a greyscale ofImage though) if the current color is say, yellow, then the fractal is rendered in perfectly scaled yellow tint.
I’m evaluating OF for use in a programming class I am teaching next semester and I’d really like to understand this issue.
in the graphics card colors are treated as floats in the range of 0…1. when you use ofSetColor and then draw an image, each pixel color in the image is multiplied by the color you set before, so if you set for example red (255,0,0) in floats (1,0,0) and a pixel is 127,127,127 in floats (0.5,0.5,0.5) the result will be:
1*0.5,0*0.5,0*0.5 = 0.5,0,0
which translated to the 0…255 range will be 127,0,0. The result is your image is tinted with the color you set with ofSetColor
Have there been any changes in ofSetColor() and ofImage::draw() in OF 7?
I’ve just installed the latter and discovered that imageLoaderExample and dirListExample don’t show any images as they did in OF 6.2.
I guess something has to be fixed in these examples?
there hasn’t been a change that would make image dissapear – what compiler / OS are you using? Do the other examples that load media (font, etc) work? Do you still the same thing in debug and release?
Not shure if this is related, but in OF 6 it was possible to use ofSetColor with a single parameter, f.e. 0xFFFFFF.
This is no longer possible in OF 7, you have to use ofSetHexColor(0xFFFFFF) for that.
Addition: Windows XP SP3, the same problem.
movieGrabberExample doesn’t show image on screen, only a white rectangle.
Added a few lines to save a captured image to a file - the file contains a picture.
I am in trouble with this issue. It might be difficult to reproduce and thus impossible to fix.
I copied binaries to another computer (Windows 7 Professional) and everything works fine - all images are shown as they should. But they are not shown in both Windows development computers that I have. What might be different in environment? Which part of environment is required for OF007 to show images?