Setting DigitalPaint Properties

LEADTOOLS DigitalPaint provides several types of painting abilities, including:

painting using a paintbrush

painting shapes

painting a region

filling an area with paint

painting text

Each of these is considered a paint "group" and each group has its own set of DigitalPaint 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:

PAINTBRUSH

PAINTSHAPE

PAINTREGION

PAINTFILL

PAINTTEXT

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 DigitalPaint properties.

To get the current properties for a group, call LRasterPaint::GetProperty. This function requires the paint group to get, and a pointer to the appropriate group-specific structure. LRasterPaint::GetProperty will update the group-specific structure with the current property values.

To set the properties for a group, call LRasterPaint::SetProperty. This function requires 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   
PAINTSHAPE  shape ;   
      //Set the desired shape properties using the field masks   
      shape.nSize         = sizeof ( PAINTSHAPE ) ;   
      shape.dwMask    = PSF_BACKGROUNDSTYLE |   
                                     PSF_BORDERSTYLE |   
                                     PSF_BORDERCOLOR |   
                                     PSF_BORDERWIDTH |   
                                     PSF_BORDERENDCAP |   
                                     PSF_GRADIENTSTYLE |   
                                     PSF_GRADIENTSTARTCOLOR |   
                                     PSF_GRADIENTENDCOLOR   |   
                                     PSF_GRADIENTSTEPS ;   
   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    
   // Assume Paint was constructed from LRasterPaint class   
   Paint.SetProperty ( 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:

PAINT_GROUP_BRUSH

PAINT_GROUP_SHAPE

PAINT_GROUP_REGION

PAINT_GROUP_FILL

PAINT_GROUP_TEXT

In addition to setting the Digitalpaint properties, other information should be set before actually painting. This includes:

These properties are referred to as the DigitalPaint metrics. For more information, refer to Setting General DigitalPaint Information.

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS DigitalPaint C++ Class Library Help