SFML community forums
Help => Graphics => Topic started by: quasius on March 27, 2008, 08:36:44 pm
-
Hey and thanks for the great library. I have a question about the internal storage of an image. (The data you get with sf::Image.GetPixelsPtr())
Is this data always guaranteed to be 4 bytes-per-pixel (RGBA, as far as I can tell), right-to-left, top-to-bottom with 0000 always being transparent?
Is it's true now, will this possibly change in the future? (I'm trying to decide exactly how deeply to embed this assumption into my code.)
Thanks again and happy Easter.
-
Is this data always guaranteed to be 4 bytes-per-pixel (RGBA, as far as I can tell), right-to-left, top-to-bottom with 0000 always being transparent?
Except that it's left-to-right, yes it is. SFML uses a unique internal representation for textures, it's not going to change. So you can safely rely on it.
-
Is this data always guaranteed to be 4 bytes-per-pixel (RGBA, as far as I can tell), right-to-left, top-to-bottom with 0000 always being transparent?
Except that it's left-to-right, yes it is. SFML uses a unique internal representation for textures, it's not going to change. So you can safely rely on it.
The transparent pixels seem to be RGB0, not 0000- at least with .png. I'll just check for the A byte being 0.
Edit: It would still be nice to have a consistent pattern to transparent pixels, in case A is 0 for some other reason, but I guess it doesn't matter for my current use.
-
Yes, sorry I forgot to tell you about alpha. Transparency is only given by the Alpha chanel, independently of the RGB ones. It allows to have colored pixels partially transparent, for example.
Note that transparency can also be influenced by RGB chanels if you change the blending mode to multiplicative or additive.