| fake Buffer->Memory
0 1 2 3 4 5 6 7
8 9 a b c d e f
g h i j k l m n
|
you can pretend that each element of the array above is the size uint8
so from the start of the array, 0, going 4 uint8's in gets you to 4
| [start here]0, 1, 2, 3, [end here]4
|
| uint8 *arraystart + 4 = 4
|
and from
| (uint8 *)(j's position) + 4 = n
|
since a uint32 is equal to 4 uint8's, it represents 4 elements in the array.
from the start of the array going 1 uint32 further gets you to 4
| (uint32 *)arraystart + 1 = 4
|
pitch = amount to get to the next row but under where the old position was
pitch = 8
row is a uint8 pointer type
so from 0's position adding the pitch puts you at 8, at c it puts you to k.
if row were a uint32 * then adding pitch would add pitch * 4 = 32
and would go outside of the array above, the point being it's not working as a pitch then
with the uint32 *Pixel, it's the same logic, you're accessing 4 elements at a time.
| [0, 1, 2 , 3], [4, 5, 6, 7] ... [g, h, i, j] ...
|