Painting a Shape

LEADTOOLS DigitalPaint provides the following functions for painting a shape:

L_PntDrawShapeLine

L_PntDrawShapeRectangle

L_PntDrawShapeRoundRect

L_PntDrawShapeEllipse

L_PntDrawShapePolygon

L_PntDrawShapePolyBezier

These functions require:

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

Before painting a shape, set the DigitalPaint metrics using the L_PntSetMetrics function.

Any transformation information should be set, using the L_PntSetTransformation function before calling any shape or other painting function. To get the current transformation information, call L_PntGetTransformation.

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 ) ;   
shape.nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_ROUND ;   
/* Set the new shape properties */   
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;   
/*Select the bitmap into the paint handle*/   
L_PntSetMetrics ( pPaint, NULL, &hLeadBitmap, NULL ) ;   
/* Use the current shape properties to draw a line to the currently selected bitmap*/   
L_PntDrawShapeLine ( pPaint, hDC, 10, 10, 200, 200 ) ; 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Digital Paint C API Help