Surface->Pitch?
-
- Insane DCEmu
- Posts: 290
- https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
- Joined: Wed Oct 17, 2001 7:44 pm
- Has thanked: 0
- Been thanked: 0
Surface->Pitch?
Is the pitch the number of bytes per pixel? I am confused as to what it really is.
"So I gotta be carefull, can't let tha evil of tha money trap me
so when ya see me #@#$%
ya better holla at me "
Tupac Shakur[1971-1996]
Makaveli[1996-????]
so when ya see me #@#$%
ya better holla at me "
Tupac Shakur[1971-1996]
Makaveli[1996-????]
-
- Damn Dirty Ape
- Posts: 5031
- Joined: Thu Nov 07, 2002 11:11 pm
- Location: Saugerties, NY
- Has thanked: 0
- Been thanked: 0
-
- bleemcast! Creator
- Posts: 882
- Joined: Wed Oct 17, 2001 7:44 pm
- Location: Los Angeles, CA
- Has thanked: 0
- Been thanked: 0
- Contact:
"Pitch" is the number of bytes between consecutive scanlines.
In almost all cases, it's simply (Width in pixels * #Bytes per Pixel) ... just as 138 wrote above.
There's a few reasons why it would be different from that -- here's two examples:
Example 1:
--------------
If a particular video chip only fetches memory in blocks of 128 bytes, and you want it to display 24bpp at 320 pixels wide.
24bpp (using 3 bytes per pixel) at 320 pixels wide works out to 960 bytes for the data.
... but the video hardware can't fetch memory if it's not aligned to 128-byte boundary, so the next scanline will be "bumped" to start at byte 1024.
What happened to the 64 bytes off the end of the scanline? They're unused and simply skipped over.
Example 2:
-------------
Interleaved scanlines for NTSC and PAL composite display fields.
The pitch is 2x what you expect (assuming no other hardware oddness), because every other scanline is actually from the opposite field.
Rand.
In almost all cases, it's simply (Width in pixels * #Bytes per Pixel) ... just as 138 wrote above.
There's a few reasons why it would be different from that -- here's two examples:
Example 1:
--------------
If a particular video chip only fetches memory in blocks of 128 bytes, and you want it to display 24bpp at 320 pixels wide.
24bpp (using 3 bytes per pixel) at 320 pixels wide works out to 960 bytes for the data.
... but the video hardware can't fetch memory if it's not aligned to 128-byte boundary, so the next scanline will be "bumped" to start at byte 1024.
What happened to the 64 bytes off the end of the scanline? They're unused and simply skipped over.
Example 2:
-------------
Interleaved scanlines for NTSC and PAL composite display fields.
The pitch is 2x what you expect (assuming no other hardware oddness), because every other scanline is actually from the opposite field.
Rand.
-
- Insane DCEmu
- Posts: 290
- Joined: Wed Oct 17, 2001 7:44 pm
- Has thanked: 0
- Been thanked: 0