GetBitmapClipSegments example for C++ 5.0 and later
ILEADRasterVariant * pltRasVar = NULL;
float y;
long LBound, UBound;
float *pSegments;
int i, j;
CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL,
IID_ILEADRasterVariant, (void **)&pltRasVar);
m_RasterView1.GetRaster().SetScaleMode(3); // use pixels
m_RasterView1.SetAutoRepaint(FALSE); // disable repainting
y = ( m_RasterView1.GetRaster().GetRgnTop() + m_RasterView1.GetRaster().GetRgnHeight() ) / 2;
// get the clip segments
pltRasVar = m_RasterView1.GetRaster().GetBitmapClipSegments(y);
// vSegments should be an array of floats.
if(pltRasVar->Type == VALUE_ARRAY_FLOAT)
{
// loop through all the segments
for(i = 0; i < pltRasVar->ItemCount ; i += 2)
{
// for every segment, set all the pixels to black
for(j = (int)pltRasVar->FloatItemValue(i) ; j < pltRasVar->FloatItemValue(i + 1); j++)
m_RasterView1.GetRaster().SetPixel((float)j, y, RGB(0, 0, 0));
}
m_RasterView1.SetAutoRepaint (TRUE); // re-enable repainting
}
pltRasVar->Release ();