LEADTOOLS DigitalPaint provides several types of painting abilities, including:
painting using a paintbrush
painting a region
filling an area with paint
Each of these is considered a paint "group" and each group has its own set of paint properties that can be set. The values set for these properties control the paint results. For example, these properties determine:
whether the user draws a line or an ellipse.
whether the paintbrush contains color or an image.
how quickly the paint in the paintbrush will fade, if at all.
the shape of the region to paint.
the color to use when filling an area.
the text to paint.
Each group of properties has a group-specific structure used for getting or setting the properties. These structures are given below:
Every structure has the dwMask field that will let the user specify the valid fields within the structure. In addition, there are default values for the members of each structure, which will be used if the user does not set paint properties.
To get the current properties for a group, call L_PntGetProperty. This function requires a valid paint handle, the paint group to get, and a pointer to the appropriate group-specific structure. L_PntGetProperty will update the group-specific structure with the current property values.
To set the properties for a group, call L_PntSetProperty. This function requires a valid paint handle, the paint group to set, and a pointer to the appropriate group-specific structure. The structure should contain valid data for setting the properties.
The following is a simple example for setting the shape group properties. (It assumes the paint handle has been initialized.):
//The paint shape structure that will be used to set the shape properties
//Set the desired shape properties using the field masks
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BACKGROUNDSTYLE |
shape.nBackgroundStyle = PAINT_SHAPE_BACK_STYLE_GRADIENT;
shape.nBorderStyle = PAINT_SHAPE_BORDER_STYLE_DOT ;
shape.crBorderColor = RGB ( 255, 0, 0 ) ;
shape.nBorderWidth = 10 ;
shape.nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_ROUND ;
shape.nGradientStyle = PAINT_SHAPE_GRADIENT_STYLE_CONE_FROM_L ;
shape.crGradientStartColor= RGB ( 255, 192, 0 ) ;
shape.crGradientEndColor= RGB ( 0, 0, 255 ) ;
shape.uGradientSteps = 255 ;
//Set the paint shape group properties
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;
This example uses the constant PAINT_GROUP_SHAPE to identify the group that will be set. The toolkit has the following group constants:
In addition to setting the paint properties, other information should be set before actually painting. This includes:
the device context to use for display
an optional handle to a bitmap to use as a painting canvas
an optional restriction palette to limit the paint colors displayed or painted on the canvas
These properties are referred to as the DigitalPaint metrics. For more information, refer to Setting General DigitalPaint Information.