Using the LRasterPaintWindow Class

For low-level DigitalPaint, LEAD provides the LAutomation, LContainer and LToolbar classes, in addition to the LRasterPaint class, to allow the user to customize his or her DigitalPaint application. These classes allow the user to provide low-level automation, container and toolbar support.

For those users who wish to program DigitalPaint applications at a higher level, LEADTOOLS DigitalPaint provides the LRasterPaintWindow class. This class can be used only as a window.

The LRasterPaintWindow class provides some automation, container and toolbar support that keeps the user from having to work with the lower level LAutomation, LContainer and LToolbar classes. To further understand the low-level automation, container and toolbar support, refer to the following help files in the LEAD/HELP directory:

Ltautlibn.hlp

Lttblibn.hlp

To use the LRasterPaintWindow (or any derived) class as a Window in an application, a window must be created and then the newly created window handle assigned to an LRasterPaintWindow (or derived) object. After that, the class object will do all of the processing required to handle the Window messages that the window will receive, including those relating to displaying images. To assign a window handle to an LRasterPaintWindow object, call LRasterPaintWindow::SetWndHandle.

Once the window has been created, the internal automation handle must be initialized by calling LRasterPaintWindow::Initialize. This handle must be initialized before calling many of the LRasterPaintWindow functions. Once initialized by calling LRasterPaintWindow::Initialize, the internal automation handle is "valid". It will remain valid until LRasterPaintWindow::Free is called to free the internal automation and container handles. The container handle is initialized when a bitmap is attached to the class object by calling LRasterPaintWindow::SetBitmap. To determine whether these internal handles are valid, call LRasterPaintWindow::IsValid.

The internal container handle references the container for the LRasterPaintWindow window. A container can be attached to a window. The window to which a container is attached is said to "own" that container. After attaching the container to a window, the container becomes responsible for collecting and transforming the coordinates of any selected objects in the container. The LRasterPaintWindow class contains the following function for determining whether the container handle is valid:

LRasterPaintWindow::IsValid

The LRasterPaintWindow class provides support for using a DigitalPaint toolbar with the class object. The DigitalPaint toolbar supported by this class is an automation toolbar, which automatically handles all buttons and function calls. The LRasterPaint Window class provides functions for creating, positioning, displaying and freeing the DigitalPaint toolbar. These are listed below:

LRasterPaintWindow::CreateToolbar

LRasterPaintWindow::FreeToolbar

LRasterPaintWindow::SetToolbarPosition

LRasterPaintWindow::ShowToolbar

In addition, the LRasterPaintWindow class provides the LRasterPaintWindow::GetToolbar and LRasterPaintWindow::SetToolbar for getting and setting the toolbar handle.

Before painting, a bitmap must be attached to the LRasterPaintWindow object by calling LRasterPaintWindow::SetBitmap. This bitmap will be displayed in the LRasterPaintWindow window and is the bitmap on which painting will occur. To get the bitmap currently attached to the LRasterPaintWindow class object, call LRasterPaintWindow::GetBitmap. The entire bitmap, and all objects painted on the bitmap can be selected or deselected by calling LRasterPaintWindow::SelectAll and LRasterPaintWindow::SelectNone, respectively.

At this point, painting can begin. Items can be painted using the DigitalPaint toolbar and the default paint properties.

LEADTOOLS provides a number of functions for determining the current paint properties and for setting new values for the paint properties. For more information on this, please refer to the Setting DigitalPaint Properties in the LRasterPaintWindow Class.

LEADTOOLS also provides the LRasterDialog class for displaying dialogs used to change the paint properties. For more information on this topic, refer to Using the DigitalPaint Common Dialogs.

In addition to painting capabilities, the LRasterPaintWindow class includes functions for several other capabilities, including redoing and undoing operations, printing paint data, and editing paint data by cutting, pasting, copying and deleting. These functions are listed here:

Undoing and Redoing Paint Operations

LRasterPaintWindow::CanRedo

LRasterPaintWindow::CanUndo

LRasterPaintWindow::Redo

LRasterPaintWindow::Undo

Editing DigitalPaint Data

LRasterPaintWindow::Copy

LRasterPaintWindow::Cut

LRasterPaintWindow::Delete

LRasterPaintWindow::Paste

Printing DigitalPaint Data

LRasterPaintWindow::Print

To let the paint window handle palette changes based on messages received, call LRasterPaintWindow::HandlePalette.

To repaint all or part of the class object's window, call LRasterPaintWindow::Repaint.