SFML community forums

Help => Graphics => Topic started by: krisando on July 10, 2011, 10:22:42 am

Title: RenderImage.Clear(...) issue
Post by: krisando on July 10, 2011, 10:22:42 am
I'm using the RenderImage class due to the surface like nature of it. Also am unsure whether this is a bug or misuse.

I create the image like so:
Code: [Select]
sf::RenderImage surface;
surface.Create(512, 512);


And believe the clear function can take:
sf::Color(255, 0, 0, 255)
sf::Color::Red
...

Red looks like a preset copy of the latter. You can see I'm testing this by making the image completely red.

Code: [Select]
surface.Clear(sf::Color(0, 255, 0, 255));
window.Draw(surface);


The result is a 512x512 black block.

Then I thought maybe it will clear the area in the view, not sure if the 2.0 documentation is outdated with this class but I tried this:

Code: [Select]
sf::View view;
view.Reset(sf::FloatRect(100, 100, 400, 200));

sf::RenderImage surface;
surface.SetView(surface);  //No function in class SetView()


Am I going about clearing the RenderImage with a specific colour?

Kris
Title: RenderImage.Clear(...) issue
Post by: Laurent on July 10, 2011, 12:44:54 pm
Try this:
Code: [Select]
surface.Clear(sf::Color::Red);
surface.Display();

window.Draw(sf::Sprite(surface));


The documentation is not outdated, the SetView function is in the RenderTarget base class.