SFML community forums
Help => Graphics => Topic started by: mecablaze on March 13, 2011, 11:00:11 pm
-
I am using SFML2 in Visual Studio 2010 (Windows). See this post (http://www.sfml-dev.org/forum/viewtopic.php?p=28464#28464) for more background information.
I was looking through the sf::Image documentation and I didn't see anything about tinting an image. I previously used SDL, in which tinting is very easy. I have a white sprite with alpha that I would like to tint one of three colors then copy it onto another image.
What is the best way to do this in SFML2?
-
I'm not sure I understand right what you mean by 'tinting an image' - changing RGB values?. You can create an image filled with a specific color. You can change the colors of pixels in an existing image.
-
Sorry about the confusion.
For example, if I want to tint my white image to RGB(255, 0, 255) (assuming the source image is white, per color theory).
(http://i.imgur.com/CR2ks.png)
In XNA, there is a tint parameter easily accessible (documentation (http://msdn.microsoft.com/en-us/library/ff433986.aspx)).
-
You would display that image using a Sprite in SFML, and Sprites have the SetColor method, which works like a tint. Alpha blending can also be achieved using this.