Controlling Painting Properties

When working with digital paint automation, specific properties, as well as the background color, can be set or retrieved using the following functions:

L_AutGetPaintBkColor

L_AutGetPaintProperty

L_AutSetPaintBkColor

L_AutSetPaintProperty

The LEADTOOLS Digital Paint tools let you manipulate the following:

image\sqrblit.gif Paintbrush characteristics

image\sqrblit.gif Shape characteristics

image\sqrblit.gif Region characteristics

image\sqrblit.gif Fill characteristics

image\sqrblit.gif Text characteristics

Each set of characteristics given above has several properties that can be set. This lets the user fine tune the output. These properties can be set using the L_AutSetPaintProperty function. To retrieve the current settings for the properties, use the L_AutGetPaintProperty function. Below is an example showing how to manipulate the Shape properties:

 

/* this example shows how to change the paint shape properties */
L_INT SetPaintShapePropsTest ( pAUTOMATIONHANDLE pAutomation ) 
{
   if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
   {
      PAINTSHAPE shape ; 


      /* set the paint shape group properties */
      L_AutGetPaintProperty ( pAutomation, PAINT_GROUP_SHAPE, &shape ) ; 

      /* make some changes to the required properties */
      if ( SHAPE_BORDER_STYLE_SOLID == shape.nBorderStyle ) 
      {
         /* set the desired shape properties using the field masks */
         shape.nSize         = sizeof ( PAINTSHAPE ) ; 
         shape.dwMask    = PSF_BORDERSTYLE |
                                   PSF_BORDERWIDTH |
                                   PSF_BORDERENDCAP; 
         shape.nBorderStyle  = SHAPE_BORDER_STYLE_DOT ; 
         shape.nBorderWidth  = 10 ; 
         shape.nBorderEndCap = SHAPE_BORDER_ENDCAP_ROUND ; 

         /*set the paint shape group properties */
         L_AutSetPaintProperty ( pAutomation, PAINT_GROUP_SHAPE, &shape ) ; 
      }

      return SUCCESS ; 
   }
   else
   {
      return FAILURE ; 
   }
}

For more examples showing the use of digital paint automation, refer to Paint Automation Tutorials.

When the user cuts or deletes some region from a bitmap, an exposed area is left behind This area will be filled by the paint background color, set by the function L_AutSetPaintBkColor. To determine the current paint background color, call L_AutGetPaintBkColor. The example below shows how to retrieve and set the paint background color:

 

/* This example will make sure that the BK is not anything but black */
L_INT StickToBalck ( pAUTOMATIONHANDLE pAutomation ) 
{
   if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
   {
      COLORREF crBkColor ; 


      /* get the current paint automation color */
      L_AutGetPaintBkColor ( pAutomation, &crBkColor ) ; 
 
      if ( crBkColor != RGB ( 0, 0, 0 ) ) /* check if its not black */
      {
         /* set the paint automation background color */ 
         L_AutSetPaintBkColor ( pAutomation, RGB(0, 0, 0 ) ) ; 
      }

      return SUCCESS ; 
   }
   else
   {
      return FAILURE ; 
   }
}