Provides indexed access to each line of pixels of a bitmap.
__property unsigned char* ScanLine[int Row];
Description
Use ScanLine to alter the bitmap pixel by pixel. This is the fastest way of changing a pixel on a bitmap. ScanLine returns a pointer to the beginning of the line indexed by Row. Row is zero-based, 0 means the top line. Each line consists of an array of pixel colors. A pixel color is an 8-bit value that addresses a color in the palette. So here is an example that changes the color of a pixel:
ScanLine[Row] + Column = PixelColor; // set a pixel
You can also manipulate the bitmap with the
Pixels and the Pitch properties.
Be very careful when you're manipulating the
pixels of a bitmap. Do not overrun beyond the bitmap memory. The lines of a bitmap are
usually not contiguous. In other words, the next line is not immediately after the previous one.
So do not treat the bitmap as an array of pixels. Only a single line of the bitmap can be
treated as an array of pixels. To get a pointer to the line number Row, use the ScanLine
property.
Notes
The ScanLine
property appeared in C++Builder 3.0. The ScanLine in the
Ivory Draw components works very much like the
ScanLine in TBitmap,
except that the Ivory Draw components support the use of the ScanLine
property even in C++Builder 1.0.