Leaper Vision Toolkit
Draw Functions

NOTE: Draw functions and LDisplay Control is now only implemented on Windows. For others (Mac / Linux), the functions and related interfaces are retained but non-functional.


For the image and the drawable LPV classes which implements the ILDrawable interface, we usually provide the Draw functions to paint the class's content on the provided device context, aka. the HDC handle.

It is a more flexible and light-weighted API for the users to fully control the graphics rendering of their applications, compared with the LDisplay Control.

Here are some example draw functions for the image, region and detection results:

void ILImage::Draw (HDC hdc, double zoomX, double zoomY, double panX, double panY);
void ILRegion::Draw (HDC hdc, BOOL bHandles, double zoomX, double zoomY, double panX, double panY);
void ILMatchResults::Draw (HDC hdc, int index, LPVPatDrawFlags drawFlags, double zoomX, double zoomY, double panX, double panY)
void ILMatchResults::DrawAll (HDC hdc, LPVPatDrawFlags drawFlags, double zoomX, double zoomY, double panX, double panY)

They have the common parameters for specifying the drawing device context and controlling the view port.

Parameters
[in]hdcHandle to the device context of the destination window or bitmap.
[in]zoomXFactor for zooming in or out in the x-coordinate direction. By default, it's 1, means the true 100% scale.
[in]zoomYFactor for zooming in or out in the y-coordinate direction. Setting to 0 means same zoom factor as zoomX, aka. isotropic scaling.
[in]panXtranslation in the x-coordinate direction for panning. The final display x position is calculated as: \( (x + panX) \times zoomX \)
[in]panYtranslation in the y-coordinate direction for panning. The final display y position is calculated as: \( (y + panY) \times zoomY \)

They may also have the extra parameters to control drawing behavior.

Examples for Use the Draw Functions

Draw on the Bitmap

Draw in the OnPaint Method