GetBitmapClipSegments method (Main Control)

C++ Builder example

Delphi example

 

Builder Syntax

int GetBitmapClipSegments(int nRow, void * pSegmentBuffer, pCardinal puSegmentCount);

Delphi Syntax

Function GetBitmapClipSegments(nRow: Integer; pSegmentBuffer: Pointer; puSegmentCount: pCardinal ): Integer;

Overview

Refer to Creating and Using a Bitmap Region

Remarks

Gets the segments contained in the region for a particular row.

Call this method only for those rows that are within the region. That is, only those rows from RgnTop to RgnTop + RgnHeight. For the rows not contained in the region, their clip segments will include the whole row.

The segments are returned as an array of pairs of horizontal offsets. The first point in the pair is the beginning of the segment (it is contained in the region). The last point in the pair is the end of the segment. To follow the Windows rules, the end of the segment is the first point NOT CONTAINED in the region.

In most regions, there will be one segment per row. However, some regions can have 0, 1, 2 or more segments.

For example, assume that for a particular row there are two segments. The VARIANT will be filled with 4 values. Let’s call them x0, x1, x2, x3. In this case:

image\sqrblit.gif portion from 0 to x0 – 1 is OUTSIDE the region

image\sqrblit.gif portion from x0 to x1 - 1 is INSIDE the region

image\sqrblit.gif portion from x1 to x2 – 1 is OUTSIDE the region

image\sqrblit.gif portion from x2 to x3 – 1 is INSIDE the region

image\sqrblit.gif portion from x3 to pBitmap->Width – 1 is OUTSIDE the region

It is recommended that you allocate a buffer large enough to hold all the possible segments. To get the maximum number of segments, call GetBitmapClipSegmentsMax method. Allocate an array of unsigned values that can contain the largest number of segments

See Also

Elements:

RgnTop property, RgnHeight property, GetBitmapClipSegmentsMax method

Topics:

Raster Images: Creating and Using a Region