Leadtools Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
RasterPaintDibInfo Class
See Also  Members   Example 
Leadtools Namespace : RasterPaintDibInfo Class



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

Syntax

Visual Basic (Declaration)  
Public Class RasterPaintDibInfo 
Visual Basic (Usage) Copy Code
Dim instance As RasterPaintDibInfo
C#  
public class RasterPaintDibInfo 
C++/CLI  
public ref class RasterPaintDibInfo 

Example

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.

C# Copy Code
// 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^>^ Params) 

   // make sure the parameters are correct 
   if(Params->Length != 2 || image == nullptr) 
   { 
      throw gcnew RasterException(RasterExceptionCode::InvalidParameter); 
      return nullptr; 
   } 
   UInt32 uWidth = (UInt32)Params[1]; 
   RasterPaintDibInfo^ pDibInfo = gcnew RasterPaintDibInfo; 
   if(pDibInfo == nullptr) 
   { 
      throw gcnew RasterException(RasterExceptionCode::NoMemory); 
      return nullptr; 
   } 
 
   pDibInfo->Default(); 
   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; 
}

Remarks

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

Inheritance Hierarchy

System.Object
   Leadtools.RasterPaintDibInfo

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also