Available in the LEADTOOLS Imaging toolkit. |
GetBitmapClipSegments example for C++ 4.0 and later
COleSafeArray vSegments;
float y;
long LBound, UBound;
float *pSegments;
int i, j;
m_Lead1.SetScaleMode(3); // use pixels
m_Lead1.SetAutoRepaint(FALSE); // disable repainting
y = m_Lead1.GetRgnTop();
// get the clip segments
vSegments = m_Lead1.GetBitmapClipSegments(y);
// vSegments should be an array of floats.
if(V_VT((LPVARIANT)vSegments) == VT_ARRAY | VT_R4)
{
// get the bounds
vSegments.GetLBound(1, &LBound);
vSegments.GetUBound(1, &UBound);
// get a pointer to the data
vSegments.AccessData((void**)&pSegments);
// loop through all the segments
for(i = LBound; i < UBound; i += 2)
{
// for every segment, set all the pixels to black
for(j = (int)pSegments[i – LBound]; j < pSegments[i – LBound + 1]; j++)
m_Lead1.SetPixel((float)j, y, RGB(0, 0, 0));
}
m_Lead1.SetAutoRepaint(TRUE); // re-enable repainting
vSegments.UnaccessData();
}