←Select platform

RasterPaintDibInfo Class


This class describes the image data expected by the custom paint callbacks. It is used with the RasterPaintCallbacks callbacks.


public class RasterPaintDibInfo
Public Class RasterPaintDibInfo
public ref class RasterPaintDibInfo


The user will typically allocate this class and return it from the RasterImagePaintCallbackFunction.GetDibInfoCallback callback.


This example will show how to indicate that the graphics device expects a 16-bit image with the image data in the low 12 bits. Also, this particular card expected the data to be top-down, unlike the usual GDI functions which expect the data to be upside-down.

The example is in C++/CLI because this is the most useful language for implementing these classes.

// macro that calculates the number of bytes per line, rounding up to a multiple of 4 bytes 
#define DIB_WIDTH_BYTES(pixels) ((((pixels) + 31) & ~31) >> 3) 
Object^ myPaintCallbacks::GetDibInfoCallback(RasterImage^ image, array<Object^>^ args) 
   // make sure the parameters are correct 
   if(args->Length != 2 ||   image == nullptr) 
      throw gcnew RasterException(RasterExceptionCode::InvalidParameter); 
      return nullptr; 
   UInt32 uWidth = (UInt32)args[1]; 
   RasterPaintDibInfo^ pDibInfo = gcnew RasterPaintDibInfo; 
   if(pDibInfo == nullptr) 
      throw gcnew RasterException(RasterExceptionCode::NoMemory); 
      return nullptr; 
   pDibInfo->BitsPerPixel = 16;          // paint using 16-bit data, although there are only 12 significant bits 
   pDibInfo->PlaneCount = 1;             // One plane 
   pDibInfo->BytesPerLine = DIB_WIDTH_BYTES(uWidth * 16);   // bytes per line is a multiple of 4 bytes 
   pDibInfo->ViewPerspective = RasterViewPerspective::TopLeft; // the data should be TOP_LEFT, not BOTTOM_LEFT like the data in the regular GDI functions 
   pDibInfo->Order = RasterByteOrder::Gray;         // gray bitmap 
   // indicate that the data should be in the low 12 bits 
   pDibInfo->Flags = RasterPaintDibInfoFlags::LowHighBitValid; 
   pDibInfo->LowBit = 0; 
   pDibInfo->HighBit = 11; 
   return pDibInfo; 


Target Platforms

Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
Leadtools.Drawing Assembly
Click or drag to resize