TCustomIvorySurface::ScanLine

Provides indexed access to each line of pixels of a locked surface.

__property unsigned char* ScanLine[int Row];

Description

Use ScanLine to alter the surface pixel by pixel. This is the fastest way of changing a pixel on a surface. 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 you should cast the pointer returned by ScanLine to unsigned char*, like this:

ScanLine[Row] + Column = PixelColor; // set a pixel

Before you use the ScanLine property, you must lock the surface by the Lock method. Never leave a surface locked for a long time. Always unlock it if you don't want to manipulate it.

You can also manipulate the surface with the Pixels and the Pitch properties.

Be very careful when you're manipulating the pixels of a surface. Do not overrun beyond the surface memory. The lines on a surface are usually not contiguous. In other words, the next line is not immediately after the previous one. So do not treat the surface as an array of pixels. Only a single line of the surface 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.

Back to TCustomIvorySurface