Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: (SOLVED) Sf::Image.CopyScreen() returns a lossy format?  (Read 2224 times)

0 Members and 1 Guest are viewing this topic.

Mouce

  • Newbie
  • *
  • Posts: 2
    • View Profile
(SOLVED) Sf::Image.CopyScreen() returns a lossy format?
« 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.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
(SOLVED) Sf::Image.CopyScreen() returns a lossy format?
« Reply #1 on: January 19, 2012, 08:50:29 pm »
[nothing]
SFML / OS X developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
(SOLVED) Sf::Image.CopyScreen() returns a lossy format?
« Reply #2 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.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Mouce

  • Newbie
  • *
  • Posts: 2
    • View Profile
(SOLVED) Sf::Image.CopyScreen() returns a lossy format?
« Reply #3 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(

 

anything