Controlling Painting Properties

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

The LEADTOOLS DigitalPaint tools let you manipulate the following:

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 LAutomation::SetPaintProperty function. To retrieve the current settings for the properties, use the LAutomation::GetPaintProperty 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 ( LAutomation * pAutomation ) 
{ 
   if ( SUCCESS == pAutomation->IsValid() ) /* check the validity of the automation handle */ 
   { 
      PAINTSHAPE shape ; 
      /* set the paint shape group properties */ 
      pAutomation->GetPaintProperty ( PAINT_GROUP_SHAPE, &shape ) ; 
      /* make some changes to the required properties */ 
      if (PAINT_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  = PAINT_SHAPE_BORDER_STYLE_DOT ; 
         shape.nBorderWidth  = 10 ; 
         shape.nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_ROUND ; 
         /*set the paint shape group properties */ 
         pAutomation->SetPaintProperty ( PAINT_GROUP_SHAPE, &shape ) ; 
      } 
      return SUCCESS ; 
   } 
   else 
   { 
      return FAILURE ; 
   } 
} 

For more examples showing the use of DigitalPaint automation, refer to DigitalPaint 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 LAutomation::SetPaintBkColor. To determine the current paint background color, call LAutomation::GetPaintBkColor. 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 StickToBlack (LAutomation * pAutomation) 
{ 
   if ( SUCCESS == pAutomation->IsValid ( ) ) /* check the validity of the automation handle */ 
   { 
      COLORREF crBkColor ; 
      /* get the current paint automation color */ 
      crBkColor = pAutomation->GetPaintBkColor () ; 
       
      if ( crBkColor != RGB ( 0, 0, 0 ) ) /* check if its not black */ 
      { 
         /* set the paint automation background color */ 
         pAutomation->SetPaintBkColor (RGB(0, 0, 0 ) ) ; 
      } 
      return SUCCESS ; 
   } 
   else 
   { 
      return FAILURE ; 
   } 
} 

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

LEADTOOLS Container and Automation C++ Class Library Help