Hello,
this is yet another newbie question:
I load a PNG file (50x91) into a surface with the SDL_image library,
if I do
printf("pitch: %i, width: %i\n", surface->pitch, surface->w);
it says
pitch: 152, width: 50
so, what are the (surface->pitch % surface->w) bytes ?
Are they important if I want to screw on surface->pixels or
can I just skip them in every line ?
Thank you in advance.
this is yet another newbie question:
I load a PNG file (50x91) into a surface with the SDL_image library,
if I do
it says
pitch: 152, width: 50
Pitch is the width of a surfaces scanline in bytes. However surface
scanlines are dword aligned so the length of each scanline is padded to a
multiple of 4. The PNG you loaded was 24-bit, so each pixel is 3 bytes in
size. So the length of each scanline of the image is 150 bytes plus 2
bytes to align it. So each scanline starts on a 4byte boundary which makes
everything faster and happier on x86 systems. The pitch member should be
used whenever you accessing pixel data, even if your surface width is a
multiple of 4.
MartinOn Sun, 28 May 2000 depet at gmx.de wrote:
Bother! said Pooh, as the vice squad took his GIFS.