SFML community forums

Help => Graphics => Topic started by: Mouce on January 19, 2012, 08:32:33 pm

Title: (SOLVED) Sf::Image.CopyScreen() returns a lossy format?
Post by: Mouce on January 19, 2012, 08:32:33 pm
Thanks for writing such a great library.

In my program I update the display by calling the CopyScreen() function, assigning the image to a sprite, and Y flipping the sprite. It's a simple board game, so I designed it this way to reduce the number of sf::sprite objects I need to keep track of - once an object is drawn on the board, it is there for the rest of the program's life.

I get some image corruption (blurring) every turn, which makes me think CopyScreen() or FlipY() is degrading the image. Is there a way to make the returned image from CopyScreen() (or FlipY()) non-lossy?

I can provide some code if this doesn't make sense.
Title: (SOLVED) Sf::Image.CopyScreen() returns a lossy format?
Post by: Hiura on January 19, 2012, 08:50:29 pm
[nothing]
Title: (SOLVED) Sf::Image.CopyScreen() returns a lossy format?
Post by: Nexus on January 19, 2012, 08:51:27 pm
I doubt that CopyScreen() is lossy, since a sf::Image is just an uncompressed container of pixels, similar to a bitmap. But the drawing may get distorted if you use a specific view or transform, or have the smooth filter (sf::Image::SetSmooth()) activated.

You shouldn't leave drawn objects on the screen. Redraw them again and again, always calling Clear() and Display() once per frame.
Title: (SOLVED) Sf::Image.CopyScreen() returns a lossy format?
Post by: Mouce on January 19, 2012, 09:08:07 pm
Excellent suggestion.

SetSmooth(false) solved my problems - I don't know how long that would have taken me to discover on my own; thank you.

I'll try to ask future questions with some reduced code examples - I'm a rotten communicator in non-formal language X(