Painting a Shape

The LEADTOOLS LRasterPaint class provides the following functions for painting a shape:







These functions require:

These functions will draw shapes based on the current shape properties. To determine the current shape properties, call LRasterPaint::GetProperty. To set or change the current shape properties, call LRasterPaint::SetProperty. For more information on the shape properties, refer to the PAINTSHAPE structure.

Before painting a shape, set the DigitalPaint metrics using the LRasterPaint::SetMetrics function.

Any transformation information should be set, using the LRasterPaint::SetTransformation function before calling any shape or other painting function. To get the current transformation information, call LRasterPaint::GetTransformation.

The following example sets the shape properties, sets the DigitalPaint metrics and paints a line. It assumes the paint handle has been initialized and the bitmap handle is valid:

PAINTSHAPE shape;    
/* Set the required shape properties */   
shape.nSize  = sizeof ( PAINTSHAPE ) ;   
shape.dwMask = PSF_BORDERWIDTH |   
                            PSF_BORDERSTYLE |   
                            PSF_BORDERCOLOR |   
                            PSF_BORDERENDCAP ;   
shape.nBorderWidth  = 10 ;    
shape.nBorderStyle  = PAINT_SHAPE_BORDER_STYLE_DASHDOT ;    
shape.crBorderColor = RGB ( 255, 0, 0 ) ;   
/* Set the new shape properties */   
// Assume Paint was constructed from LRasterPaint class   
Paint.SetProperty ( PAINT_GROUP_SHAPE, &shape ) ;   
/*Select the bitmap into the paint class object*/   
Paint.SetMetrics ( NULL, &hLeadBitmap, NULL ) ;   
/* Use the current shape properties to draw a line to the currently selected bitmap*/   
Paint.DrawShapeLine ( hDC, 10, 10, 200, 200 ) ; 

Help Version 21.0.2020.8.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS DigitalPaint C++ Class Library Help