How to get SDL_Surface->pixels size? |
How to get SDL_Surface->pixels size? |
phao
|
The amount of bytes the pixel data takes is .h * .pitch. You can also find more information on byte and bits size about the image by looking at the .format field (It's a SDL_PixelFormat*, which lets you access stuff like how many bytes per pixel you have there).
If you're copying pixel data directly through an SDL_Surface .pixels member, you should be aware of padding bytes. Each row of your image may be padded with some bytes. The row pixel bytes + row padding bytes is your image's pitch. When you're going through the image bytes, you want to be careful about that. You can look more about image pitch on the web. If you're copying from an SDL_Surface to another, consider using SDL's own functions. On Tue, Jun 9, 2015 at 11:39 PM, Nemo3773 wrote:
|
|||||||||||||
|
How to get SDL_Surface->pixels size? |
phao
|
On image formats and functions to deal with SDL_Surface instances, you should check https://wiki.libsdl.org/CategoryPixels and https://wiki.libsdl.org/CategorySurface in case you haven't already. Also, check https://wiki.libsdl.org/SDL_Surface and look at the .format field (it's a pointer to an SDL_PixelFormat, https://wiki.libsdl.org/SDL_PixelFormat).
The wiki is easy enough to follow. On Tue, Jun 9, 2015 at 11:56 PM, Pedro Henrique Antunes de Oliveira wrote:
|
|||||||||||||||
|