Initializing and Freeing DigitalPaint Handles

The LEADTOOLS Digital Paint products uses the LRasterPaint object's internal PAINTHANDLE structure as a working area for the painting functions. This handle must be initialized, by calling LRasterPaint::Initialize, before calling other DigitalPaint functions. LRasterPaint::Initialize initializes the paint handle, making it valid. To determine whether a paint handle is valid, call LRasterPaint::IsValid. When the paint handle is no longer needed, it should be freed by calling LRasterPaint::Free.

The following code sample gives an example of initializing a paint handle.

The toolkit uses the LRasterPaint class for the DigitalPaint functions. The user must initiate the DigitalPaint class object before using any of the class functions.

LRasterPaint Paint; 
// initiate the Paint toolkit. 
if ( SUCCESS != Paint.Initialize () ) 
   return FALSE ; 

Initializing the PAINTHANDLE sets all internal states (properties, clipping region, transformationsetc.) to their default values.

The following code sample checks the validity of a paint handle and, if valid, frees that paint handle. Freeing the paint handle should be done when the paint handle is no longer needed.

if ( SUCCESS == Paint.IsValid () ) 
   Paint.Free () ; 

Once LRasterPaint::Free has been called, the LRasterPaint object's handle is no longer valid. LRasterPaint::Initialize must be called again to initialize the paint handle and make it valid.

Once the LRasterPaint object's handle is initialized, certain paint information should be set. For more information on setting this paint information, refer to Setting DigitalPaint Properties and Setting General DigitalPaint Information.

To check the validity of the LRasterPaint object's handle before performing any operation on it, use the LRasterPaint::IsValid function. The LRasterPaint class object becomes valid after initializing it using the LRasterPaint::Initialize function and becomes invalid after calling the LRasterPaint::Free function.

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

LEADTOOLS DigitalPaint C++ Class Library Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.