In many cases stride can be equal to width. In some cases the starting address of a line needs to have an aligned memory address (this would be something that the application demands). In that case stride is larger than width to provide the proper memory alignment. If you do not know what to do with the stride (i.e. no special alignment constraints are known for the application), you can make the stride equal to the width. The stride can also be used to access a field in a frame buffer. In that case the stride for accessing the field in the frame buffer needs to be two times the stride of the frame buffer.
All image buffers used are one-dimensional arrays (i.e. they are of type unsigned char* or of type unsigned short*). To address a single (2-D) pixel on coordinates (x,y) in such a buffer use:
pixel = buffer[y * stride + x];
Generated on Thu Nov 19 16:28:20 2009 for cpfspd by
1.3.9.1