Pitch Question

Can someone explain pitch to me? From the documentation I assumed that
the pitch of a surface would be equal to the width of the surface times
the bits per pixel. This doesn’t seem to be correct, what is the pitch?

Thanks,
Buck

‘Pitch’ is the physical width of the surface, as opposed to the logical
width of the surface. It mainly comes into play where your surfaces are
of an unusual width. Since graphics cards are often optimised to send
and store data in blocks with widths of a power of 2, it is common for
them to pad out your graphic’s width to the nearest larger power of 2
(or some other ‘round’ number in binary terms) to keep them aligned.
This means you have to keep track of where the actual image starts and
where the padding begins so that you don’t end up blitting the padding.–
Kylotan

Bytes, not bits.
256 horizontal pixels
256 X 1 for 8bit 256pitch
256 X 2 for 16bit 512pitch
256 X 3 for 24bit 768pitch
256 X 4 for 32bit 1024pitch> ----- Original Message -----

From: sdl-admin@libsdl.org [mailto:sdl-admin at libsdl.org] On Behalf Of
Wesley (Buck) Lemke
Sent: Wednesday, February 20, 2002 6:19 PM
To: sdl at libsdl.org
Subject: [SDL] Pitch Question

Can someone explain pitch to me? From the documentation I assumed that
the pitch of a surface would be equal to the width of the surface times
the bits per pixel. This doesn’t seem to be correct, what is the pitch?