Provides a powerful set of graphics features by creating a Microsoft Windows device context, using the specified bitmap as the display surface.
L_LTKRN_API L_HDC L_CreateLeadDC(pBitmap)
Pointer to the LEAD bitmap handle referencing the image data.
|>0||Function was successful. The return value is the HDC.|
|NULL||An error occurred.|
This function allows you to create an infinite number of drawing capabilities such as paint, erase, color erase and brush, pen, spray gun, flood fill, color tube, text overlay, curve, line, rectangle, polygon, ellipse, freehand shapes, cut and paste, and more.
All Windows GDI functions can be used to draw to the bitmap using the returned HDC. The HDC must be freed with the L_DeleteLeadDC function.
Note: For WIN32 applications, this function ensures that the bitmap's view perspective is BOTTOM_LEFT, flipping the bitmap if necessary. This can affect functions that use bitmap coordinates. For more information, refer to Accounting for View Perspective.
If a region is defined for the bitmap, GDI functions act only on the region, not on the entire bitmap.
The DIB driver supports only 1, 4, 8, 16, 24 and 32 bit images. If you are using an image that has some other number of bits per pixel, you must use L_ColorResBitmap to change the image to a bits per pixel value supported by the DIB driver.
For complete sample code, refer to the DRAW example.
This example uses GDI functions to draw an ellipse on the bitmap.
BITMAPHANDLE LeadBitmap; /* Bitmap handle for the image */
HDC LeadDC; /* Device context for the LEAD bitmap */
L_INT StartGDIX, StartGDIY, EndGDIX, EndGDIY; /* Drawing coordinates */
/* Load a bitmap at its own bits per pixel */
nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
if(nRet != SUCCESS)
/* Create the device context */
LeadDC = L_CreateLeadDC(&LeadBitmap);
/* Set the drawing coordinates in the top left quadrant of the bitmap */
StartGDIX = BITMAPWIDTH(&LeadBitmap) / 8;
EndGDIX = BITMAPWIDTH(&LeadBitmap) / 2;
StartGDIY = BITMAPHEIGHT(&LeadBitmap) / 8;
EndGDIY = BITMAPHEIGHT(&LeadBitmap) / 2;
/* Convert the coordinates if necessary */
if (LeadBitmap.ViewPerspective != TOP_LEFT)
L_PointToBitmap ( &LeadBitmap, TOP_LEFT, & StartGDIX, & StartGDIY );
L_PointToBitmap ( &LeadBitmap, TOP_LEFT, & EndGDIX, & EndGDIY );
/* Draw the ellipse */
Ellipse(LeadDC, StartGDIX, StartGDIY, EndGDIX, EndGDIY);
/* Delete the device context */
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries