Introduction

The LEADTOOLS DigitalPaint API provides dynamic link library (DLL) functions to let you incorporate Paint capabilities into your Windows applications. The Digital Paint features are available in the Raster Pro and above toolkits.

The DigitalPaint tools provide the functions necessary for to write a painting program or any painting related application.

The painting output can be painted to a device context (DC), a bitmap, or both. In addition, there LEADTOOLS DigitalPaint provides the option of color restriction, using an optional restriction palette.

The painting tools consist of five groups that represent five different paint abilities. Each of these "groups" has group specific functions. These groups are:

Paintbrush group.

Shape group.

Region group.

Fill group.

Text group.

Every group has its own features that will enable the user to manipulate the final results of that group.

Paintbrush group

The LEADTOOLS DigitalPaint paintbrush has most of the features found in any artistic painting program. The resulting paintbrush will be translated and scaled automatically for the device context and/or the bitmap, using user-defined transformation settings.

Shape group

The LEADTOOLS DigitalPaint shape group removes some of the Windows API programming when drawing shapes. In addition, shapes may be painted with varying degrees of opacity, or with a paper texture, or with a gradient background, etc. The resulting shapes will be translated and scaled automatically for the device context and/or the bitmap, using user-defined transformation settings.

This group has the ability to draw the following shapes:

Line, Rectangle, Rounded rectangle, Ellipse, Polygon, Polybezier.

Region group

The region group has the ability to create regions ranging from simple to very complex (many of them are not supported by Windows). The Digital Paint products also includes the ability to scale a region, which is not supported directly by Windows. The resulting regions will be translated and scaled automatically for the device context (DC) and/or the bitmap, using user-defined transformation settings.

Region types that can be created by the toolkit:

Region creation using the following shapes:

Rectangle, Rounded rectangle, Ellipse and Polygon.

Region creation using the following fill methods

Surface, Border and Color Replacement.

Fill group

LEADTOOLS DigitalPaint gives the user the most complete area filling solutions in both the method of filling and the features of filling. The resulting filled area will be translated and scaled automatically for the device context (DC) and/or the bitmap, using user-defined transformation settings.

Fill group filling methods

Surface, Border and Color replace.

Surface fill method

Fills an area, starting at a specified point and continuing in all directions, that contains a specified color. A tolerance range can also be set to accept colors very close in value to the specified color.

Border fill method

Fills an area, starting at a specified point and continuing in all directions until finding a specified color. A tolerance range can also be set to stop filling when colors very close in value to the specified color are found.

Color replace

Replaces every pixel using the current fill settings.

Text group

This group includes comprehensive text drawing features that can be found in any painting program. The resulting text will be translated and scaled automatically for the device context (DC) and/or the bitmap, using user-defined transformation settings.

The LEADTOOLS Digital Paint products does not copy data passed to a DigitalPaint function by the user, but uses the data directly. Therefore, the data supplied by the user must remain valid for as long as the data is needed. For example, if a palette handle is passed to a DIgitalPaint function, the toolkit uses this handle to access the palette. The toolkit does NOT make a copy of the handle or the palette. Therefore, if the palette handle provided by the use is destroyed, the toolkit's palette handle is also destroyed and the toolkit will have an invalid palette handle.

The toolkit comes in WIN32 editions so that it can support development of software applications for any of the following environments:

Windows 4.x NT
Windows 95
Windows 98
Windows 2000

Please note that if you have purchased an eval version of a LEADTOOLS toolkit, this help file contains the same information as the help file included in the standard release toolkit. Consequently, references to the .DLL and .LIB files contain an N designation. The .DLL and .LIB files included with the evaluation toolkit contain an E designation. Therefore, any references in the help file to xx14N.DLL or xx_N.LIB files refer to the corresponding xx14E.DLL or xx_E.LIB files. For example, if the help file refers to LTBAR14N.DLL, your corresponding file is LTBAR14E.DLL.


Example Programs

The following example programs are in separate EXAMPLES subdirectories (such as C:\LEAD14\EXAMPLES\DLL\PAINT). The executable files for these examples were compiled with Document/Medical capabilities. To get Document/Medical capabilities, you must buy a LEADTOOLS Document/Medical toolkit. Otherwise, if you recompile the examples, the resulting executable files will not have the Document/Medical capabilities.

Note:

You can run the example programs on your system by clicking the appropriate buttons in online help. If you try to run an example program that is not on your system, an error message will appear.

PAINT | DigitalPaint Demo is the main Paint example program. It uses pull-down menus to demonstrate most of the LEADTOOLS DigitalPaint (low level) features in one application.
AUTPNT | AutPnt Demo is the Automated Paint example program. It uses pull-down menus to demonstrate most of the LEADTOOLS DigitalPaint (automated) features in one application.


Version History

Current version: | 14.5
Last update: | October 26, 2005

Changes from Version 14 to Version 14.5

Changes from Version 13 to Version 14

Changes from Version 12.1 to Version 13

Version 12.1


Changes from Version 14 to Version 14.5

Version 14.5 of the LEADTOOLS DigitalPaint API has not changed from Version 14.


Changes from Version 13 to Version 14

Version 14 of the LEADTOOLS DigitalPaint API has changed from Version 13 as follows:

LEADTOOLS DigitalPaint API now supports UNICODE.


Changes from Version 12.1 to Version 13

Version 13 of the LEADTOOLS DigitalPaint API has not changed from Version 12.1.


Version 12.1

Version 12.1 is the first version of the LEADTOOLS DigitalPaint API.

The rest of this topic lists the functions in this toolkit:

Paint Functions:

L_PntApplyText

L_PntBrushLineTo

L_PntBrushMoveTo

L_PntDlgBrush

L_PntDlgFill

L_PntDlgShape

L_PntDlgRegion

L_PntDlgText

L_PntDrawShapeEllipse

L_PntDrawShapeLine

L_PntDrawShapePolyBezier

L_PntDrawShapePolygon

L_PntDrawShapeRectangle

L_PntDrawShapeRoundRect

L_PntFillBorder

L_PntFillColorReplace

L_PntFillSurface

L_PntFree

L_PntGetClipRgn

L_PntGetDCExtents

L_PntGetProperty

L_PntGetTransformation

L_PntInit

L_PntIsValid

L_PntOffsetClipRgn

L_PntPickColor

L_PntRegionBorder

L_PntRegionColor

L_PntRegionEllipse

L_PntRegionPolygon

L_PntRegionRect

L_PntRegionRoundRect

L_PntRegionScale

L_PntRegionSurface

L_PntRegionTranslate

L_PntSetClipRgn

L_PntSetDCExtents

L_PntSetMetrics

L_PntSetProperty

L_PntSetTransformation


Copyright notice

Copyright Notices

©Copyright LEAD Technologies, Inc. 1991-2005. ALL RIGHTS RESERVED

Portions of the PCDLIB32.DLL, PCDLIB.DLL, LFFPX7.DLL, LFKODAK.DLL, EKFPIXJPEG140.DLL, PDC_SDK.DLL, PROFIRE.DLL, DC120V154_32.DLL, LFDCR14N.DLL, DCSPROBACK.DLL, DCSPRO3SLR.DLL, LFDCS14N.DLL, and LFKDC14N.DLL files contain material that is ©Copyright Eastman Kodak Company, 1996-2001. This software is based in part on the work of the Independent JPEG Group.

Portions of the LFCRW14N.DLL, LTCMP14.DLL, CDSDK.reg, CDSDK.dll, CDRAPCLS.dll, czs_ui.dll, deimg.dll, deImg010.dll, deImg110.dll, deImg153.dll, deimg301.dll, deimg401.dll, deImg404.dll, deimg602.dll, Deimg603.dll, DeImgd60.dll, pscAdimg.dll, pscCllct.dll, pscCStUI.dll, pscDcd.dll, pscDevUI.dll, pscDvlp.dll, Pscl2STI.dll, pscll.dll, pscParse.dll, pscSetup.dll, psdkdll.dll, psdkReg.dll, psParse.dll. file contain material that is © Canon, Inc. 2002

Portions of the LFFPX7.DLL and LFKODAK.DLL files contain material that is ©Copyright Hewlett Packard, 1996.

Portions of the OCR/ICR/OMR Features and the help file for the OCR/ICR/OMR Features are ©Copyright Scansoft, Inc. 1995-2003. ALL RIGHTS RESERVED

Portions of the Barcode Modules contain material that is ©Copyright Axtel Inc., 1999.

Portions of the LEADTOOLS PDF Plug in and the LEADTOOLS Vector Imaging Pro are ©Copyright 1996, 2000 Artifex Software Inc. All rights reserved.

File filters for decoding MrSID ® and DjVu ® formats are provided under a license from Lizardtech, Inc.

The "FlashPix" format uses Microsoft's OLE structured storage.

Portions of the DICOM help files in Medical Imaging product line are reprinted with permission from the National Electrical Manufacturers Association ©Copyright 1998 by the National Electrical Manufacturers Association. All rights including translation into other languages, reserved under the Universal Copyright Convention, the Berne Convention or the Protection of Literacy and Artistic Works, and the International and Pan American Copyright Conventions.

Portions of LEADTOOLS Data Security Add On contain software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/), including cryptographic software written by Eric Young (eay@cryptsoft.com) and by Tim Hudson (tjh@cryptsoft.com). Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) All rights reserved. Copyright Tim Hudson 1995-1998 (tjh@cryptsoft.com) All rights reserved.

Portions of LEADTOOLS Data Security Add On contain software based on the MD5 Message Digest Algorithm developed by RSA Data Security, Inc.. Copyright (c) 1991-92 RSA Data Security, Inc. All Rights Reserved.

Portions hereof licensed under US patent 5,327,254 and foreign counterparts.

Portions of the LEADTOOLS ICC Profiles material is © Copyright 2004, International Color Consortium.

Trademarks

LEAD® and LEADTOOLS® are registered trademarks of LEAD Technologies, Inc.
Microsoft, Windows, Windows NT, Visual Basic, Visual FoxPro, and Microsoft Access are either trademarks or registered trademarks of the Microsoft Corporation.
OS/2® is a registered trademark of International Business Machines Corporation.

TextBridge®OCR is a registered trademark of Scansoft, Inc.

ISIS® is a registered trademark of Pixel Translations, Inc.

ScanAhead™ is a trademark of Pixel Translations, Inc.

FlashPix™ is a trademark of Eastman Kodak Company.

All other brand or product names used in this online help are trademarks of their respective holders.

Address and Contact Information

LEAD Technologies, Inc.
Suite 400
1201 Greenwood Cliff
Charlotte, NC 28204

(704) 332-5532
FAX: (704) 372-8161
E-mail: support@leadtools.com
Technical support: (704) 372-9681 or support@leadtools.com
Home page: http://www.leadtools.com


Programming with LEADTOOLS DigitalPaint

The following topics provide a systematic approach to understanding how to program with the LEADTOOLS DigitalPaint API.

Unlocking DigitalPaint Features

Initializing and Freeing DigitalPaint Handles

Setting DigitalPaint Properties

Setting General DigitalPaint Information

Painting with DigitalPaint

Setting a DigitalPaint Clipping Region

Processing Windows Messages

Using the Painting Common Dialogs


Unlocking DigitalPaint Features

The LEADTOOLS DigitalPaint Features are included in the LEADTOOLS Digital Paint products. The DigitalPaint features are shipped with the LEADTOOLS products, however they are locked. To use the DigitalPaint functions, L_UnlockSupport must be called with the key found on the Unlock Certificate, included in your product packaging. (

L_UnlockSupport (L_SUPPORT_DIGITALPAINT, TEXT("Unlock Certificate key")) tells the package to unlock support for the DigitalPaint functions and passes the key for verification.


Initializing and Freeing DigitalPaint Handles

The LEADTOOLS Digital Paint products use the PAINTHANDLE structure as a working area for the painting functions. This handle must be initialized, by calling L_PntInit, before calling other DigitalPaint functions. L_PntInit creates a valid paint handle. To determine whether a paint handle is valid, call L_PntIsValid. When the paint handle is no longer needed, it should be freed by calling L_PntFree.

As an example, the user may initialize a paint handle at the beginning of a program, saving the paint handle in a global variable. The paint handle is then available for use with any of the DigitalPaint functions, called within the program. At the end of the program, when the paint handle is no longer needed, the paint handle can be freed by calling L_PntFree. This process prevents the user from repeatedly initializing and freeing a paint handle during a program.

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

pPAINTHANDLE pPaint ;

// initiate the Paint toolkit.
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FALSE ;
}

Initializing the PAINTHANDLE sets all internal states (properties, clipping region, transformations…etc.) 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 == L_PntIsValid ( pPaint ) )
{
L_PntFree ( pPaint ) ;
}

Once L_PntFree has been called, the paint handle is no longer valid. L_PntInit must be called again to initialize the paint handle and make it valid.

Once the paint 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.


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 paint 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.

etc.

Each group of properties has a group-specific structure used for getting or setting the properties. These structures are given below:

PAINTBRUSH

PAINTFILL

PAINTREGION

PAINTSHAPE

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

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

To set the properties for a group, call L_PntSetProperty. This function requires a valid paint handle, 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
L_PntSetProperty ( pPaint, 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_FILL

PAINT_GROUP_REGION

PAINT_GROUP_SHAPE

PAINT_GROUP_TEXT

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

the device context to use for display

an optional handle to a bitmap to use as a painting canvas

an optional restriction palette to limit the paint colors displayed or painted on the canvas

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


Setting General DigitalPaint Information

Several of the DigitalPaint functions provided by LEADTOOLS require additional information, referred to here as DigitalPaint metrics. This information includes:

the Windows device context (DC), such as a screen, used as a display surface.

an optional handle to a bitmap. This bitmap will be used as a painting canvas.

an optional restriction palette to limit the paint colors displayed or painted on the canvas.

These properties can be set using the L_PntSetMetrics function.

Several of the DigitalPaint functions take a DC as an argument, but can actually paint to a DC and/or a bitmap. If the user supplies only a DC through the function arguments, then the toolkit will paint only to that DC. If the user passes NULL for the DC, but has set a bitmap through the L_PntSetMetrics function, the painting function will paint only to the bitmap. If the user sets a bitmap and passes a valid DC to a painting function, the painting function will paint to both the DC and the bitmap. The bitmap can be changed or removed as desired.

The restriction palette controls the colors available to the following groups:

Brush.

Shape.

Fill.

Text.

If a restriction palette is set using this function, then the colors painted to the device context and/or the bitmap are limited to the colors available in the palette. Therefore, if the user tries to paint a color value of RGB(255, 0, 0), which is red, but is using a grayscale restriction palette, the toolkit uses the nearest color to red in the supplied palette. If the color restriction palette is set to NULL, the toolkit will not perform any color restriction.

In addition to the DigitalPaint metrics, other general DigitalPaint information should be set before beginning to paint. This information includes transformation information and device context (DC) boundary information.

The transformation information is used for translating from external coordinates, such as mouse position, to the device context (DC) and/or bitmap coordinates. The current transformation information can be obtained by calling L_PntGetTransformation. To set the transformation information, call L_PntSetTransformation.

The device context boundaries should also be set before painting. They should also be updated any time the client area of the display window is resized. To determine the current device context boundaries, call L_PntGetDCExtents. To set or change the device context boundaries, call L_PntSetDCExtents.

Once the general DigitalPaint information has been set, painting can begin. For more information on painting, refer to Painting with DigitalPaint.


Setting a DigitalPaint Clipping Region

Clipping is used by the toolkit to limit the output to a user-defined region. This can be done using the L_PntSetClipRgn function. To get the last clipping region set, call L_PntGetClipRgn. To offset a clipping region, call L_PntOffsetClipRgn.

L_INT OnPaintShape ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
HRGN hClipRgn ;
RECT rcShapeRect ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/*Set the rectangle coordinates with respect to the DC dimensions*/
SetRect ( &rcShapeRect, 10, 10, 110, 110 ) ;

/*Use the current shape properties to draw an ellipse to DC (hDC) */
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShapeRect ) ;

hClipRgn = CreateRectRgn ( 120, 20, 200, 100 ) ;

/*Set painting clip region */
L_PntSetClipRgn ( pPaint, hClipRgn ) ;

/*Set the rectangle coordinates with respect to the DC dimensions*/
SetRect ( &rcShapeRect, 110, 10, 210, 110 ) ;

/*Use the current shape properties to draw an ellipse to DC (hDC) */
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShapeRect ) ;

/*Delete the clip region */
DeleteObject ( ( HRGN ) hClipRgn ) ;

/*Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


Using the DigitalPaint Common Dialogs

LEADTOOLS DigitalPaint provides a number of functions for displaying dialogs. The DigitalPaint Common Dialogs provide an easier way to enter or change painting settings. The functions for displaying the dialogs are:

L_PntDlgBrush

L_PntDlgFill

L_PntDlgShape

L_PntDlgRegion

L_PntDlgText

The following example shows the use of the DigitalPaint Common Dialog.

// This example will display the brush common dialog

L_TCHAR * g_ppszTouchImage [ ] = { TEXT("Image 0"), TEXT("Image 1"), TEXT("Image 2"), TEXT("Image 3"), TEXT("Image 4") } ;
PAINTDLGBRUSHINFO g_DlgBrushInfo ;

L_VOID BrushDlgTest ( HWND hWnd, L_BOOL fUseDef )
{
if ( fUseDef == TRUE )
{
g_DlgBrushInfo.dwFlags = PAINT_DLG_BRUSH_INITUSEDEFAULT |
PAINT_DLG_BRUSH_SHOWALL ;
}
else
{
g_DlgBrushInfo.nSize = sizeof ( PAINTDLGBRUSHINFO ) ;
g_DlgBrushInfo.dwFlags = PAINT_DLG_BRUSH_SHOWTOUCHCONTENT |
PAINT_DLG_BRUSH_SHOWTOUCHCOLOR |
PAINT_DLG_BRUSH_SHOWTOUCHIMAGE |
PAINT_DLG_BRUSH_SHOWDIAMETER |
PAINT_DLG_BRUSH_SHOWHARDNESS |
PAINT_DLG_BRUSH_SHOWSPACING |
PAINT_DLG_BRUSH_SHOWOPACITY |
PAINT_DLG_BRUSH_SHOWRESET ;
PAINT_DLG_BRUSH_SHOWDEFAULT;

g_DlgBrushInfo.pszTitle = TEXT("Lead Brush Common Dialog ");
g_DlgBrushInfo.nContentsType = PAINT_TOUCH_CONTENTS_COLOR;
g_DlgBrushInfo.crColor = RGB ( 255, 0, 0 ) ;
g_DlgBrushInfo.ppszTouchImage = g_ppszTouchImage ;
g_DlgBrushInfo.uTouchImageCount = 5 ;
g_DlgBrushInfo.nActiveTouchImageItem = 1 ;
g_DlgBrushInfo.crTransparentColor = RGB(0, 0, 0) ;
g_DlgBrushInfo.nDiameter = 15 ;
g_DlgBrushInfo.nHardnessValue = 75 ;
g_DlgBrushInfo.nSpacing = 10 ;
g_DlgBrushInfo.nOpacity = 10 ;
}
L_PntDlgBrush ( hWnd, &g_DlgBrushInfo ) ;
return ;
}

As seen in the example, the dialog gives the programmer the flexibility to show or hide every dialog control. This gives the programmer the freedom to show only the desired features.


Painting with DigitalPaint

LEADTOOLS DigitalPaint provides support for a number of painting abilities. These include:

painting using a paintbrush

painting shapes

painting a region

filling an area with paint

painting text

Several functions are provided for implementing each of these painting abilities. For more information about a specific painting ability, refer to the following:

Painting with a Brush

Painting a Shape

Creating a Region

Filling an Area

Painting Text


Painting with a Brush

LEADTOOLS DigitalPaint provides the following functions for painting with a brush:

L_PntBrushMoveTo

L_PntBrushLineTo

These functions require:

a valid paint handle.

an optional windows device context.

X coordinate of a point.

Y coordinate of a point.

The L_PntBrushMoveTo function paints a single brush touch using the current brush group properties at the required position. The L_PntBrushLineTo function paints a series of brush touches (a brush stroke) from the point set by the L_PntBrushMoveTo function, to the position set by the L_PntBrushLineTo function. If L_PntBrushMoveTo is not called before calling L_PntBrushLineTo, the L_PntBrushLineTo function will use the default (0, 0) as the starting point for the line.

These functions will draw brush touches and strokes based on the current brush properties. To determine the current brush properties, call L_PntGetProperty. To set or change the current brush properties, call L_PntSetProperty. For more information on the brush properties, refer to the PAINTBRUSH structure.

Before painting a brush touch or a brush stroke, set the DigitalPaint metrics using the L_PntSetMetrics function.

Any transformation information should be set, using the L_PntSetTransformation function before calling any brush or other painting function. To get the current transformation information, call L_PntGetTransformation.

The following example sets the brush properties, moves the paintbrush to a certain point and then paints a brush stroke. It assumes the paint handle has been initialized and the window handle is valid:

HDC hDC;
PAINTBRUSH brush;

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/* Set the required paintbrush properties */
brush.nSize = sizeof ( PAINTBRUSH ) ;
brush.dwMask = PBF_DIAMETER |
PBF_TOUCH |
PBF_SPACING ;
brush.nDiameter = 20 ;
brush.Touch.crColor = RGB ( 255, 0, 0 ) ;
brush.nSpacing = 25 ;

/* Set the new paintbruch properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_BRUSH, &brush ) ;

/* Use the current paintbruch properties to draw a paintbrush stroke to DC (hDC) */
L_PntBrushMoveTo ( pPaint, hDC, 10, 10 ) ;
L_PntBrushLineTo ( pPaint, hDC, 100, 100 ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;


Painting a Shape

LEADTOOLS DigitalPaint provides the following functions for painting a shape:

L_PntDrawShapeLine

L_PntDrawShapeRectangle

L_PntDrawShapeRoundRect

L_PntDrawShapeEllipse

L_PntDrawShapePolygon

L_PntDrawShapePolyBezier

These functions require:

a valid paint handle.

an optional windows device context.

the coordinates used to paint the shape.

These functions will draw shapes based on the current shape properties. To determine the current shape properties, call L_PntGetProperty. To set or change the current shape properties, call L_PntSetProperty. For more information on the shape properties, refer to the PAINTSHAPE structure.

Before painting a shape, set the DigitalPaint metrics using the L_PntSetMetrics function.

Any transformation information should be set, using the L_PntSetTransformation function before calling any shape or other painting function. To get the current transformation information, call L_PntGetTransformation.

The following example sets the shape properties, sets the DigitalPaint metrics and paints a line. It assumes the paint handle has been initialized and the bitmap handle is valid:

PAINTSHAPE shape;

/* Set the required shape properties */
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERWIDTH |
PSF_BORDERSTYLE |
PSF_BORDERCOLOR |
PSF_BORDERENDCAP ;
shape.nBorderWidth = 10 ;
shape.nBorderStyle = PAINT_SHAPE_BORDER_STYLE_DASHDOT ;
shape.crBorderColor = RGB ( 255, 0, 0 ) ;
shape.nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_ROUND ;

/* Set the new shape properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/*Select the bitmap into the paint handle*/
L_PntSetMetrics ( pPaint, NULL, &hLeadBitmap, NULL ) ;

/* Use the current shape properties to draw a line to the currently selected bitmap*/
L_PntDrawShapeLine ( pPaint, hDC, 10, 10, 200, 200 ) ;


Creating a Region

LEADTOOLS DigitalPaint provides the following functions for creating a region:

L_PntRegionRect

L_PntRegionRoundRect

L_PntRegionEllipse

L_PntRegionPolygon

L_PntRegionSurface

L_PntRegionBorder

L_PntRegionColor

These functions require:

a valid paint handle.

an optional windows device context.

the necessary data used to control the region creation.

a pointer to a region handle to be updated with the resulting region.

These functions will create regions based on the current region properties. To determine the current region properties, call L_PntGetProperty. To set or change the current region properties, call L_PntSetProperty. For more information on the region properties, refer to the PAINTREGION structure.

The resulting region can be scaled or translated with the L_PntRegionScale or L_PntRegionTranslate functions.

Before creating a region, set the DigitalPaint metrics using the L_PntSetMetrics function.

The following example creates a rectangular region using the current region properties and the current transformations. It assumes the paint handle has been initialized and the window handle is valid:

/* Get the device context */
hDC = GetDC ( hWnd ) ;

/* Set the coordinates with respect to the DC dimensions*/
SetRect ( &rcRegion, 10, 10, 100, 100 ) ;

/* Use the current region properties and the current painting
transformations to create a rectangular region */
L_PntRegionRect ( pPaint, hDC, &rcRegion, &hRgn ) ;


Filling an Area

LEADTOOLS DigitalPaint provides the following functions for filling an area:

L_PntFillSurface

L_PntFillBorder

L_PntFillColorReplace

These functions require:

a valid paint handle.

an optional windows device context.

the necessary information used to control the filling action.

These functions will fill areas based on the current fill properties. To determine the current fill properties, call L_PntGetProperty. To set or change the current fill properties, call L_PntSetProperty. For more information on the fill properties, refer to the PAINTFILL structure.

The filling functions use different methods to fill an area. The L_PntFillSurface function fills an area, starting at a specified point and continuing in all directions, that contains a specified color, falling within some tolerance range. The upper and lower tolerances are set in the PAINTFILL structure. The L_PntFillBorder function fills an area, starting at a specified point and continuing in all directions, until it finds a specified color, falling within some tolerance range. The L_PntFillColorReplace will replace every pixel using the current fill properties.

Any transformation information should be set, using the L_PntSetTransformation function before calling any fill or other painting function. To get the current transformation information, call L_PntGetTransformation.

For selecting a color from a specific point, call L_PntPickColor.

The following example sets the device context boundaries, sets the fill properties, sets the DigitalPaint metrics properties and then performs a color replacement. It assumes the paint handle has been initialized, and the window handle and lead bitmap handle are valid:

HDC hDC ;
PAINTFILL fill ;
RECT rcDCExtents ;

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/* Get the destination DC dimensions */
GetClientRect ( hWnd, &rcDCExtents ) ;

/* Set the toolkit user DC extents */
L_PntSetDCExtents ( pPaint, &rcDCExtents ) ;

/* Set the required fill properties */
fill.nSize = sizeof ( PAINTFILL ) ;
fill.dwMask = PFF_STYLE ;
fill.nStyle = PAINT_FILL_STYLE_GRADIENT ;

/* Set the new fill properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_FILL, &fill ) ;

/*Select the bitmap into the paint handle*/
L_PntSetMetrics ( pPaint, NULL, &hLeadBitmap, NULL ) ;

/* Fill the target area in the DC (hDC) and the currently selected bitmap*/
L_PntFillColorReplace ( pPaint, hDC, RGB ( 255, 0, 0 ) ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

This example uses the function L_PntSetDCExtents. This function is essential in filling the desired area. The user should define the boundaries of the DC supplied to the fill function. The supplied dimensions will be in pixels. To get the DC boundaries previously set, call the L_PntGetDCExtents function.


Drawing Text

Painting Text

LEADTOOLS DigitalPaint provides the following function for painting text:

L_PntApplyText

This function requires:

a valid paint handle.

an optional windows device context.

the bounding rectangle in which to paint the text.

This function will paint text based on the current text properties. To determine the current text properties, call L_PntGetProperty. To set or change the current text properties, call L_PntSetProperty. For more information on the text properties, refer to the PAINTTEXT structure.

Any transformation information should be set, using the L_PntSetTransformation function before calling any text or other painting function. To get the current transformation information, call L_PntGetTransformation.

The following example sets the text properties and paints some text. It assumes the paint handle has been initialized and the window handle is valid:

HDC hDC ;
PAINTTEXT text ;
RECT rcText ;
LOGFONT lf ;
HFONT hFont ;

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/* Set the required text font properties */
lf.lfHeight = 48 ;
lf.lfWidth = 0 ;
lf.lfEscapement = 0 ;
lf.lfOrientation = 0 ;
lf.lfWeight = FW_NORMAL ;
lf.lfItalic = FALSE ;
lf.lfUnderline = FALSE ;
lf.lfStrikeOut = FALSE ;
lf.lfCharSet = ANSI_CHARSET ;
lf.lfOutPrecision = OUT_DEFAULT_PRECIS ;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS ;
lf.lfQuality = DEFAULT_QUALITY ;
lf.lfPitchAndFamily = FF_DONTCARE ;
lstrcpy(lf.lfFaceName, TEXT("Times New Roman"));

/* Create the desired text font */
hFont = CreateFontIndirect ( &lf ) ;

/* Set the desired text properties */
text.nSize = sizeof ( PAINTTEXT ) ;
text.dwMask = PTF_TEXT | PTF_FONT | PTF_TRANSFORMINFO ;
text.pszText = TEXT("LEAD") ;
text.hFont = hFont ;
text.TransformInfo.nRotate = 45 ;

/* Set the new text properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_TEXT, &text ) ;

/* Set the target text drawing box coordinates with respect to the DC dimensions */
SetRect ( &rcText, 10, 10, 200, 200 ) ;

/*Use the current text properties and the current transformations properties to draw the text to the DC */
L_PntApplyText ( pPaint, hDC, &rcText ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;


Processing Windows Messages

Many external events such as resizing a window or scrolling a window can affect paint output. This may require changing the transformation information, setting a clipping region or changing the device context boundaries.

When a painting canvas (bitmap) is scrolled or zoomed, the input coordinates and painting output must be transformed. The L_PntSetTransformation function sets the necessary information. This function uses a PAINTXFORM structure to set the transformation information.

The following provide examples for handling certain Windows messages that can affect paint output:

Processing the WM_PAINT Message

Processing the WM_SIZE Message

Processing the Window Activation Messages

Processing Window Scrolling Messages


Processing the WM_PAINT Message

The following example demonstrates one way of processing the WM_PAINT message to paint the LEAD bitmap handle.

// This is example assumes, that we have
// a valid LEAD bitmap handle, and the user has
// initialized the necessary paint palette and the
// required bitmap view rectangle to be painted

L_VOID OnPaint ( HWND hWnd )
{
PAINTSTRUCT ps ;
HPALETTE hOldPalette = NULL ;

BeginPaint ( hWnd, &ps ) ;

if ( ( g_PaintBitmap.Flags.Allocated ) )
{
if ( g_PainthPalette != NULL )
{
hOldPalette = SelectPalette ( ps.hdc, g_PainthPalette, TRUE ) ;
RealizePalette ( ps.hdc ) ;
}

L_PaintDC ( ps.hdc, &g_PaintBitmap, NULL, NULL, &g_rcBitmapView, &ps.rcPaint, SRCCOPY ) ;
if ( g_PainthPalette != NULL )
{
SelectPalette ( ps.hdc, hOldPalette, TRUE ) ;
}
}

EndPaint ( hWnd, &ps ) ;
}


Processing the WM_SIZE Message

Whenever an external event that will affect the painting output occurs, the user must adjust the affected controlling factors. The following example demonstrates changes made while processing the WM_SIZE message.

// This is example assumes, that we have a valid LEAD paint handle and a valid
// LEAD bitmap handle, and the user has set the bitmap handle in the paint handle
// ( through the L_PntSetMetrics function ). And also assumes that user has initialized the
// current horizontal and vertical scrolling position variables

BITMAPHANDLE g_PaintBitmap ;
RECT g_rcBitmapView ;
int g_nHScrollPos ;
int g_nVScrollPos ;

L_VOID OnSize ( HWND hWnd, L_UINT nState, L_INT nCx, L_INT nCy )
{
SCROLLINFO si ;

UNREFERENCED_PARAMETER ( nState ) ;

if ( g_PaintBitmap.Flags.Allocated )
{
si.cbSize = sizeof ( SCROLLINFO ) ;
si.fMask = SIF_ALL ;

// vertical scroll.
GetScrollInfo ( hWnd, SB_VERT, &si ) ;

si.nMin = 0 ;
si.nMax = BITMAPHEIGHT ( &g_PaintBitmap ) ;
si.nPage = nCy ;

SetScrollInfo ( hWnd, SB_VERT, &si, TRUE ) ;

GetScrollInfo ( hWnd, SB_VERT, &si ) ;

g_nVScrollPos = si.nPos ;

// horizontal scroll
GetScrollInfo ( hWnd, SB_HORZ, &si ) ;

si.nMin = 0 ;
si.nMax = BITMAPWIDTH ( &g_PaintBitmap ) ;
si.nPage = nCx ;

SetScrollInfo ( hWnd, SB_HORZ, &si, TRUE ) ;

GetScrollInfo ( hWnd, SB_HORZ, &si ) ;

g_nHScrollPos = si.nPos ;

// set the painting rectangel.
SetRect ( &g_rcBitmapView, 0, 0, BITMAPWIDTH ( &g_PaintBitmap ), BITMAPHEIGHT ( &g_PaintBitmap ) ) ;

OffsetRect ( &g_rcBitmapView, - g_nHScrollPos, - g_nVScrollPos ) ;
}
else
{
si.cbSize = sizeof ( SCROLLINFO ) ;
si.fMask = SIF_RANGE ;
si.nMin = 0 ;
si.nMax = 0 ;

SetScrollInfo ( hWnd, SB_VERT, &si, TRUE ) ;
SetScrollInfo ( hWnd, SB_HORZ, &si, TRUE ) ;

SetRectEmpty ( &g_rcBitmapView ) ;
}

if ( GetFocus ( ) == hWnd )
{
PAINTXFORM PntXForm ;
RECT rcDCRect ;

// set the paint tools DC extents.
SetRect ( &rcDCRect, 0, 0, nCx, nCy ) ;

L_PntSetDCExtents ( pPaint, &rcDCRect ) ;

// set Painting Transformation.
PntXForm.nZoom = 100 ;
PntXForm.nXOffset = - g_rcBitmapView.left ;
PntXForm.nYOffset = - g_rcBitmapView.top ;

L_PntSetTransformation ( g_pPaintHandle, &PntXForm ) ;
}

}

This example uses the following functions:

L_PntSetDCExtents

L_PntSetTransformation .

The WM_SIZE message indicates that the dimensions of the DC (the window's client area DC) have changed. This DC will be used for future painting. The new dimensions of the DC should be set by calling L_PntSetDCExtents.

The L_PntSetTransformation function is called here to set the toolkit transformation values properly.


Processing the Window Activation Messages

When working in an MDI environment, each window may have its own bitmap data or transformations. Therefore, the toolkit data should be set to reflect the changes.

L_VOID OnMDIActivate ( HWND hWnd, L_BOOL active, HWND hActivate, HWND hDeactivate )
{
PAINTXFORM XForm ;
HDC hdcCompatibility ;
RECT rcDCRect ;

.
.
.

/*set the painting toolkit data*/
hdcCompatibility = GetDC ( hMDIChildWnd ) ;

L_PntSetMetrics ( pPaint, hdcCompatibility, MDIChildData.pBitmap, MDIChildData.hPalette ) ;

ReleaseDC ( hWnd, hdcCompatibility ) ;

XForm.nZoom = MDIChildData.nZoomFactor ;
XForm.nXOffset = MDIChildData.nHscroll ;
XForm.nYOffset = MDIChildData.nVscroll ;

L_PntSetTransformation ( pPaint, &XForm ) ;

GetClientRect ( hMDIChildWnd, &rcDCRect ) ;

L_PntSetDCExtents ( pPaint, &rcDCRect ) ;

L_PntSetClipRgn (pPaint, MDIChildData.hClipRng ) ;

.
.
.
}


Processing Window Scrolling Messages

When processing the scrolling message, the user should set the painting offsets to reflect the new coordinate translations.

The following example shows how to handle the horizontal scrolling message:

// This is example asumes, that we have a valid LEAD paint handle and a valid
// LEAD bitmap handle, and the user has initialzied the current horizontal
// and vertical scrolling position variables

BITMAPHANDLE g_PaintBitmap ;
RECT g_rcBitmapView ;
int g_nHScrollPos ;
int g_nVScrollPos ;

L_VOID OnHScroll ( HWND hWnd, HWND hWndCtl, L_UINT nCode, L_INT nPos )
{
SCROLLINFO si ;
PAINTXFORM PntXForm ;

UNREFERENCED_PARAMETER ( nPos ) ;
UNREFERENCED_PARAMETER ( hWndCtl ) ;

si.cbSize = sizeof ( SCROLLINFO ) ;
si.fMask = SIF_ALL ;
GetScrollInfo ( hWnd, SB_HORZ, &si ) ;

g_nHScrollPos = si.nPos ;

switch ( nCode )
{
case SB_LINELEFT:
si.nPos -= 1 ;
break ;

case SB_LINERIGHT:
si.nPos += 1 ;
break ;

case SB_PAGELEFT:
si.nPos -= si.nPage ;
break ;

case SB_PAGERIGHT:
si.nPos += si.nPage ;
break ;

case SB_THUMBTRACK:
si.nPos = si.nTrackPos ;
break ;

default:
break ;
}

si.fMask = SIF_POS ;
SetScrollInfo ( hWnd, SB_HORZ, &si, TRUE ) ;
GetScrollInfo ( hWnd, SB_HORZ, &si ) ;

if ( si.nPos != g_nHScrollPos )
{
// update screen.
OffsetRect ( &g_rcBitmapView, ( g_nHScrollPos - si.nPos ), 0 ) ;

ScrollWindow ( hWnd, ( g_nHScrollPos - si.nPos ), 0, NULL, NULL ) ;

g_nHScrollPos = si.nPos ;

UpdateWindow ( hWnd ) ;

// set Painting Transformation.
PntXForm.nZoom = 100 ;
PntXForm.nXOffset = - g_rcBitmapView.left ;
PntXForm.nYOffset = - g_rcBitmapView.top ;

L_PntSetTransformation ( g_pPaintHandle, &PntXForm ) ;
}
}


Files To Be Included With Your Application

The installation procedure creates a directory tree for the LEADTOOLS files, and adds the demonstration programs and online help to your desktop. You specify the root directory during installation. The following subdirectory is created:

REDIST\

Redistributable DigitalPaint files.

Note: | You may not copy or redistribute any of the following files without obtaining the proper license. In some cases, the license is included with your initial purchase of LEADTOOLS. In other cases, you must obtain a license from a third party or enter into a royalty agreement with LEAD to obtain the proper license. For these special licensing situations, see the notes below accompanying the specific file.
Note: | You may not distribute the header files with your application, and you may not provide software development capabilities in your application.

The following table summarizes the files you must include on your distribution diskettes to support the LEADTOOLS functions. Most files in the table are optional. 32-bit DLLs are listed. These files are referred to as "Redistributables" in the License Agreement.

Please note that LTKRN is required for ALL API applications. For more information on LTKRN and other files for the Main API, refer to Files To Be Included With Your Application.

Redistributables: | Explanation: | If you are using a standard release without Unicode, the files to use are: | If you are using a standard release with Unicode, the files to use are: | If you are using an evaluation release without Unicode, the files to use are: | If you are using an evaluation release with Unicode, the files to use are:
LTPNT | LEADTOOLS DigitalPaint. The header file is LTPNT.H. Also requires LTKRN, LTIMG, LTDIS and LTEFX. For Automated DigitalPaint, LTCON, LTAUT and LTTLB are also required. For information on LTIMG, LTDIS and LTEFX, refer to Files To Be Included With Your Application, in the Main API help file. For information on LTAUT and LTCON, refer to Files To Be Included With Your Application , in the Automation API help file. For information on LTTLB, refer to Files To Be Included With Your Application , in the Toolbar API help file. | DLL: LTPNT14N.DLL Library: LTPNT_N.LIB. | DLL: LTPNT14NU.DLL Library: LTPNT_NU.LIB. | DLL: LTPNT14E.DLL Library: LTPNT_E.LIB. | DLL: LTPNT14EU.DLL Library: LTPNT_EU.LIB.
LTPDG | LEADTOOLS DigitalPaint Common Dialogs. The header file is LTPDG.H. | DLL: LTPDG14N.DLL Library: LTPDG_N.LIB. | DLL: LTPDG14E.DLL Library: LTPDG_E.LIB. | DLL: LTPDG14NU.DLL Library: LTPDG_NU.LIB. | DLL: LTPDG14EU.DLL Library: LTPDG_EU.LIB.


Installation Directory

The installation procedure creates a directory tree for the LEADTOOLS files, and adds the demonstration programs and online help to your desktop. You specify the root directory during installation.

Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

The following is a list of the subdirectories in the root directory:

ACROBAT | LEADTOOLS manuals in the PDF format, which you can view and print using Adobe Acrobat. These files are optional and are available when installing from the CD-ROM.
BIN | Executable files for the demonstration programs.
HELP | Online help files.
IMAGES | Sample images and databases containing images.
EXAMPLES\DLL | One subdirectory for each example API program.
EXAMPLES\OCX | One subdirectory for each example ActiveX program.
EXAMPLES\COM | One subdirectory for each example COM program.
EXAMPLES\CLASSLIB | One subdirectory for each example Class Library program.
EXAMPLES\RES | Resource files for the example programs.
INCLUDE | Header files, BAS files, and the ActiveX's MFC interface files for versions of Visual C++ earlier than 4.0.
INCLUDE\CLASSLIB | Header files for the Class Library
LIB | Library files.
REDIST | Redistributable files. These are copies of the LEADTOOLS files and other files that you may need to distribute with your application. For exact information about required files, refer to Files To Be Included With Your Application.


Technical Support

As a registered user, free technical support is available. You must register your software to receive any technical support. Technical support is available 9 a.m. through 6 p.m. Eastern Standard Time. If you are calling by phone, please be at your computer. You can also contact us through the following methods:

Phone: | (704) 372-9681
E-mail: | support@leadtools.com
FAX: | (704) 372-8161
Home page: | http://www.leadtools.com
FTP: | ftp.leadtools.com

You can also contact LEAD by mail at:

LEAD Technologies, Inc.
Attn: Technical Support
Suite 400
1201 Greenwood Cliff
Charlotte, NC 28204

Before calling technical support, please look in the online documentation and the example programs for an answer to your question.


DigitalPaint Function Groups

DigitalPaint Functions

Painting Shapes and Text

Filling an Area

Initializing and Freeing the Paint Handle

Getting and Setting the DC Boundaries

Paint Properties

Region Processing

Transforming External Coordinates

DigitalPaint Common Dialogs

Miscellaneous


DigitalPaint Functions: Initializing and Freeing the Paint Handle

L_PntInit

L_PntFree


DigitalPaint Functions: Paint Properties

L_PntGetProperty

L_PntSetProperty


DigitalPaint Functions: Painting Shapes and Text

L_PntApplyText

L_PntBrushLineTo

L_PntBrushMoveTo

L_PntDrawShapeEllipse

L_PntDrawShapeLine

L_PntDrawShapePolyBezier

L_PntDrawShapePolygon

L_PntDrawShapeRectangle

L_PntDrawShapeRoundRect


DigitalPaint Functions: Filling an Area

L_PntFillBorder

L_PntFillColorReplace

L_PntFillSurface


DigitalPaint Functions: Getting and Setting the DC Boundaries

L_PntSetDCExtents

L_PntGetDCExtents


DigitalPaint Functions: Region Processing

L_PntGetClipRgn

L_PntOffsetClipRgn

L_PntRegionBorder

L_PntRegionColor

L_PntRegionEllipse

L_PntRegionPolygon

L_PntRegionRect

L_PntRegionRoundRect

L_PntRegionScale

L_PntRegionSurface

L_PntRegionTranslate

L_PntSetClipRgn


DigitalPaint Functions: DigitalPaint Common Dialogs

L_PntDlgBrush

L_PntDlgFill

L_PntDlgRegion

L_PntDlgShape

L_PntDlgText


DigitalPaint Functions: Transforming External Coordinates

L_PntSetTransformation

L_PntGetTransformation


DigitalPaint Functions: Miscellaneous

L_PntPickColor

L_PntSetMetrics

L_PntIsValid


Data Types

Basic Data Types and Keywords

LEADTOOLS Basic Data Types

Keywords Used in Declarations

Paint Data Types

PAINTALIGNMENT

PAINTBRUSH

PAINTFILL

PAINTFILLGRADIENTSTYLE

PAINTFILLSTYLE

PAINTGROUP

PAINTHANDLE

PAINTHARDNESS

PAINTHARDNESSDISTRBTYPE

PAINTREGION

PAINTSHAPE

PAINTSHAPEBACKSTYLE

PAINTSHAPEBORDERBRUSHSTYLE

PAINTSHAPEBORDERENDCAP

PAINTSHAPEBORDERSTYLE

PAINTSHAPEGRADIENTSTYLE

PAINTTEXT

PAINTTEXTBACKSTYLE

PAINTTEXTBORDERBRUSHSTYLE

PAINTTOUCH

PAINTTOUCHCONTENTS

PAINTTOUCHSHAPE

PAINTTRANSFORM

PAINTXFORM

Common Dialog Data Types

PAINTDLGBRUSHINFO

PAINTDLGFILLINFO

PAINTDLGREGIONINFO

PAINTDLGSHAPEINFO

PAINTDLGTEXTINFO

Structures Used with Input and Output Functions

WINDOWS Structures


LEADTOOLS Basic Data Types

LEADTOOLS has defined the following basic data types for portability:

Data Type | Definition and Usage
L_BITFIELD | Defined as L_UINT; used as a bit field.
L_BOOL | Defined as L_UINT; used as a boolean value.
L_CHAR | Defined as char; used as a signed 8-bit integer.
L_DOUBLE | Defined as double; used as a double precision floating point number.
L_FLOAT | Defined as float; used as a floating point number.
L_INT | Defined as int; used as a signed integer, 16-bits or larger.
L_INT16 | Defined as short; used as a signed 16-bit integer.
L_INT32 | Defined as long; used as a signed 32-bit integer.
L_UCHAR | Defined as unsigned char; used as an unsigned 8-bit integer.
L_UINT | Defined as unsigned; used as an unsigned integer, 16-bits or larger.
L_UINT16 | Defined as unsigned short; used as an unsigned 16-bit integer.
L_UINT32 | Defined as unsigned long; used as an unsigned 32-bit integer.
L_VOID | Defined as void; used as a void.
L_COMP | Defined as L_UINT; used as a handle to a computer
L_MEDIA | Defined as L_VOID L_FAR *; used as a void pointer
L_TCHAR | Defined as either char or TCHAR. If FOR_UNICODE is defined, then L_TCHAR will be defined as TCHAR.


Keywords Used in Declarations

LEADTOOLS uses the following keywords in declarations of functions, structures, and datatypes:

Keyword | Definition and Usage
L_FAR | Defined as nothing; used as a placeholder.
L_HUGE | Defined as nothing; used as a placeholder.
L_EXPORT | Defined as nothing; used as a placeholder.
L_PASCAL | Defined as nothing; used as a placeholder.
EXT_FUNCTION | Defined as WINAPI; used as an attribute for all toolkit functions.
pEXT_FUNCTION | Defined as EXT_FUNCTION L_FAR *; used as an attribute when defining pointers to toolkit functions.
EXT_CALLBACK | Defined as _cdecl L_FAR; used as an attribute for all toolkit callback functions.
pEXT_CALLBACK | Defined as EXT_CALLBACK L_FAR *; used as an attribute when defining pointers to toolkit callback functions.


WINDOWS Structures

BITMAPINFO

This is a Microsoft Windows structure as documented in the Microsoft SDK documentation. For complete documentation on this structure, please refer to the Microsoft SDK documentation for BITMAPINFO.

COLORREF

COLORREF is a Windows data type. For further information concerning COLORREF, please refer to the Microsoft SDK documentation.

DWORD

DWORD is a Windows data type, 32 bit unsigned int. For further information concerning DWORD, please refer to the Microsoft SDK documentation.

HANDLE

HANDLE is a standard Windows structure. For further information concerning HANDLE, please refer to the Microsoft SDK documentation or your compiler's documentation.

HDC

HDC is a standard Windows structure. For further information concerning HDC, please refer to the Microsoft SDK documentation or your compiler's documentation.

HGLOBAL

HGLOBAL is a standard Windows data type. For further information concerning HGLOBAL, please refer to the Microsoft SDK documentation or your compiler's documentation.

HPALETTE

HPALETTE is a standard Windows data type. For further information concerning HPALETTE, please refer to the Microsoft SDK documentation or your compiler's documentation.

HRGN

HRGN is a standard Windows data type. For further information concerning HRGN, please refer to the Microsoft SDK documentation or your compiler's documentation.

HWND

HWND is a standard Windows data type. For further information concerning HWND, please refer to the Microsoft SDK documentation or your compiler's documentation.

LPBYTE

LPBYTE is a standard Windows data type. For further information concerning LPBYTE, please refer to the Microsoft SDK documentation or your compiler's documentation.

LPPOINT

LPPOINT is a standard Windows structure. For further information concerning LPPOINT, please refer to the Microsoft SDK documentation or your compiler's documentation.

LPRECT

LPRECT is a standard Windows structure. For further information concerning LPRECT, please refer to the Microsoft SDK documentation or your compiler's documentation.

LPSTR

LPSTR is a standard Windows data type. For further information concerning LPSTR, please refer to the Microsoft SDK documentation or your compiler's documentation.

OPENFILENAME

This is a Microsoft Windows structure as documented in the Microsoft SDK documentation. For complete documentation on this structure please refer to the Microsoft SDK documentation for OPENFILENAME.


PAINTALIGNMENT

typedef enum
{
//Valid values for horizontal alignment are:
PAINT_ALIGNMENT_LEFT = 0X01,
PAINT_ALIGNMENT_HCENTER = 0X02,
PAINT_ALIGNMENT_RIGHT = 0X04,

//Valid values for vertical alignment are:
PAINT_ALIGNMENT_TOP = 0X08,
PAINT_ALIGNMENT_VCENTER = 0X10,
PAINT_ALIGNMENT_BOTTOM = 0X20

} PAINTALIGNMENT ;

The PAINTALIGNMENT enumeration type contains options for aligning painted text.

Comments

A value from each category (horizontal and vertical) may be combined using the bitwise OR operator (|).


PAINTBRUSH

typedef struct _PAINTBRUSH
{
L_INT nSize;
L_UINT32 dwMask;
PAINTTOUCH Touch;
L_INT nDiameter;
PAINTHARDNESS Hardness;
L_INT nSpacing;
L_INT nDensity;
L_INT nOpacity;
L_INT nFadeOutRate;
pBITMAPHANDLE pTexture;
} PAINTBRUSH, L_FAR *pPAINTBRUSH;

The PAINTBRUSH structure holds information about the paintbrush.

Member | Description
nSize | Size of this structure.
dwMask | Flags that indicate which structure members contain valid information. Possible values are:
 | Value | Meaning
 | PBF_ALL | All fields contain valid data.
 | PBF_TOUCH | The Touch field contains valid data.
 | PBF_DIAMETER | The nDiameter field contains valid data.
 | PBF_HARDNESS | The Hardness field contains valid data.
 | PBF_SPACING | The nSpacing field contains valid data.
 | PBF_DENSITY | The nDensity field contains valid data.
 | PBF_OPACITY | The nOpacity field contains valid data.
 | PBF_FADEOUTRATE | The nFadeOutRate field contains valid data.
 | PBF_TEXTURE | The pTexture field contains valid data.
 | These values can be combined using the bit-wise OR operator (|).
Touch | Structure that contains information about the touch properties. For more information on these properties, refer to PAINTTOUCH.
nDiameter | Value indicating the diameter of the brush, in pixels. Valid values are between 1 and 200.
Hardness | Structure that contains information about the hardness of the brush. For more information, refer to PAINTHARDNESS.
nSpacing | Value indicating the spacing of the discrete drops of the paintbrush, or how frequently the brush tip touches the painting surface during a stroke. When the spacing is 30, this means that the brush tip will touch the painting surface once every 30 pixels. Valid values are between (1-1000).
nDensity | Value indicating the amount of paint the brush applies with each stroke. Increasing the density of the brush is comparable to increasing the number of bristles in the brush. With more bristles, more paint is applied in a stroke. Similarly, decreasing the density decreases the number of bristles in the brush. With fewer bristles, less paint is applied in a stroke. Valid values are 1 to 100 and represent a percentage. A value of 100% results in the surface being completely covered with paint. A value of 1% results in very little paint being applied to the surface.
nOpacity | Value indicating the transparency of the brush touch when combined with the painting canvas. Valid values are between (0-255). A color or an image with an opacity of 255 is transparent. A color or an image with an opacity of 0 is completely opaque (solid).
nFadeOutRate | Value indicating the rate at which the brush contents will fade (become more transparent). Valid values are between (0-10000). 0 means no fade-out will occur. Other values (1-10000) will increase the transparency of the brush contents every nSpacing pixels, until total fade-out is reached.
pTexture | Pointer to the bitmap handle that references the bitmap used to simulate paper texture. This makes it appear as if the painting is done on paper having that texture. The BITMAPHANDLE pointer should still be valid after setting this field.

Comments

The default values for this structure are:

nSize = sizeof (PAINTBRUSH)
Touch.nContentsType = PAINT_TOUCH_CONTENTS_COLOR
Touch.crColor = RGB(0, 0, 0)
Touch.nShape = PAINT_TOUCH_SHAPE_CIRCLE
Touch.pBitmap = NULL
Touch.crTransparentColor = RGB(0, 0, 0)
nDiameter = 1
Hardness.nDistributionType = PAINT_HARDNESS_DISTRB_TYPE_0
Hardness.nValue = 1
nSpacing = 1
nDensity = 100
nOpacity = 0
nFadeOutRate = 0
pTexture = NULL

pPAINTBRUSH is a pointer to a PAINTBRUSH structure.


PAINTFILL

typedef struct _PAINTFILL
{
L_INT nSize;
L_UINT32 dwMask;
PAINTFILLSTYLE nStyle;
COLORREF crSolidFillColor;
pBITMAPHANDLE pBackgroundTileBitmap;
PAINTFILLGRADIENTSTYLE nGradientStyle;
COLORREF crGradientStartColor;
COLORREF crGradientEndColor;
L_UINT uGradientSteps;
COLORREF crUpperTolerance;
COLORREF crLowerTolerance;
L_INT nOpacity;
pBITMAPHANDLE pTexture;
} PAINTFILL, L_FAR *pPAINTFILL;

The PAINTFILL structure holds information used to fill an area.

Member | Description
nSize | Size of this structure.
dwMask | Flags that indicate which structure members contain valid information. Possible values are:
 | Value | Meaning
 | PFF_ALL | All the fields contain valid data.
 | PFF_STYLE | The nStyle field contains valid data.
 | PFF_SOLIDFILLCOLOR | The crSolidFillColor field contains valid data.
 | PFF_BACKGROUNDTILEBITMAP | The pBackgroundTileBitmap field contains valid data.
 | PFF_GRADIENTSTYLE | The nGradientStyle field contains valid data.
 | PFF_GRADIENTSTARTCOLOR | The crGradientStartColor field contains valid data.
 | PFF_GRADIENTENDCOLOR | The crGradientEndColor field contains valid data.
 | PFF_GRADIENTSTEPS | The uGradientSteps field contains valid data.
 | PFF_UPPERTOLERANCE | The crUpperTolerance field contains valid data.
 | PFF_LOWERTOLERANCE | The crLowerTolerance field contains valid data.
 | PFF_OPACITY | The nOpacity field contains valid data.
 | PFF_TEXTURE | The pTexture field contains valid data.
 | The values can be combined using the bit-wise OR operator ( | )
nStyle | An enumerated type that indicates the fill style. For a list of possible values, refer to PAINTFILLSTYLE.
crSolidFillColor | COLORREF value that specifies the color to use when nStyle is PAINT_FILL_STYLE_SOLID.
pBackgroundTileBitmap | Pointer to the bitmap handle referencing the bitmap to be used for filling, when nStyle is PAINT_FILL_STYLE_TILEDIMAGE. The BITMAPHANDLE pointer, should still be valid after setting this field.
nGradientStyle | An enumerated type that indicates the background gradient fill style. For a list of possible values, refer to PAINTFILLGRADIENTSTYLE.
crGradientStartColor | The COLORREF value that specifies the color to use as the starting color for the gradient fill.
crGradientEndColor | The COLORREF value that specifies the color to use as the ending color for the gradient fill.
uGradientSteps | Number of gradient fill steps. Valid values are 2 to 255.
crUpperTolerance | COLORREF value that contains the amount of upper variance allowed from the selected color. Valid values are between 0 and 255.
crLowerTolerance | COLORREF value that contains the amount of lower variance allowed from the selected color. Valid values are between 0 and 255.
nOpacity | Value indicating the transparency of the fill when combined with the painting canvas. Valid values are 0 to 255. A color or an image with an opacity of 255 is transparent. A color or an image with an opacity of 0 is completely opaque (solid).
pTexture | Pointer to the bitmap handle referencing the bitmap that will simulate paper texture. This gives the appearance of painting on paper having that texture. The BITMAPHANDLE pointer, should still be valid after setting this field.

Comments

The default values for this structure are:

nSize = sizeof (PAINTFILL)
nStyle = PAINT_FILL_STYLE_SOLID
crSolidFillColor = RGB (255, 255, 255)
pBackgroundTileBitmap = NULL
nGradientStyle = PAINT_FILL_GRADIENT_STYLE_RECTANGLE_TO_C
nGradientStartColor = RGB (0, 0, 0)
nGradientEndColor = RGB (255, 255, 255)
uGradientSteps = 255
crUpperTolerance = RGB (0, 0, 0)
crLowerTolerance = RGB (0, 0, 0)
nOpacity = 0
pTexture = NULL

pPAINTFILL is a pointer to a PAINTFILL structure.


PAINTFILLGRADIENTSTYLE

typedef enum
{
PAINT_FILL_GRADIENT_STYLE_NONE,
PAINT_FILL_GRADIENT_STYLE_LINE_L_TO_R = 1000,
PAINT_FILL_GRADIENT_STYLE_LINE_R_TO_L = 1001,
PAINT_FILL_GRADIENT_STYLE_LINE_T_TO_B = 1002,
PAINT_FILL_GRADIENT_STYLE_LINE_B_TO_T = 1003,
PAINT_FILL_GRADIENT_STYLE_LINE_LT_TO_RB = 1004,
PAINT_FILL_GRADIENT_STYLE_LINE_LB_TO_RT = 1005,
PAINT_FILL_GRADIENT_STYLE_LINE_RT_TO_LB = 1006,
PAINT_FILL_GRADIENT_STYLE_LINE_RB_TO_LT = 1007,
PAINT_FILL_GRADIENT_STYLE_LINE2_L_AND_R_TO_C = 1008,
PAINT_FILL_GRADIENT_STYLE_LINE2_C_TO_L_AND_R = 1009,
PAINT_FILL_GRADIENT_STYLE_LINE2_T_AND_B_TO_C = 1010,
PAINT_FILL_GRADIENT_STYLE_LINE2_C_TO_T_AND_B = 1011,
PAINT_FILL_GRADIENT_STYLE_LINE2_LT_AND_RB_TO_C = 1012,
PAINT_FILL_GRADIENT_STYLE_LINE2_C_TO_LT_AND_RB = 1013,
PAINT_FILL_GRADIENT_STYLE_LINE2_RT_AND_LB_TO_C = 1014,
PAINT_FILL_GRADIENT_STYLE_LINE2_C_TO_RT_AND_LB = 1015,

PAINT_FILL_GRADIENT_STYLE_ANGLE_TO_LT = 2000,
PAINT_FILL_GRADIENT_STYLE_ANGLE_TO_LB = 2001,
PAINT_FILL_GRADIENT_STYLE_ANGLE_TO_RT = 2002,
PAINT_FILL_GRADIENT_STYLE_ANGLE_TO_RB = 2003,
PAINT_FILL_GRADIENT_STYLE_ANGLE_FROM_LT = 2004,
PAINT_FILL_GRADIENT_STYLE_ANGLE_FROM_LB = 2005,
PAINT_FILL_GRADIENT_STYLE_ANGLE_FROM_RT = 2006,
PAINT_FILL_GRADIENT_STYLE_ANGLE_FROM_RB = 2007,

PAINT_FILL_GRADIENT_STYLE_RECTANGLE_TO_C = 3000,
PAINT_FILL_GRADIENT_STYLE_RECTANGLE_FROM_C = 3001,

PAINT_FILL_GRADIENT_STYLE_ELLIPSE_TO_C = 4000,
PAINT_FILL_GRADIENT_STYLE_ELLIPSE_FROM_C = 4001,

PAINT_FILL_GRADIENT_STYLE_CONE_FROM_L = 5000,
PAINT_FILL_GRADIENT_STYLE_CONE_FROM_R = 5001,
PAINT_FILL_GRADIENT_STYLE_CONE_FROM_T = 5002,
PAINT_FILL_GRADIENT_STYLE_CONE_FROM_B = 5003,
PAINT_FILL_GRADIENT_STYLE_CONE_FROM_LT = 5004,
PAINT_FILL_GRADIENT_STYLE_CONE_FROM_LB = 5005,
PAINT_FILL_GRADIENT_STYLE_CONE_FROM_RT = 5006,
PAINT_FILL_GRADIENT_STYLE_CONE_FROM_RB = 5007,

} PAINTFILLGRADIENTSTYLE, *pPAINTFILLGRADIENTSTYLE;

The PAINTFILLGRADIENTSTYLE enumerated type contains options for the background gradient fill style. These are the possible values for the nGradientStyle member of the PAINTFILLstructure.


PAINTFILLSTYLE

typedef enum
{
PAINT_FILL_STYLE_SOLID,
PAINT_FILL_STYLE_GRADIENT,
PAINT_FILL_STYLETILEDIMAGE
} PAINTFILLSTYLE, *pPAINTFILLSTYLE;

The PAINTFILLSTYLE enumerated type contains options for the fill style used to fill an area. These are the possible values for the nStyle member of the PAINTFILLstructure.


PAINTGROUP

typedef enum
{
PAINT_GROUP_BRUSH,
PAINT_GROUP_SHAPE,
PAINT_GROUP_REGION,
PAINT_GROUP_FILL,
PAINT_GROUP_TEXT
} PAINTGROUP ;

An enumeration type that determines the current paint group.

Comments

Each paint group represents a set of properties for a specific painting ability. For example, the paint group indicated by PAINT_GROUP_BRUSH represents the set of properties for the paintbrush. These properties are set using the PAINTBRUSH structure. Each paint group and its associated structure is given below:

Value | Meaning
PAINT_GROUP_BRUSH | Represents the paintbrush properties found in the PAINTBRUSH structure.
PAINT_GROUP_SHAPE | Represents the shape properties found in the PAINTSHAPE structure.
PAINT_GROUP_REGION | Represents the region properties found in the he PAINTREGION structure.
PAINT_GROUP_FILL | Represents the fill properties found in the PAINTFILL structure.
PAINT_GROUP_TEXT | Represents the text properties found in the PAINTTEXT structure.


PAINTHANDLE; pPAINTHANDLE

PAINTHANDLE

The PAINTHANDLE structure serves as a working area for the painting functions. The user can initialize the paint handle at the start of program and save it in a variable. The paint handle can then be used with any LEAD paint tools function. When the paint handle is no longer needed, the user can free it. Therefore, the user doesn’t have to initialize the paint handle and free it every time it is used.


PAINTHARDNESS

typedef struct _PAINTHARDNESS
{
PAINTHARDNESSDISTRBTYPE nDistributionType;
L_INT nValue;
} PAINTHARDNESS, L_FAR *pPAINTHARDNESS;

PAINTHARDNESS structure contains information used to control the sharpness of the brush edges.

Member | Description
nDistributionType | An enumerated type that indicates how the color will be distributed throughout the brush cross-section. For a list of possible values, refer to PAINTHARDNESSDISTRBTYPE.
nValue | Value indicating the hardness of the brush. Valid values are 1 to 100. The larger the value, the harder the brush.

Comments

The harder the brush, the more defined the edges of paint will be. With nValue set to 100, the paint stroke has sharply defined edges. As the hardness decreases, the brush edge softens.

pPAINTHARDNESS is a pointer to a PAINTHARDNESS structure.


PAINTHARDNESSDISTRBTYPE

typedef enum
{
PAINT_HARDNESS_DISTRB_TYPE_0
} PAINTHARDNESSDISTRBTYPE, *pPAINTHARDNESSDISTRBTYPE;

The PAINTHARDNESSDISTRBTYPE enumerated type contains options that describe the hardness distribution throughout a paintbrush. These options are possible values for the nDistributionType member of the PAINTHARDNESSstructure.


PAINTREGION

typedef struct _PAINTREGION
{
L_INT nSize;
L_UINT32 dwMask;
COLORREF crUpperTolerance;
COLORREF crLowerTolerance;
L_INT nRoundRectEllipseWidth;
L_INT nRoundRectEllipseHeight;
} PAINTREGION, L_FAR *pPAINTREGION;

The PAINTREGION structure holds information used for creating a region.

Member | Description
nSize | Size of this structure.
dwMask | Flags that indicate which members contain valid information for the structure. Possible values are:
 | Value | Meaning
 | PRF_ALL | All the fields contain valid data.
 | PRF_UPPERTOLERANCE | The crUpperTolerance field contains valid data.
 | PRF_LOWERTOLERANCE | The crLowerTolerance field contains valid data.
 | PRF_ROUNDRECTELLIPSEWIDTH | The nRoundRectEllipseWidth field contains valid data.
 | PRF_ROUNDRECTELLIPSEHEIGHT | The nRoundRectEllipseHeight field contains valid data.
 | The values can be combined using the bit-wise OR operator ( | )
crUpperTolerance | COLORREF value that contains the amount of upper variance allowed from the selected color. Valid values are between 0 and 255. The values of R, G and B will be used to check the tolerance.
crLowerTolerance | COLORREF value that contains the amount of lower variance allowed from the selected color. Valid values are between 0 and 255. The values of R, G and B will be used to check the tolerance.
nRoundRectEllipseWidth | Value indicating the width, in pixels, of the ellipse used to create a round rectangle region. Valid values are 0 to 500.
nRoundRectEllipseHeight | Value indicating the height, in pixels, of the ellipse used to create a round rectangle region. Valid values are 0 to 500.

Comments

The default values for this structure are:

nSize = sizeof (PAINTREGION)
crUpperTolerance = RGB (0, 0, 0)
crLowerTolerance = RGB (0, 0, 0)
nRoundRectEllipseWidth = 0
nRoundRectEllipseHeight = 0

pPAINTREGION is a pointer to a PAINTREGION structure.


PAINTSHAPE

typedef struct _PAINTSHAPE
{
L_INT nSize;
L_UINT32 dwMask;
PAINTSHAPEBACKSTYLE nBackgroundStyle;
COLORREF crBackgroundColor;
pBITMAPHANDLE pBackgroundTileBitmap;
PAINTSHAPEBORDERSTYLE nBorderStyle;
L_INT nBorderWidth;
PAINTSHAPEBORDERBRUSHSTYLE nBorderBrushStyle;
COLORREF crBorderColor;
HBITMAP hBorderTileBitmap;
PAINTSHAPEGRADIENTSTYLE nGradientStyle;
COLORREF crGradientStartColor;
COLORREF crGradientEndColor;
L_UINT uGradientSteps;
PAINTSHAPEBORDERENDCAP nBorderEndCap;
L_INT nRoundRectEllipseWidth;
L_INT nRoundRectEllipseHeight;
L_INT nOpacity;
pBITMAPHANDLE pTexture;
} PAINTSHAPE, L_FAR *pPAINTSHAPE;

The PAINTSHAPE structure holds information about shapes.

Member | Description
nSize | Size of this structure.
dwMask | Flags that indicate which structure members contain valid information. Possible values are:

 | Value | Meaning
 | PSF_ALL | All the fields contain valid data.
 | PSF_BACKGROUNDSTYLE | The nBackgroundStyle field contains valid data.
 | PSF_BACKGROUNDCOLOR | The crBackgroundColor field contains valid data.
 | PSF_BACKGROUNDTILEBITMAP | The pBackgroundTileBitmap field contains valid data.
 | PSF_BORDERSTYLE | The nBorderStyle field contains valid data.
 | PSF_BORDERWIDTH | The nBorderWidth field contains valid data.
 | PSF_BORDERBRUSHSTYLE | The nBorderBrushStyle field contains valid data.
 | PSF_BORDERCOLOR | The crBorderColor field contains valid data.
 | PSF_BORDERTILEBITMAP | The hBorderTileBitmap field contains valid data.
 | PSF_GRADIENTSTYLE | The nGradientStyle field contains valid data.
 | PSF_GRADIENTSTARTCOLOR | The crGradientStartColor field contains valid data.
 | PSF_GRADIENTENDCOLOR | The crGradientEndColor field contains valid data.
 | PSF_GRADIENTSTEPS | The uGradientSteps field contains valid data.
 | PSF_BORDERENDCAP | The nBorderEndCap field contains valid data.
 | PSF_ROUNDRECTELLIPSEWIDTH | The nRoundRectEllipseWidth field contains valid data.
 | PSF_ROUNDRECTELLIPSEHEIGHT | The nRoundRectEllipseHeight field contains valid data.
 | PSF_OPACITY | The nOpacity field contains valid data.
 | PSF_TEXTURE | The pTexture field contains valid data.
 | The values can be combined using the bitwise OR operator ( | )
nBackgroundStyle | An enumerated type that indicates the shape's background style. For a list of possible values, refer to PAINTSHAPEBACKSTYLE.
crBackgroundColor | The COLORREF value that specifies the color to use for the shape's background color, when nBackgroundStyle is PAINT_SHAPE_BACK_STYLE_OPAQUE.
pBackgroundTileBitmap | Pointer to the bitmap handle referencing the bitmap to be used for the shape's background, when nBackgroundStyle is PAINT_SHAPE_BACK_STYLE_TILEDIMAGE. The BITMAPHANDLE pointer should still be valid after setting this field.
nBorderStyle | An enumerated type that indicates the shape's border style. For a list of possible values, refer to PAINTSHAPEBORDERSTYLE.
nBorderWidth | Value indicating the shape's border width, in pixels. Valid values are 1 to 100.
nBorderBrushStyle | Value indicating the brush style to be used to draw the shape's border. For a list of possible values, refer to PAINTSHAPEBORDERBRUSHSTYLE.
crBorderColor | The COLORREF value that specifies the color to be used to draw the shape's border.
hBorderTileBitmap | Specifies the DDB to be used to draw the shape's border. The DDB, should still be valid after setting this field.
nGradientStyle | Specifies the shape's background gradient type when nBackgroundStyle is PAINT_SHAPE_BACK_STYLE_GRADIENT. For a list of possible values, refer to PAINTSHAPEGRADIENTSTYLE.
crGradientStartColor | The COLORREF value that specifies the color to use as the starting color for the background gradient fill.
crGradientEndColor | The COLORREF value that specifies the color to use as the ending color for the background gradient fill.
uGradientSteps | Number of gradient color steps. Valid values are 2 to 255.
nBorderEndCap | An enumerated type that indicates how the ends of lines will be drawn. For a list of possible values, refer to PAINTSHAPEBORDERENDCAP.
nRoundRectEllipseWidth | Value indicating the width, in pixels, of the ellipse used to create a rounded rectangle. Valid values are 0 to 500.
nRoundRectEllipseHeight | Value indicating the height, in pixels, of the ellipse used to create a rounded rectangle. Valid values are 0 to 500.
nOpacity | Value indicating the transparency of the shape when combined with the painting canvas. Valid values are 0 to 255. A color or an image with an opacity of 255 is transparent a color or an image with an opacity of 0 is completely opaque (solid).
pTexture | Pointer to the bitmap handle that references the bitmap used to simulate paper texture. This makes it appear as if the painting is done on paper having that texture. The BITMAPHANDLE pointer should still be valid after setting this field.

Comments

The default values for this structure are:

nSize = sizeof (PAINTSHAPE)
nBackgroundStyle = PAINT_SHAPE_BACK_STYLE_OPAQUE
crBackgroundColor = RGB (255, 255, 255)
pBackgroundTileBitmap = NULL
nBorderStyle = PAINT_SHAPE_BORDER_STYLE_SOLID
nBorderWidth = 1
nBorderBrushStyle = PAINT_SHAPE_BORDER_BRUSH_STYLE_COLOR
crBorderColor = RGB (0,0,0)
hBorderTileBitmap = NULL
nGradientStyle = PAINT_SHAPE_GRADIENT_STYLE_RECTANGLE_TO_C
crGradientStartColor = RGB (0,0,0)
crGradientEndColor = RGB (255, 255, 255)
uGradientSteps = 255
nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_SQUARE
nRoundRectEllipseWidth = 0
nRoundRectEllipseHeight = 0
nOpacity = 0
pTexture = NULL

pPAINTSHAPE is a pointer to a PAINTSHAPE structure.


PAINTSHAPEBACKSTYLE

typedef enum
{
PAINT_SHAPE_BACK_STYLE_TRANSPARENT,
PAINT_SHAPE_BACK_STYLE_OPAQUE,
PAINT_SHAPE_BACK_STYLE_TILEDIMAGE,
PAINT_SHAPE_BACK_STYLE_GRADIENT
} PAINTSHAPEBACKSTYLE, *pPAINTSHAPEBACKSTYLE;

The PAINTSHAPEBACKSTYLE enumerated type contains options for the background style of a shape. These are the possible values for the nBackgroundStyle member of the PAINTSHAPE structure.


PAINTSHAPEBORDERBRUSHSTYLE

typedef enum
{
PAINT_SHAPE_BORDER_BRUSH_STYLE_COLOR,
PAINT_SHAPE_BORDER_BRUSH_STYLE_PATTERN
} PAINTSHAPEBORDERBRUSHSTYLE, *pPAINTSHAPEBORDERBRUSHSTYLE;

The PAINTSHAPEBORDERBRUSHSTYLE enumerated type contains options for the border brush style of a shape. These are the possible values for the nBorderBrushStyle member of the PAINTSHAPE structure.


PAINTSHAPEBORDERENDCAP

typedef enum
{
PAINT_SHAPE_BORDER_ENDCAP_ROUND,
PAINT_SHAPE_BORDER_ENDCAP_SQUARE,
PAINT_SHAPE_BORDER_ENDCAP_FLAT
} PAINTSHAPEBORDERENDCAP, *pPAINTSHAPEBORDERENDCAP;

The PAINTSHAPEBORDERENDCAP enumerated type contains options for the border endcap of a shape. These are the possible values for the nBorderEndCap member of the PAINTSHAPE structure.

Comments

These values determine the shape of the ends of lines.


PAINTSHAPEBORDERSTYLE

typedef enum
{
PAINT_SHAPE_BORDER_STYLE_SOLID,
PAINT_SHAPE_BORDER_STYLE_DASH,
PAINT_SHAPE_BORDER_STYLE_DOT,
PAINT_SHAPE_BORDER_STYLE_DASHDOT,
PAINT_SHAPE_BORDER_STYLE_DASHDOTDOT
PAINT_SHAPE_BORDER_STYLE_DASHDOTDOTDOT
PAINT_SHAPE_BORDER_STYLE_DASH_GAP
PAINT_SHAPE_BORDER_STYLE_DOT_GAP
PAINT_SHAPE_BORDER_STYLE_DASHDOT_GAP
PAINT_SHAPE_BORDER_STYLE_DASHDOTDOT_GAP
PAINT_SHAPE_BORDER_STYLE_DASHDOTDOTDOT_GAP
PAINT_SHAPE_BORDER_STYLE_TRANSPARENT
} PAINTSHAPEBORDERSTYLE, *pPAINTSHAPEBORDERSTYLE;

The PAINTSHAPEBORDERSTYLE enumerated type contains options for the border style of a shape. These are the possible values for the nBorderStyle member of the PAINTSHAPE structure.


PAINTSHAPEGRADIENTSTYLE

typedef enum
{
PAINT_SHAPE_GRADIENT_STYLE_NONE,
PAINT_SHAPE_GRADIENT_STYLE_LINE_L_TO_R = 1000,
PAINT_SHAPE_GRADIENT_STYLE_LINE_R_TO_L = 1001,
PAINT_SHAPE_GRADIENT_STYLE_LINE_T_TO_B = 1002,
PAINT_SHAPE_GRADIENT_STYLE_LINE_B_TO_T = 1003,
PAINT_SHAPE_GRADIENT_STYLE_LINE_LT_TO_RB = 1004,
PAINT_SHAPE_GRADIENT_STYLE_LINE_LB_TO_RT = 1005,
PAINT_SHAPE_GRADIENT_STYLE_LINE_RT_TO_LB = 1006,
PAINT_SHAPE_GRADIENT_STYLE_LINE_RB_TO_LT = 1007,
PAINT_SHAPE_GRADIENT_STYLE_LINE2_L_AND_R_TO_C = 1008,
PAINT_SHAPE_GRADIENT_STYLE_LINE2_C_TO_L_AND_R = 1009,
PAINT_SHAPE_GRADIENT_STYLE_LINE2_T_AND_B_TO_C = 1010,
PAINT_SHAPE_GRADIENT_STYLE_LINE2_C_TO_T_AND_B = 1011,
PAINT_SHAPE_GRADIENT_STYLE_LINE2_LT_AND_RB_TO_C = 1012,
PAINT_SHAPE_GRADIENT_STYLE_LINE2_C_TO_LT_AND_RB = 1013,
PAINT_SHAPE_GRADIENT_STYLE_LINE2_RT_AND_LB_TO_C = 1014,
PAINT_SHAPE_GRADIENT_STYLE_LINE2_C_TO_RT_AND_LB = 1015,

PAINT_SHAPE_GRADIENT_STYLE_ANGLE_TO_LT = 2000,
PAINT_SHAPE_GRADIENT_STYLE_ANGLE_TO_LB = 2001,
PAINT_SHAPE_GRADIENT_STYLE_ANGLE_TO_RT = 2002,
PAINT_SHAPE_GRADIENT_STYLE_ANGLE_TO_RB = 2003,
PAINT_SHAPE_GRADIENT_STYLE_ANGLE_FROM_LT = 2004,
PAINT_SHAPE_GRADIENT_STYLE_ANGLE_FROM_LB = 2005,
PAINT_SHAPE_GRADIENT_STYLE_ANGLE_FROM_RT = 2006,
PAINT_SHAPE_GRADIENT_STYLE_ANGLE_FROM_RB = 2007,

PAINT_SHAPE_GRADIENT_STYLE_RECTANGLE_TO_C = 3000,
PAINT_SHAPE_GRADIENT_STYLE_RECTANGLE_FROM_C = 3001,

PAINT_SHAPE_GRADIENT_STYLE_ELLIPSE_TO_C = 4000,
PAINT_SHAPE_GRADIENT_STYLE_ELLIPSE_FROM_C = 4001,

PAINT_SHAPE_GRADIENT_STYLE_CONE_FROM_L = 5000,
PAINT_SHAPE_GRADIENT_STYLE_CONE_FROM_R = 5001,
PAINT_SHAPE_GRADIENT_STYLE_CONE_FROM_T = 5002,
PAINT_SHAPE_GRADIENT_STYLE_CONE_FROM_B = 5003,
PAINT_SHAPE_GRADIENT_STYLE_CONE_FROM_LT = 5004,
PAINT_SHAPE_GRADIENT_STYLE_CONE_FROM_LB = 5005,
PAINT_SHAPE_GRADIENT_STYLE_CONE_FROM_RT = 5006,
PAINT_SHAPE_GRADIENT_STYLE_CONE_FROM_RB = 5007,

} PAINTSHAPEGRADIENTSTYLE, *pPAINTSHAPEGRADIENTSTYLE;

The PAINTSHAPEGRADIENTSTYLE enumerated type contains options for the gradient background style of a shape. These are the possible values for the nGradientStyle member of the PAINTSHAPE structure.


PAINTTEXT

typedef struct _PAINTEXT
{
L_INT nSize;
L_UINT32 dwMask;
LPTSTR pszText;
HFONT hFont;
PAINTTEXTBORDERBRUSHSTYLE nBorderBrushStyle;
L_INT nBorderWidth;
COLORREF crBorderColor;
PAINTTEXTBACKSTYLE nBackgroundStyle;
COLORREF crBackgroundColor;
pBITMAPHANDLE pBackgroundTileBitmap;
PAINTALIGNMENT nAlignment;
L_INT nOpacity;
pBITMAPHANDLE pTexture;
PAINTTRANSFORM TransformInfo;
} PAINTEXT, L_FAR *pPAINTEXT;

The PAINTTEXT structure contains information for drawing text.

Member | Description
nSize | Size of this structure.
dwMask | Flags that indicate which structure members contain valid information. Possible values are:
 | Value | Meaning
 | PTF_ALL | All the fields contain valid data.
 | PTF_TEXT | The pszText field contains valid data.
 | PTF_FONT | The hFont field contains valid data.
 | PTF_BORDERBRUSHSTYLE | The nBorderBrushStyle field contains valid data.
 | PTF_BORDERWIDTH | The nBorderWidth field contains valid data.
 | PTF_BORDERCOLOR | The crBorderColor field contains valid data.
 | PTF_BACKGROUNDSTYLE | The nBackgroundStyle field contains valid data.
 | PTF_BACKGROUNDCOLOR | The crBackgroundColor field contains valid data.
 | PTF_BACKGROUNDTILEBITMAP | The pBackgroundTileBitmap field contains valid data.
 | PTF_ALIGNMENT | The nAlignment field contains valid data.
 | PTF_OPACITY | The nOpacity field contains valid data.
 | PTF_TEXTURE | The pTexture field contains valid data.
 | PTF_TRANSFORMINFO | The TransformInfo field contains valid data.
 | The values can be combined using the bit-wise OR operator ( | ).
pszText | Character string that contains the string to be drawn. The toolkit will copy this string to its internal data.
hFont | The font used to paint the text. This font should be a true type font. The toolkit will not copy this handle. Therefore, this font handle should still be valid after setting this field.
nBorderBrushStyle | An enumerated type that indicates the text border (outline) style. For a list of possible values, refer to PAINTTEXTBORDERBRUSHSTYLE.
nBorderWidth | Value that indicates the width or the text border, in pixels. Valid values are 1 to 100.
crBorderColor | The COLORREF value that specifies the color to use to draw the text border (outline).
nBackgroundStyle | An enumerated type that indicates the text background style. For a list of possible values, refer to PAINTTEXTBACKSTYLE.
crBackgroundColor | The COLORREF value that specifies the color to use for filling the text background when nBackgroundStyle is PAINT_TEXT_BACK_STYLE_OPAQUE.
pBackgroundTileBitmap | Pointer to the bitmap handle referencing the bitmap used to fill the text background when nBackgroundStyle is PAINT_TEXT_BACK_STYLE_TILEDIMAGE. The BITMAPHANDLE pointer should still be valid after setting this field.
nAlignment | An enumerated type that indicates text alignment. For a list of possible values, refer to PAINTALIGNMENT.
nOpacity | Value that indicates the transparency of the text when combined with the painting canvas. Valid values are 0 to 255. A color or an image with nOpacity of 255 is transparent. A color or an image with nOpacity of 0 is completely opaque (solid).
pTexture | Pointer to the bitmap handle referencing the bitmap that will simulate paper texture. Using a paper texture gives the appearance of painting on paper having that texture. The BITMAPHANDLE pointer should still be valid after setting this field.
TransformInfo | Structure that contains information used to transform the text output.
 | The nRotate structure field of TransformInfo will effect the text output result only when the nAlignment field is: (PAINT_ALIGNMENT_HCENTER | PAINT_ALIGNMENT_VCENTER )
 | Otherwise, the toolkit will consider nRotate to be 0.

Comments

The default values for this structure are:

nSize = sizeof (PAINTTEXT)
pszText = NULL
hFont = NULL
nBorderBrushStyle = PAINT_TEXT_BORDER_BRUSH_STYLE_COLOR
nBorderWidth = 1
crBorderColor = RGB (0, 0, 0)
nBackgroundStyle = PAINT_TEXT_BACK_STYLE_OPAQUE
crBackgroundColor = RGB (255, 255, 255)
pBackgroundTileBitmap = NULL
nAlignment = PAINT_ALIGNMENT_HCENTER|PAINT_ALIGNMENT_VCENTER
nOpacity = 0
pTexture = NULL
TransformInfo.nRotate = 0
TransformInfo.Scale.cx = 100
TransformInfo.Scale.cy = 100


PAINTTEXTBACKSTYLE

typedef enum
{
PAINT_TEXT_BACK_STYLE_TRANSPARENT,
PAINT_TEXT_BACK_STYLE_OPAQUE,
PAINT_TEXT_BACK_STYLE_TILEDIMAGE,
} PAINTTEXTBACKSTYLE ;

An enumeration type that determines the current text background sytle.


PAINTTEXTBORDERBRUSHSTYLE

typedef enum
{
PAINT_TEXT_BORDER_BRUSH_STYLE_TRANSPARENT,
PAINT_TEXT_BORDER_BRUSH_STYLE_COLOR,
} PAINTTEXTBORDERBRUSHSTYLE ;

An enumeration type that determines the current text border brush style.


PAINTTOUCH

typedef struct _PAINTTOUCH
{
PAINTTOUCHSHAPE nShape;
PAINTTOUCHCONTENTS nContentsType;
COLORREF crColor;
pBITMAPHANDLE pBitmap;
COLORREF crTransparentColor;
} PAINTTOUCH, L_FAR *pPAINTTOUCH;

The PAINTTOUCH structure contains information about a single paintbrush touch on the painting canvas. A paintbrush stroke is constructed from multiple paintbrush touches.

Member | Description
nShape | An enumeration type that controls the shape of the cross-section (tip) of the brush. For a list of possible values, refer to PAINTTOUCHSHAPE.
nContentsType | An enumeration type that indicates the contents of the paintbrush. For a list of possible values, refer to PAINTTOUCHCONTENTS.
crColor | The COLORREF value that specifies the color to use for the paintbrush when nContentsType is PAINT_TOUCH_CONTENTS_COLOR.
pBitmap | Pointer to the bitmap handle that references the bitmap that contains the paintbrush image when nContentsType is PAINT_TOUCH_CONTENTS_IMAGE. The BITMAPHANDLE pointer should still be valid after setting this field.
crTransparentColor | The COLORREF value that specifies the transparent color of the paintbrush image.

Comments

pPAINTTOUCH is a pointer to a PAINTTOUCH structure.


PAINTTOUCHCONTENTS

typedef enum PAINTTOUCHCONTENTS
{
PAINT_TOUCH_CONTENTS_COLOR,
PAINT_TOUCH_CONTENTS_IMAGE
} PAINTTOUCHCONTENTS, *pPAINTTOUCHCONTENTS;

The PAINTTOUCHCONTENTS enumerated type contains possible contents values for the nContentsType member of the PAINTTOUCH structure. This value represents the contents of a paintbrush.


PAINTTOUCHSHAPE

typedef enum PAINTTOUCHSHAPE
{
PAINT_TOUCH_SHAPE_CIRCLE
} PAINTTOUCHSHAPE, *pPAINTTOUCHSHAPE;

The PAINTTOUCHSHAPE enumerated type contains possible shape values for the nShape member of the PAINTTOUCH structure.


PAINTTRANSFORM

typedef struct _PAINTTRANSFORM
{
L_INT nRotate;
SIZE Scale;
} PAINTTRANSFORM, L_FAR * pPAINTTRANSFORM

The PAINTTRANSFORM structure contains information used to transform (scale and rotate) coordinates.

Member | Description
nRotate | Rotation angle. The angle is in degrees, counter-clockwise.
Scale | Scaling factor.
 | cx will be used to scale the coordinates in the horizontal direction.
 | cy will be used to scale the coordinates in the vertical direction.
 | Valid values are between 1 and 10000, For example:
 | Value | Meaning
 | 100 | the same.
 | 110 | 1.1 times the original dimensions
 | 120 | 1.2 times the original dimensions up to
 | 10000 | 100 times larger than the original dimensions.
 | 99 | 0.99 times the original dimensions,
 | 98 | 0.98 times the original dimensions
 | 1 | 0.01 times the original dimensions.


PAINTXFORM

typedef struct _PAINTXFORM
{
L_INT nZoom;
L_INT nXOffset;
L_INT nYOffset;
} PAINTXFORM, L_FAR* pPAINTXFORM;

The PAINTXFORM structure provides data for translating from the external coordinates, such as mouse position, to the device context (DC) or bitmap coordinates.

Member | Description
nZoom | The zooming factor that will be used by the toolkit to scale the user input. Valid values are between 1 and 10000, For example:
 | Value | Meaning
 | 100 | the same.
 | 110 | 1.1 times the original dimensions
 | 120 | 1.2 times the original dimensions up to
 | 10000 | 100 times larger than the original dimensions.
 | 99 | 0.99 times the original dimensions,
 | 98 | 0.98 times the original dimensions
 | 1 | 0.01 times the original dimensions.
nXOffset | The X offset of the external representation of the DC or Bitmap.
nYOffset | The Y offset of the external representation of the DC or Bitmap.

Comments

When assigning an external representation to the toolkit, every point (Xa, Ya) in the an external representation is transformed by the toolkit to the point (Xc, Yc) by using the following steps:

1.

Add offsets:

Xb = Xa + nXOffset
Yb = Ya + nYOffset

2.

Multiply by scalars:

Xc = MulDiv (Xb, nZoom, 100 ) ;
Yc = MulDiv ( Yb, nZoom, 100 ) ;

pPAINTXFORM is a pointer to a PAINTXFORM structure.


PAINTDLGBRUSHINFO

typedef struct _PAINTDLGBRUSHINFO
{
L_INT nSize;
L_INT32 dwFlags;
L_TCHAR *pszTitle;
PAINTTOUCHCONTENTS nContentsType;
COLORREF crColor;
L_TCHAR ** ppszTouchImage;
L_UINT uTouchImageCount;
L_INT nActiveTouchImageItem;
COLORREF crTransparentColor;
L_INT nDiameter;
L_INT nHardnessValue;
L_INT nSpacing;
L_INT nDensity;
L_INT nOpacity;
L_INT nFadeOutRate;
L_TCHAR ** ppszPaperTexture;
L_UINT uPaperTextureCount;
L_INT nActivePaperTextureItem;

} PAINTDLGBRUSHINFO, L_FAR *pPAINTDLGBRUSHINFO;

The PAINTDLGBRUSHINFO structure contains information about the paintbrush properties dialog.

Member | Description
nSize | Size of this structure.
dwFlags | User interface flags for dialog. Determines the layout and action of the dialog. Possible values are:
 | Setting | Description
 | PAINT_DLG_BRUSH_SHOWALL | [0x00000001] Show all controls
 | PAINT_DLG_BRUSH_SHOWTOUCHCONTENT | [0x00000002] Show touch contents control
 | PAINT_DLG_BRUSH_SHOWTOUCHCOLOR | [0x00000004] Show touch color control
 | PAINT_DLG_BRUSH_SHOWTOUCHIMAGE | [0x00000008] Show touch image control
 | PAINT_DLG_BRUSH_SHOWDIAMETER | [0x00000010] Show diameter control
 | PAINT_DLG_BRUSH_SHOWHARDNESS | [0x00000020] Show hardness control
 | PAINT_DLG_BRUSH_SHOWSPACING | [0x00000040] Show spacing control
 | PAINT_DLG_BRUSH_SHOWOPACITY | [0x00000080] Show opacity control
 | PAINT_DLG_BRUSH_SHOWDENSITY | [0x00000100] Show density control
 | PAINT_DLG_BRUSH_SHOWFADEOUTRATE | [0x00000200] Show fadeout rate control
 | PAINT_DLG_BRUSH_SHOWTEXTURE | [0x00000400] Show texture control
 | PAINT_DLG_BRUSH_SHOWDEFAULT | [0x00000800] Show Default control
 | PAINT_DLG_BRUSH_INITUSEDEFAULT | [0x00001000] Use the default values to initialize the dialog control.
 | PAINT_DLG_BRUSH_SHOWTRANSPARENTCOLOR | [0x00002000] Show transparent color control.
pszTitle | Character string containing the dialog box caption text.
nContentsType | An enumeration type that represents the contents of the paintbrush . For a list of possible values, refer to PAINTTOUCHCONTENTS.
crColor | COLORREF value that specifies the paintbrush color when the nContentsType is PAINT_TOUCH_CONTENTS_COLOR.
ppszTouchImage | Array of strings containing the names of the images used to fill the touch image combo box.
uTouchImageCount | Number of strings used to fill the touch image combo box.
nActiveTouchImageItem | Index to the current image selected in the touch image combo box. This is a zero-based index.
crTransparentColor | This value represents the transparent color of the paintbrush image.
nDiameter | Value indicating the size of the brush in pixels. Valid values are between 1 and 200.
nHardnessValue | Value indicating the hardness of the brush. Valid values are between 1 and 100.
nSpacing | Value indicating how often the paintbrush tip touches the surface during a paint stroke. When the spacing is 30 this means that the brush tip will touch the painting surface once every 30 pixels. Valid values are between 1 and 1000.
nDensity | Value indicating the amount of paint the brush applies with each stroke. Increasing the density of the brush is comparable to increasing the number of bristles in the brush. With more bristles, more paint is applied in a stroke. Similarly, decreasing the density decreases the number of bristles in the brush. With fewer bristles, less paint is applied in a stroke. Valid values are 1 to 100 and represent a percentage. A value of 100% results in the surface being completely covered with paint. A value of 1% results in very little paint being applied to the surface.
nOpacity | Value indicating the transparency of the brush touch when combined with the painting canvas. Valid values are between 0 and 255. A color or an image with an opacity of 255 is transparent. A color or an image with an opacity of 0 is completely opaque (solid).
nFadeOutRate | Value indicating the rate at which the brush contents will fade (become more transparent). Valid values are between 0 and 10000. 0 means no fadeout will occur. Other values (1-10000) will increase transparency every nSpacing pixels until total transparency is reached.
ppszPaperTexture | Array of strings containing the names of the images used to fill the paper texture combo box.
uPaperTextureCount | Number of strings in the paper texture array.
nActivePaperTextureItem | Index of the current image selected in the paper texture combo box. This is a zero-based index.

Comment

The image below shows the paintbrush properties dialog:

When the uTouchImageCount field value is 0 or when the ppszTouchImage field value is NULL the toolkit will return the following values:

ppszTouchImage = NULL
uTouchImageCount = 0
nActiveTouchImageItem = -1

The nActivePaperTextureItem field value will be –1 when the user selects "none" from the paper texture combo box.

When the value of the nActivePaperTextureItem is set to –1, the current selection in the paper texture combo box will be "none".

When the User presses the default button, the dialog box will reset to the default values, for all fields, except nActiveTouchImageItem. The nActiveTouchImageItem value will be the value it was before the last call to the Dialog box.


PAINTDLGFILLINFO

typedef struct _PAINTDLGFILLINFO
{
L_INT nSize;
L_INT32 dwFlags;
L_TCHAR * pszTitle;
PAINTFILLSTYLE nStyle;
COLORREF crSolidFillColor
L_TCHAR ** ppszBackgroundTileBitmap;
L_UINT uBackgroundTileBitmapCount;
L_INT nActiveBackgroundTileBitmapItem;
PAINTFILLGRADIENTSTYLE nGradientStyle;
COLORREF crGradientStartColor;
COLORREF crGradientEndColor;
L_UINT uGradientSteps;
COLORREF crUpperTolerance;
COLORREF crLowerTolerance;
L_INT nOpacity;
L_TCHAR ** ppszPaperTexture;
L_UINT uPaperTextureCount;
L_INT nActivePaperTextureItem;

} PAINTDLGFILLINFO, L_FAR *pPAINTDLGFILLINFO ;

The PAINTDLGFILLINFO structure contains information about the fill properties dialog.

Member | Description
nSize | Size of this structure.
dwFlags | User interface flags for the dialog. Determines the layout and action of the dialog. Possible values are:
 | Setting | Description
 | PAINT_DLG_FILL_SHOWALL | [0x00000001] Show All controls.
 | PAINT_DLG_FILL_SHOWSTYLE | [0x00000002] Show Style control.
 | PAINT_DLG_FILL_SHOWSOLIDFILLCOLOR | [0x00000004] Show Solid fill color control.
 | PAINT_DLG_FILL_SHOWBKGRNDTILE | [0x00000008] Show Background tile control.
 | PAINT_DLG_FILL_SHOWGRADIENTSTYLE | [0x00000010] Show Gradient style control.
 | PAINT_DLG_FILL_SHOWGRADIENTDIRECTION | [0x00000020] Show Gradient direction control.
 | PAINT_DLG_FILL_SHOWGRADIENTPREVIEW | [0x00000040] Show Gradient preview control.
 | PAINT_DLG_FILL_SHOWGRADIENTSTARTCOLOR | [0x00000080] Show Gradient start color control.
 | PAINT_DLG_FILL_SHOWGRADIENTENDCOLOR | [0x00000100] Show Gradient end color control.
 | PAINT_DLG_FILL_SHOWGRADIENTSTEPS | [0x00000200] Show Gradient steps control.
 | PAINT_DLG_FILL_SHOWLOWERTOLERANCE | [0x00000400] Show Lower tolerance control.
 | PAINT_DLG_FILL_SHOWUPPERTOLERANCE | [0x00000800] Show Upper tolerance control.
 | PAINT_DLG_FILL_SHOWOPACITY | [0x00001000] Show Opacity control.
 | PAINT_DLG_FILL_SHOWTEXTURE | [0x00002000] Show Paper texture control.
 | PAINT_DLG_FILL_SHOWDEFAULT | [0x00004000] Show Default control.
 | PAINT_DLG_FILL_INITUSEDEFAULT | [0x00008000] Use the initial default values for the dialog control.
pszTitle | Character string containing the Dialog box caption text.
nStyle | An enumerated type indicating the fill style. For a list of possible values, refer to PAINTFILLSTYLE.
crSolidFillColor | COLORREF value containing the fill color to use when nStyle is PAINT_FILL_STYLE_SOLID.
ppszBackgroundTileBitmap | Array of strings containing the names of the images used to fill the background tile bitmap combo box.
uBackgroundTileBitmapCount | Number of strings in ppszBackgroundTileBitmap.
nActiveBackgroundTileBitmapItem | Index of the image currently selected in the background tile combo box. This is a zero-based index.
nGradientStyle | An enumerated type that represents the background gradient fill style. For a list of possible values, refer to PAINTFILLGRADIENTSTYLE.
crGradientStartColor | COLORREF value that specifies the color that will start the background gradient fill.
crGradientEndColor | COLORREF value that specifies the color that will end the background gradient fill.
uGradientSteps | Number of gradient fill steps. Valid values are between 2 and 255.
crUpperTolerance | COLORREF value that contains the amount of upper variance allowed from the selected color. Valid values are between 0 and 255.
crLowerTolerance | COLORREF value that contains the amount of lower variance allowed from the selected color. Valid values are between 0 and 255.
nOpacity | Value indicating the transparency of the fill when combined with the painting canvas. Valid values are 0 to 255. A color or an image with an opacity of 255 is transparent. A color or an image with an opacity of 0 is completely opaque (solid).
ppszPaperTexture | Array of strings containing the names of the images used to fill the paper texture combo box.
uPaperTextureCount | Number of strings in ppszPaperTexture.
nActivePaperTextureItem | Index of the currently selected image in the paper texture combo box. This is a zero-based index.

Comments

An image of the Fill dialog can be seen below.

When the uBackgroundTileBitmapCount field value is set to 0 or when the ppszBackgroundTileBitmap field value is set to NULL, the structure members shown below will automatically be set to the following values:

ppszBackgroundTileBitmap = NULL
uBackgroundTileBitmapCount = 0
nActiveBackgroundTileBitmapItem = -1

The nActivePaperTextureItem field value will be –1 when the user selects "none" from the paper texture combo box.

When the value of the nActivePaperTextureItem is set to –1, the current selection in the paper texture combo box will be "none".

When the user presses the default button, the dialog box will reset to the default values, for all fields, except nActiveBackgroundTileBitmapItem. The nActivebackgroundTileBitmapItem will be the value it was before the last call to the Dialog box.


PAINTDLGREGIONINFO

typedef struct _PAINTDLGREGIONINFO
{
L_INT nSize;
L_INT32 dwFlags;
L_TCHAR * pszTitle;
COLORREF crUpperTolerance;
COLORREF crLowerTolerance;
L_INT nRoundRectEllipseWidth;
L_INT nRoundRectEllipseHeight;

} PAINTDLGREGIONINFO, L_FAR *pPAINTDLGREGIONINFO ;

The PAINTDLGREGIONINFO structure contains information about the Region dialog.

Member | Description
nSize | Size of this structure.
dwFlags | User interface flags for the dialog. Determines the layout and action of the dialog. Possible values are:
 | Setting | Description
 | PAINT_DLG_REGION_SHOWALL | [0x00000001] Show all controls.
 | PAINT_DLG_REGION_SHOWLOWERTOLERANCE | [0x00000002] Show Lower tolerance control.
 | PAINT_DLG_REGION_SHOWUPPERTOLERANCE | [0x00000004] Show Upper tolerance control.
 | PAINT_DLG_REGION_SHOWELLIPSEWIDTH | [0x00000008] Show Ellipse width control.
 | PAINT_DLG_REGION_SHOWELLIPSEHEIGHT | [0x00000010] Show Ellipse height control.
 | PAINT_DLG_REGION_SHOWDEFAULT | [0x00000020] Show Default control.
 | PAINT_DLG_REGION_INITUSEDEFAULT | [0x00000040] Use the initial default values for the dialog control.
pszTitle | Character string containing the Dialog box caption text.
crUpperTolerance | COLORREF value that contains the amount of upper variance allowed from the selected color. Valid values are between 0 and 255. The values of R, G and B will be used to check the tolerance.
crLowerTolerance | COLORREF value that contains the amount of lower variance allowed from the selected color. Valid values are between 0 and 255. The values of R, G and B will be used to check the tolerance.
nRoundRectEllipseWidth | Value indicating the width, in pixels, of the ellipse used to create a round rectangle region. Valid values are 0 to 500.
nRoundRectEllipseHeight | Value indicating the height, in pixels, of the ellipse used to create a round rectangle region. Valid values are 0 to 500.

Comments

An image of the Region dialog can be seen below.


PAINTDLGSHAPEINFO

typedef struct _PAINTDLGSHAPEINFO
{
L_INT nSize;
L_INT32 dwFlags;
L_TCHAR * pszTitle;
PAINTSHAPEBACKSTYLE nBackgroundStyle;
COLORREF crBackgroundColor;
L_TCHAR ** ppszBackgroundTileBitmap;
L_UINT uBackgroundTileBitmapCount;
L_INT nActiveBackgroundTileBitmapItem;
PAINTSHAPEBORDERSTYLE nBorderStyle;
L_INT nBorderWidth;
PAINTSHAPEBORDERBRUSHSTYLE nBorderBrushStyle;
COLORREF crBorderColor;
L_TCHAR ** pszBorderTileBitmap;
L_UINT uBorderTileBitmapCount;
L_INT nActiveBorderTileBitmapItem;
PAINTSHAPEGRADIENTSTYLE nGradientStyle;
COLORREF crGradientStartColor;
COLORREF crGradientEndColor;
L_UINT uGradientSteps;
PAINTSHAPEBORDERENDCAP nBorderEndCap;
L_INT nRoundRectEllipseWidth;
L_INT nRoundRectEllipseHeight;
L_INT nOpacity;
L_TCHAR ** ppszPaperTexture;
L_UINT uPaperTextureCount;
L_INT nActivePaperTextureItem;

} PAINTDLGSHAPEINFO, L_FAR *pPAINTDLGSHAPEINFO ;

The PAINTDLGSHAPEINFO structure contains information about the Shape dialog.

Member | Description
nSize | Size of this structure.
dwFlags | User interface flags for the dialog. Determines the layout and action of the dialog. Possible values are
 | Setting | Description
 | PAINT_DLG_SHAPE_SHOWALL | [0x00000001] Show all controls.
 | PAINT_DLG_SHAPE_SHOWBKGRNDSTYLE | [0x00000002] Show Background style control.
 | PAINT_DLG_SHAPE_SHOWBKOPAQUECOLOR | [0x00000004] Show the opaque color control.
 | PAINT_DLG_SHAPE_SHOWGRADIENTSTYLE | [0x00000008] Show Gradient style control.
 | PAINT_DLG_SHAPE_SHOWGRADIENTDIRECTION | [0x00000010] Show Gradient direction control.
 | PAINT_DLG_SHAPE_SHOWGRADIENTSTARTCOLOR | [0x00000020] Show Gradient start color control.
 | PAINT_DLG_SHAPE_SHOWGRADIENTENDCOLOR | [0x00000040] Show Gradient end color control.
 | PAINT_DLG_SHAPE_SHOWGRADIENTPREVIEW | [0x00000080] Show Gradient preview control.
 | PAINT_DLG_SHAPE_SHOWGRADIENTSTEPS | [0x00000100] Show Gradient steps control.
 | PAINT_DLG_SHAPE_SHOWBKGRNDTILE | [0x00000200] Show Background tile control.
 | PAINT_DLG_SHAPE_SHOWOPACITY | [0x00000400] Show Opacity control.
 | PAINT_DLG_SHAPE_SHOWBORDERSTYLE | [0x00000800] Show Border style control.
 | PAINT_DLG_SHAPE_SHOWBORDERWIDTH | [0x00001000] Show Border width control.
 | PAINT_DLG_SHAPE_SHOWBORDERBRUSHSTYLE | [0x00002000] Show Border brush style control.
 | PAINT_DLG_SHAPE_SHOWBORDERCOLOR | [0x00004000] Show Border color control
 | PAINT_DLG_SHAPE_SHOWBORDERPATTERN | [0x00008000] Show Border pattern control
 | PAINT_DLG_SHAPE_SHOWENDCAP | [0x00010000] Show End cap control
 | PAINT_DLG_SHAPE_SHOWELLIPSEWIDTH | [0x00020000] Show Ellipse width control
 | PAINT_DLG_SHAPE_SHOWELLIPSEHEIGHT | [0x00040000] Show Ellipse height control
 | PAINT_DLG_SHAPE_SHOWTEXTURE | [0x00080000] Show Paper texture control
 | PAINT_DLG_SHAPE_SHOWDEFAULT | [0x00100000] Show Default control
 | PAINT_DLG_SHAPE_INITUSEDEFAULT | [0x00200000] Use the initial default values for the dialog control
pszTitle | Character string containing the Dialog box caption text.
nBackgroundStyle | An enumerated type that indicates the background style. For a list of possible values, refer to PAINTSHAPEBACKSTYLE.
crBackgroundColor | COLORREF value that specifies the color to be used to fill the shape when nBackgroundStyle is PAINT_SHAPE_BACK_STYLE_OPAQUE.
ppszBackgroundTileBitmap | Array of strings containing the names of the images used to fill the background tile bitmap combo box.
uBackgroundTileBitmapCount | Number of strings in ppszBackgroundTileBitmap.
nActiveBackgroundTileBitmapItem | Index of the image currently selected in the paper texture combo box.
nBorderStyle | An enumerated type that indicates the border style. For a list of possible values, refer to PAINTSHAPEBORDERSTYLE.
nBorderWidth | Value indicating the width of the border, in pixels. Valid values are 1 to 100.
nBorderBrushStyle | An enumerated type that indicates the brush style used to draw the shape's border. For a list of possible values, refer to PAINTSHAPEBORDERBRUSHSTYLE.
crBorderColor | COLORREF value that specifies the color used to draw the shape's border.
ppszBorderTileBitmap | Array of strings containing the names of the images used to fill the border tile bitmap combo box.
uBorderTileBitmapCount | Number of strings in ppszBorderTileBitmap.
nActiveBorderTileBitmapItem | Index of the image currently selected in the background tile combo box.
nGradientStyle | An enumerated type that indicates the shape's background gradient fill style. For a list of possible values, refer to PAINTSHAPEGRADIENTSTYLE.
crGradientStartColor | COLORREF value that specifies the color that will start the background gradient fill.
crGradientEndColor | COLORREF value that specifies the color that will end the background gradient fill.
uGradientSteps | Number of gradient color steps. Valid values are 2 to 255.
nBorderEndCap | An enumerated type that indicates how the ends of lines will be drawn. For a list of possible values, refer to PAINTSHAPEBORDERENDCAP.
nRoundRectEllipseWidth | Value indicating the width, in pixels, of the ellipse used to create a rounded rectangle. Valid values are 0 to 500.
nRoundRectEllipseHeight | Value indicating the height, in pixels, of the ellipse used to create a rounded rectangle. Valid values are 0 to 500.
nOpacity | Value indicating the transparency of the shape when combined with the painting canvas. Valid values are 0 to 255. A color or an image with an opacity of 255 is transparent a color or an image with an opacity of 0 is completely opaque (solid).
ppszPaperTexture | Array of strings containing the names of the images used to fill the paper texture combo box.
uPaperTextureCount | Number of strings in ppszPaperTexture.
nActivePaperTextureItem | Index of the currently selected image in the paper texture combo box.

Comments

An image of the Shape dialog can be seen below.

When the uBackgroundTileBitmapCount field value is set to 0 or when the ppszBackgroundTileBitmap field value is set to NULL, the structure members shown below will automatically be set to the following values:

ppszBackgroundTileBitmap= NULL
uBackgroundTileBitmapCount= 0
nActiveBackgroundTileBitmapItem = -1

When the uBorderTileBitmapCount field value is set to 0 or when the ppszBorderTileBitmap field value is set to NULL, the structure members shown below will automatically be set to the following values:

ppszBorderTileBitmap = NULL
uBorderTileBitmapCount = 0
nActiveBorderTileBitmapItem = -1

The nActivePaperTextureItem field value will be –1 when the user selects "none" from the paper texture combo box.

When the value of the nActivePaperTextureItem is set to –1, the current selection in the paper texture combo box will be "none".

When the user presses the default button, the dialog box will reset to the default values, for all fields, except nActiveBackgroundTileBitmapItem. The nActiveBorderTileBitmapItem value will be the value it was before the last call to the Dialog box.


PAINTDLGTEXTINFO

typedef struct _PAINTDLGTEXTINFO
{
L_INT nSize;
L_INT32 dwFlags;
L_TCHAR * pszTitle;
L_TCHAR * pszText;
LOGFONT logFont;
PAINTTEXTBORDERBRUSHSTYLE nBorderBrushStyle;
L_INT nBorderWidth;
COLORREF crBorderColor;
PAINTTEXTBACKSTYLE nBackgroundStyle;
COLORREF crBackgroundColor;
L_TCHAR ** ppszBackgroundTileBitmap;
L_UINT uBackgroundTileBitmapCount;
L_INT nActiveBackgroundTileBitmapItem;
PAINTALIGNMENT nAlignment;
L_INT nOpacity;
L_TCHAR ** ppszPaperTexture;
L_UINT uPaperTextureCount;
L_INT nActivePaperTextureItem;
PAINTTRANSFORM TransformInfo;

} PAINTDLGTEXTINFO, L_FAR *pPAINTDLGTEXTINFO;

The PAINTDLGTEXTINFO structure contains information about the Text dialog.

Member | Description
nSize | Size of this structure.
dwFlags | User interface flags for the dialog. Determines the layout and action of the dialog.
 | Possible values are:
 | Setting | Description
 | PAINT_DLG_TEXT_SHOWALL | [0x00000001] Show all controls
 | PAINT_DLG_TEXT_SHOWTEXT | [0x00000002] Show Text control
 | PAINT_DLG_TEXT_SHOWBKGRNDSTYLE | [0x00000004] Show Background style control
 | PAINT_DLG_TEXT_SHOWBKGRNDOPAQUECOLOR | [0x00000008] Show Background Opaque color control
 | PAINT_DLG_TEXT_SHOWBKGRNDTILE | [0x00000010] Show Background tile control
 | PAINT_DLG_TEXT_SHOWBORDERSTYLE | [0x00000020] Show Border style control
 | PAINT_DLG_TEXT_SHOWBORDERWIDTH | [0x00000040] Show border width control
 | PAINT_DLG_TEXT_SHOWBORDERCOLOR | [0x00000080] Show Border color control
 | PAINT_DLG_TEXT_SHOWHORZALIGNMENT | [0x00000100] Show Horizontal Alignment control
 | PAINT_DLG_TEXT_SHOWVERTALIGNMENT | [0x00000200] Show Vertical Alignment control
 | PAINT_DLG_TEXT_SHOWROTATE | [0x00000400] Show Rotate control
 | PAINT_DLG_TEXT_SHOWSCALE | [0x00000800] Show Scale control
 | PAINT_DLG_TEXT_SHOWTRUETYPEFONT | [0x00001000] Show True type font control
 | PAINT_DLG_TEXT_SHOWOPACITY | [0x00002000] Show Opacity control
 | PAINT_DLG_TEXT_SHOWTEXTURE | [0x00004000] Show Paper texture control
 | PAINT_DLG_TEXT_SHOWDEFAULT | [0x00008000] Show Default control
 | PAINT_DLG_TEXT_INITUSEDEFAULT | [0x00010000] Use the initial default values for the dialog control
pszTitle | Character string containing the Dialog box caption text.
pszText | Character string containing the text string to be drawn. The toolkit will copy this string to its internal data.
logFont | Handle to the font used to paint the text. This font should be a true type font. The toolkit will not copy this handle. Therefore, this font handle should still valid after setting this field.
nBorderBrushStyle | An enumerated type that indicates the text border (outline) style. For a list of possible values, refer to PAINTTEXTBORDERBRUSHSTYLE.
nBorderWidth | Value indicating the width of the text border, in pixels. Valid values are 1 to 100.
crBorderColor | COLORREF value that contains the text border (outline) color.
nBackgroundStyle | An enumerated type that indicates the text background style. For a list of possible values, refer to PAINTTEXTBACKSTYLE.
crBackgroundColor | COLORREF value that contains the text background color.
ppszBackgroundTileBitmap | Array of strings containing the names of the images used to fill the background tile bitmap combo box.
uBackgroundTileBitmapCount | Number of strings in ppszBackgroundTileBitmap.
nActiveBackgroundTileBitmapItem | Index of the currently selected image in the background tile combo box.
nAlignment | An enumerated type that indicates text alignment. For a list of possible values, refer to PAINTALIGNMENT.
nOpacity | Value that indicates the transparency of the text when combined with the painting canvas. Valid values are 0 to 255. A color or an image with an opacity of 255 is transparent A color or an image with an opacity of 0 is completely opaque (solid).
ppszPaperTexture | Array of strings containing the names of the images used to fill the paper texture combo box.
uPaperTextureCount | Number of strings in ppszPaperTexture.
nActivePaperTextureItem | Index of the currently selected image in the paper texture combo box.
TransformInfo | Structure that contains information used to transform the text output.
 | The nRotate structure field of TransformInfo will effect the text output result only when the nAlignment field is: (PAINT_ALIGNMENT_HCENTER | PAINT_ALIGNMENT_VCENTER )
 | Otherwise, the toolkit will consider nRotate to be 0.

Comments

An image of the Text dialog can be seen below.

When the uBackgroundTileBitmapCount field value is set to 0 or when the ppszBackgroundTileBitmap field value is set to NULL, the structure members shown below will automatically be set to the following values:

ppszBackgroundTileBitmap = NULL
uBackgroundTileBitmapCount = 0
nActiveBackgroundTileBitmapItem = -1

The nActivePaperTextureItem field value will be –1 when the user selects "none" from the paper texture combo box.

When the value of the nActivePaperTextureItem is set to –1, the current selection in the paper texture combo box will be "none".

When the user presses the default button, the dialog box will reset to the default values, for all fields, except nActiveBackgroundTileBitmapItem. The nActivebackgroundTileBitmapItem field will be the value it was before the last call to the Dialog box.


Return Codes

For a list of all possible return codes for LEADTOOLS DigitalPaint API functions, refer to LEADTOOLS API Return Codes in the Main API help file.


Tutorials

Low-Level DigitalPaint: Initializing and Freeing a PaintHandle

Low-Level DigitalPaint: Setting General DigitalPaint Information

Low-Level DigitalPaint: Painting with a Brush

Low-Level DigitalPaint: Painting a Shape

Low-Level DigitalPaint: Creating a Region

Low-Level DigitalPaint: Filling an Area

Low-Level DigitalPaint: Drawing Text

Low-Level DigitalPaint: Processing the Window Activation Messages

Low-Level DigitalPaint: Using DigitalPaint Common Dialogs


Low-Level DigitalPaint: Initializing and Freeing a Paint Handle

Take the following steps that will create a new paint handle:

1. | Start Visual C++, version 4.2.
2. | Select the File->New menu option, and in the dialog box, select Project Workspace.
3. | In the New Project Workspace dialog box, enter the location (c:\lead\examples\paint), make sure to select Application (Win32 Application) as the project type. Give the project the name "tutorial" and press Enter.
4. | Select File->New menu option, and in the dialog box, select Resource Script and press Enter.
5. | Right click the script you just created and select Insert and then Menu from the dialog box that will appear and click OK.
6. | Create this Menu structure:
 | IDR_MENU1 |
 | &File |
 | &Open… | with ID = IDM_FILE_OPEN
 | E&xit | with ID = IDM_FILE_EXIT
7. | Select File->Save from the menu, enter Tutorial.rc in the Save As box and click Save.
8. | Select Insert->Files into Project, browse to the Tutorial.rc file we have just created and click Add.
9. | Select File->New menu option, and in the dialog box, select Text File and press Enter.
10. | Copy and paste the following code into the text file you have just created. This code will do the basic job of loading and painting the bitmap:

#include <windows.h>
#include <windowsx.h>
#include "c:\lead14\include\l_bitmap.h"
#include "resource.h"

static L_VOID OnSize
(
HWND hWnd,
pBITMAPHANDLE pBitmap,
LPRECT prcView,
L_INT cx,
L_INT cy,
L_INT nZoom,
L_INT *pnHScroll,
L_INT *pnVScroll
)
{
SCROLLINFO si ;
L_INT nXOffset, nYOffset ;

if ( NULL != pBitmap && pBitmap->Flags.Allocated )
{
si.cbSize = sizeof ( SCROLLINFO ) ;
si.fMask = SIF_ALL ;

// vertical scroll.
GetScrollInfo ( hWnd, SB_VERT, &si ) ;
si.nMin = 0 ;
si.nMax = BITMAPHEIGHT ( pBitmap ) ;
si.nPage = MulDiv ( cy, 100, nZoom ) ;

SetScrollInfo ( hWnd, SB_VERT, &si, TRUE ) ;

GetScrollInfo ( hWnd, SB_VERT, &si ) ;

*pnVScroll = si.nPos ;

// horizontal scroll
GetScrollInfo ( hWnd, SB_HORZ, &si ) ;
si.nMin = 0 ;
si.nMax = BITMAPWIDTH ( pBitmap ) ;
si.nPage = MulDiv ( cx, 100, nZoom ) ;

SetScrollInfo ( hWnd, SB_HORZ, &si, TRUE ) ;

GetScrollInfo ( hWnd, SB_HORZ, &si ) ;

*pnHScroll = si.nPos ;
}
else
{
si.cbSize = sizeof ( SCROLLINFO ) ;
si.fMask = SIF_RANGE ;
si.nMin = 0 ;
si.nMax = 0 ;

SetScrollInfo ( hWnd, SB_VERT, &si, TRUE ) ;
SetScrollInfo ( hWnd, SB_HORZ, &si, TRUE ) ;

*pnHScroll = 0 ;
*pnVScroll = 0 ;
}

// set the painting rectangel.
SetRect ( prcView, 0, 0, BITMAPWIDTH ( pBitmap ), BITMAPHEIGHT ( pBitmap ) ) ;

if ( nZoom < 100 )
{
nXOffset = MulDiv ( *pnHScroll, 100, nZoom ) ;
nYOffset = MulDiv ( *pnVScroll, 100, nZoom ) ;
}
else
{
nXOffset = *pnHScroll ;
nYOffset = *pnVScroll ;
}

OffsetRect ( prcView, - nXOffset, - nYOffset ) ;

prcView->left = MulDiv ( prcView->left, nZoom, 100 ) ;
prcView->top = MulDiv ( prcView->top, nZoom, 100 ) ;
prcView->right = MulDiv ( prcView->right, nZoom, 100 ) ;
prcView->bottom = MulDiv ( prcView->bottom, nZoom, 100 ) ;
}

L_VOID OnHScroll
(
HWND hWnd,
L_UINT code,
L_INT nZoom,
LPRECT prcView,
L_INT *pnHScroll,
L_INT *pnVScroll
)
{
SCROLLINFO si ;

si.cbSize = sizeof (SCROLLINFO) ;
si.fMask = SIF_ALL ;
GetScrollInfo (hWnd, SB_HORZ, &si) ;

*pnHScroll = si.nPos ;

switch ( code )
{
case SB_LINELEFT:
si.nPos -= 1 ;
break ;

case SB_LINERIGHT:
si.nPos += 1 ;
break ;

case SB_PAGELEFT:
si.nPos -= si.nPage ;
break ;

case SB_PAGERIGHT:
si.nPos += si.nPage ;
break ;

case SB_THUMBTRACK:
si.nPos = si.nTrackPos ;
break ;

default:
break ;
}

si.fMask = SIF_POS ;
SetScrollInfo (hWnd, SB_HORZ, &si, TRUE) ;
GetScrollInfo (hWnd, SB_HORZ, &si) ;

if ( si.nPos != *pnHScroll )
{
L_INT dxUpdate ;

// update screen.
if ( nZoom >= 100 )
{
dxUpdate = MulDiv ( ( *pnHScroll - si.nPos ), nZoom, 100 ) ;
}
else
{
dxUpdate = *pnHScroll - si.nPos ;
}

// update screen.
OffsetRect ( prcView, dxUpdate, 0 ) ;

ScrollWindow ( hWnd, dxUpdate, 0, NULL, NULL ) ;

*pnHScroll = si.nPos ;

UpdateWindow ( hWnd ) ;
}
}

L_VOID OnVScroll
(
HWND hWnd,
L_UINT code,
L_INT nZoom,
LPRECT prcView,
L_INT *pnHScroll,
L_INT *pnVScroll
)
{
SCROLLINFO si ;

si.cbSize = sizeof ( SCROLLINFO ) ;
si.fMask = SIF_ALL ;
GetScrollInfo (hWnd, SB_VERT, &si) ;

*pnVScroll = si.nPos ;

switch ( code )
{
case SB_LINEUP:
si.nPos -= 1 ;
break ;

case SB_LINEDOWN:
si.nPos += 1 ;
break ;

case SB_PAGEUP:
si.nPos -= si.nPage ;
break ;

case SB_PAGEDOWN:
si.nPos += si.nPage ;
break ;

case SB_THUMBTRACK:
si.nPos = si.nTrackPos ;
break ;

default:
break ;
}

si.fMask = SIF_POS ;
SetScrollInfo ( hWnd, SB_VERT, &si, TRUE ) ;
GetScrollInfo ( hWnd, SB_VERT, &si ) ;

if ( si.nPos != *pnVScroll )
{
L_INT dyUpdate ;

// update screen.
if ( nZoom >= 100 )
{
dyUpdate = MulDiv ( ( *pnVScroll - si.nPos ), nZoom, 100 ) ;
}
else
{
dyUpdate = *pnVScroll - si.nPos ;
}

// update screen.
OffsetRect ( prcView, 0, dyUpdate ) ;

ScrollWindow ( hWnd, 0, dyUpdate, NULL, NULL ) ;

*pnVScroll = si.nPos ;

UpdateWindow ( hWnd ) ;
}
}

L_VOID OnPaint
(
HWND hWnd,
pBITMAPHANDLE pBitmap,
LPRECT prcView,
HPALETTE hPalette
)
{
HDC hDC ;
PAINTSTRUCT ps ;
HPALETTE hOldPal ;

hDC = BeginPaint (hWnd, &ps) ;

if ( pBitmap->Flags.Allocated )
{
if ( hPalette )
{
hOldPal = SelectPalette ( hDC, hPalette, TRUE ) ;
RealizePalette ( hDC ) ;
}

L_PaintDC ( hDC, pBitmap, NULL, NULL, prcView, &ps.rcPaint, SRCCOPY ) ;

if ( NULL != hOldPal )
{
SelectPalette ( hDC, hOldPal, TRUE ) ;
}
}

EndPaint (hWnd, &ps) ;
}

static L_BOOL OnOpen ( HWND hWnd, pBITMAPHANDLE pBitmap )
{
static L_INT nOpenIndex = 0 ;
OPENFILENAME OpenFileName ;
L_TCHAR szFile [ MAX_PATH ] = TEXT("\0") ;
L_TCHAR szFileTitle [ MAX_PATH ] = TEXT("\0") ;
L_TCHAR szOpenFileFilter [ ] = {TEXT("ALL\0")TEXT("*.*\0")} ;
FILEOPENPARM FileOpenParams ;
FILEINFO FileInfo ;
L_UINT32 uFlags ;
BITMAPHANDLE hThumb ;

memset ( &FileOpenParams, 0, sizeof ( FILEOPENPARM ) ) ;

lstrcpy ( szFile, TEXT("") ) ;

L_InitBitmap ( pBitmap, 0, 0, 0 ) ;

L_InitBitmap ( &hThumb, 0, 0, 0 ) ;

OpenFileName.lStructSize = sizeof(OPENFILENAME);
OpenFileName.hwndOwner = hWnd;
OpenFileName.lpstrFilter = szOpenFileFilter;
OpenFileName.lpstrCustomFilter = NULL;
OpenFileName.nMaxCustFilter = 0;
OpenFileName.nFilterIndex = nOpenIndex;
OpenFileName.nMaxFile = sizeof(szFile);
OpenFileName.lpstrFile = szFile;
OpenFileName.nMaxFileTitle = sizeof(szFileTitle);
OpenFileName.lpstrFileTitle = szFileTitle;
OpenFileName.lpstrInitialDir = NULL;
OpenFileName.lpstrTitle = TEXT("Open a File");
OpenFileName.nFileOffset = 0;
OpenFileName.nFileExtension = 0;
OpenFileName.lpstrDefExt = NULL;
OpenFileName.lpfnHook = NULL;
OpenFileName.Flags = OFN_LONGNAMES ;

uFlags = DLG_FO_AUTOPROCESS |
DLG_FO_FILEINFO |
DLG_FO_SHOWPREVIEW |
DLG_FO_95STYLE ;

FileOpenParams.pBitmap = pBitmap ;
FileOpenParams.pThumbnail = &hThumb ;
FileOpenParams.bPreviewEnabled = TRUE ;
FileOpenParams.pFileInfo = &FileInfo ;

if ( L_DlgFileOpen ( hWnd, &OpenFileName, &FileOpenParams, uFlags, NULL, NULL ) == SUCCESS )
{
nOpenIndex = OpenFileName.nFilterIndex;

L_FreeBitmap ( &hThumb ) ;

L_ChangeBitmapViewPerspective ( NULL, pBitmap, TOP_LEFT );

return TRUE ;
}
else
{
return FALSE ;
}
}

static LRESULT WINAPI WndProc ( HWND hWnd, L_UINT uMessage, WPARAM wParam, LPARAM lParam )
{
static BITMAPHANDLE hBitmap ;
static RECT rcView ;
static HPALETTE hPalette = NULL ;
static L_INT nVScroll = 0 ;
static L_INT nHScroll = 0 ;
static L_INT nZoomFactor = 100 ;

switch( uMessage )
{
case WM_CREATE:
return 0L ;

case WM_DESTROY:
if ( hBitmap.Flags.Allocated )
{
L_FreeBitmap ( &hBitmap ) ;
}

if ( hPalette )
{
DeletePalette ( hPalette ) ;
}

PostQuitMessage ( 0 ) ;

return 0L ;

case WM_SIZE:
OnSize ( hWnd,
&hBitmap,
&rcView,
LOWORD ( lParam ),
HIWORD ( lParam ),
nZoomFactor,
&nHScroll,
&nVScroll ) ;
break ;

case WM_HSCROLL:
OnHScroll ( hWnd,
LOWORD ( wParam ),
nZoomFactor,
&rcView,
&nHScroll,
&nVScroll ) ;
break ;

case WM_VSCROLL:
OnVScroll ( hWnd,
LOWORD ( wParam ),
nZoomFactor,
&rcView,
&nHScroll,
&nVScroll ) ;

break ;

case WM_PAINT:
OnPaint ( hWnd, &hBitmap, &rcView, hPalette ) ;
break ;

case WM_COMMAND:
switch( LOWORD( wParam ) )
{
case IDM_FILE_OPEN:
{
BITMAPHANDLE hTempBitmap ;
HDC hDC ;

if ( OnOpen ( hWnd, &hTempBitmap ) )
{
if ( hBitmap.Flags.Allocated )
{
L_FreeBitmap ( &hBitmap ) ;
}

if ( hPalette )
{
DeletePalette ( hPalette ) ;
}

L_CopyBitmapHandle ( &hBitmap, &hTempBitmap ) ;

hDC = GetDC ( hWnd ) ;

hPalette = L_CreatePaintPalette ( hDC, &hBitmap ) ;

ReleaseDC ( hWnd, hDC ) ;

{//ADJUST WINDOW SIZE

RECT rcWindow ;
L_INT nWidth, nHeight ;

SystemParametersInfo ( SPI_GETWORKAREA, 0, &rcWindow, 0 ) ;

nWidth = min ( MulDiv ( BITMAPWIDTH ( &hBitmap ), nZoomFactor, 100 ),
( rcWindow.right - rcWindow.left ) ) ;

nHeight = min ( MulDiv ( BITMAPHEIGHT ( &hBitmap ), nZoomFactor, 100 ),
( rcWindow.bottom - rcWindow.top ) ) ;

MoveWindow ( hWnd,
0,
0,
nWidth,
nHeight,
TRUE ) ;

}//ADJUST WINDOW SIZE

InvalidateRect ( hWnd, NULL, TRUE ) ;
}
}

return 0L ;

case IDM_FILE_EXIT:
PostMessage ( hWnd, WM_CLOSE, 0, 0 ) ;
return 0L ;
}

break ;
}

return DefWindowProc ( hWnd, uMessage, wParam, lParam ) ;
}

L_INT WINAPI WinMain ( HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR pCmdLine, L_INT nCmdShow )
{
const L_TCHAR szClassName [ ] = TEXT("lead_paint_tutorial") ;
WNDCLASSEX WndClass ;
HWND hWnd ;
MSG Msg ;

UNREFERENCED_PARAMETER ( hInstPrev ) ;
UNREFERENCED_PARAMETER ( pCmdLine ) ;

// unlock lead file formats support
UNLOCKSUPPORT ( ) ;

WndClass.cbSize = sizeof ( WNDCLASSEX ) ;
WndClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS ;
WndClass.lpfnWndProc = WndProc ;
WndClass.cbClsExtra = 0 ;
WndClass.cbWndExtra = 0 ;
WndClass.hInstance = hInst ;
WndClass.hIcon = LoadIcon ( NULL, IDI_APPLICATION ) ;
WndClass.hCursor = LoadCursor ( NULL, IDC_ARROW ) ;
WndClass.hbrBackground = ( HBRUSH ) ( COLOR_WINDOW + 1 ) ;
WndClass.lpszMenuName = MAKEINTRESOURCE ( IDR_MENU1 ) ;
WndClass.lpszClassName = szClassName ;
WndClass.hIconSm = NULL ;

RegisterClassEx ( &WndClass ) ;

hWnd = CreateWindowEx ( 0L,
szClassName,
TEXT("Paint Tutorial"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
0,
CW_USEDEFAULT,
0,
NULL,
NULL,
hInst,
NULL ) ;

ShowWindow ( hWnd, nCmdShow ) ;
UpdateWindow ( hWnd ) ;

while ( GetMessage ( &Msg, NULL, 0, 0 ) != 0 )
{
TranslateMessage ( &Msg ) ;
DispatchMessage ( &Msg ) ;
}

UnregisterClass ( szClassName, hInst ) ;

return Msg.wParam ;
}

11.

Add the following include statement:

#include "c:\lead14\include\ltpnt.h"

12.

Add the following declaration to the WndProc function:

static pPAINTHANDLE pPaint ;

13.

Replace the "return 0L ; " in the WM_CREATE message in the WndProc function with following code:

if ( SUCCESS == L_PntInit ( &pPaint ) )
{
return 0L ;
}
else
{
return -1L ;
}

14.

Add the following code before the function "PostQuitMessage" call in the WM_DESTROY message in the WndProc function:

if ( SUCCESS == L_PntIsValid ( pPaint ) )
{
L_PntFree ( pPaint ) ;
}

15. | Select File->Save from the menu and give the text file the name "painttut.c"
16. | Select Insert->Files into Project from the menu, in the dialog box that will appear, browse to painttut.c you have just created, select it and click Add.
17. | Select Insert->Files into Project from the menu, in the dialog box that will appear, browse to c:\lead\lib\ltkrn_n.lib, select it and click Add.
18. | Select Insert->Files into Project from the menu, in the dialog box that will appear, browse to c:\lead\lib\ltdis_n.lib, select it and click Add.
19. | Select Insert->Files into Project from the menu, in the dialog box that will appear, browse to c:\lead\lib\ltdlg_n.lib, select it and click Add.
20. | Select Insert->Files into Project from the menu, in the dialog box that will appear, browse to c:\lead\lib\ltpnt_n.lib, select it and click Add.
21. | Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


Low-Level DigitalPaint: Setting General DigitalPaint Information

Start with the project you created in Low-Level DigitalPaint: Initializing and Freeing a Paint Handle. This tutorial will let you add code to set DigitalPaint information such as transformation, device context, bitmap canvas and restriction palette information.

1.

Add the following declarations to the WndProc function:

static PAINTXFORM PntXForm ;
RECT rcDCRect ;

2.

Add this line after the L_CreatePaintPalette function call in the "case IDM_FILE_OPEN:" option of the WM_COMMAND message in the WndProc function:

L_PntSetMetrics ( pPaint, hDC, &hBitmap, hPalette ) ;

3.

Add the following code after the OnSize function call in the WM_SIZE message in the WndProc function:

// set the toolkit transformations.
PntXForm.nZoom = nZoomFactor ;
PntXForm.nXOffset = - rcView.left ;
PntXForm.nYOffset = - rcView.top ;
L_PntSetTransformation ( pPaint, &PntXForm ) ;

// set the device context boundaries
SetRect ( &rcDCRect, 0, 0, LOWORD ( lParam ), HIWORD ( lParam ) ) ;
L_PntSetDCExtents ( pPaint, &rcDCRect ) ;

4.

Add the following code after the OnHScroll function call in the WM_HSCROLL message in the WndProc function:

// set the toolkit transformations.
PntXForm.nZoom = nZoomFactor ;
PntXForm.nXOffset = - rcView.left ;
PntXForm.nYOffset = - rcView.top ;
L_PntSetTransformation ( pPaint, &PntXForm ) ;

5.

Add the following code after the OnVScroll function call in the WM_VSCROLL message in the WndProc function:

// set the toolkit transformations.
PntXForm.nZoom = nZoomFactor ;
PntXForm.nXOffset = - rcView.left ;
PntXForm.nYOffset = - rcView.top ;
L_PntSetTransformation ( pPaint, &PntXForm ) ;

6.

Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


Low-Level DigitalPaint: Painting with a Brush

Start with the project you created in Low-Level DigitalPaint: Setting General DigitalPaint Information .

1.

Add the following popup menu to the main menu you created in Low-Level DigitalPaint: Initializing and Freeing a Paint Handle.

&Painting Test
&Brush with ID = IDM_PAINTTEST_BRUSH

2.

Add the following function before the OnOpen function definition:

static L_VOID OnBrush ( HWND hWnd, pPAINTHANDLE pPaint )
{
HDC hDC ;
PAINTBRUSH brush ;

// Reset all of the brush fields
memset ( &brush, 0, sizeof ( brush ) ) ;

// Get device context to draw on
hDC = GetDC ( hWnd ) ;

// Set the required paintbrush properties
brush.nSize = sizeof ( PAINTBRUSH ) ;
brush.dwMask = PBF_DIAMETER |
PBF_TOUCH |
PBF_SPACING ;
brush.nDiameter = 20 ;
brush.Touch.crColor = RGB ( 255, 0, 0 ) ;
brush.nSpacing = 25 ;

// Set the new paintbruch properties
L_PntSetProperty ( pPaint, PAINT_GROUP_BRUSH, &brush ) ;

// Use the current paintbruch properties to draw a paintbrush stroke to DC (hDC)
L_PntBrushMoveTo ( pPaint, hDC, 10, 10 ) ;
L_PntBrushLineTo ( pPaint, hDC, 500, 500 ) ;

// Release the device context
ReleaseDC ( hWnd, hDC ) ;
}

3.

Add the following code after the statement "return 0L;" of the "case IDM_FILE_EXIT:" statement:

case IDM_PAINTTEST_BRUSH:
OnBrush ( hWnd, pPaint ) ;
return 0L ;

4. | Compile and run the project by selecting Build->Execute tutorial.exe from the menu.
5. | Go to the "File" menu and use the "Open…" item to open an image.
6. | Go to the "Painting Test" and select the "Brush" item. This will draw a brush stroke on the given DC and on the opened bitmap.


Low-Level DigitalPaint: Painting a Shape

Start with the project you created in Low-Level DigitalPaint: Painting with a Brush.

1.

Add the following item to the popup menu "Painting Test " that you added to the main menu:

&Painting Test
&Shape with ID = IDM_PAINTTEST_SHAPE

2.

Add the following function before the OnOpen function definition:

static L_VOID OnShape ( HWND hWnd, pPAINTHANDLE pPaint )
{
HDC hDC ;
PAINTSHAPE shape;

// Set the required shape properties
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERWIDTH |
PSF_BORDERSTYLE |
PSF_BORDERCOLOR |
PSF_BORDERENDCAP ;
shape.nBorderWidth = 10 ;
shape.nBorderStyle = PAINT_SHAPE_BORDER_STYLE_DASHDOT ;
shape.crBorderColor = RGB ( 255, 0, 0 ) ;
shape.nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_ROUND ;

// Set the new shape properties
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

// Get device context to draw on
hDC = GetDC ( hWnd ) ;

// Use the current shape properties to draw a line to the currently selected bitmap
L_PntDrawShapeLine ( pPaint, hDC, 10, 10, 400, 400 ) ;

// Release the device context
ReleaseDC ( hWnd, hDC ) ;
}

3.

Add the following line after the "return 0L ;" of the "case IDM_PAINTTEST_BRUSH:" statement:

case IDM_PAINTTEST_SHAPE:
OnShape ( hWnd, pPaint ) ;
return 0L ;

4. | Compile and run the project by selecting Build->Execute tutorial.exe from the menu.
5. | Go to the "File" menu and use the "Open…" item to open an image.
6. | Go to the "Painting Test" and select the "Shape" item. This will draw a line using the current shape properties.


Low-Level DigitalPaint: Creating a Region

Start with the project you created in Low-Level DigitalPaint: Painting Using a Shape.

1. | Add the following item to the popup menu "Painting Test " that you added to the main menu:
 | &Painting Test |
 | &Region | with ID = IDM_PAINTTEST_REGION
2. | Add the following function before the OnOpen function definition:

static L_VOID OnRegion ( HWND hWnd, pPAINTHANDLE pPaint )
{
HDC hDC ;
PAINTREGION region ;
RECT rcRegion ;
HRGN hRgn ;

region.nSize = sizeof ( PAINTREGION ) ;
region.dwMask = PRF_ROUNDRECTELLIPSEWIDTH |
PRF_ROUNDRECTELLIPSEHEIGHT ;
region.nRoundRectEllipseWidth = 40 ;
region.nRoundRectEllipseHeight = 40 ;

// Set the new region properties
L_PntSetProperty ( pPaint, PAINT_GROUP_REGION, &region ) ;

// Get the device context
hDC = GetDC ( hWnd ) ;

// Set the coordinates with respect to the DC dimensions
SetRect ( &rcRegion, 10, 10, 200, 200 ) ;

// Use the current region properties and the current painting
// transformations to create a rouned rectangle region
L_PntRegionRoundRect ( pPaint, hDC, &rcRegion, &hRgn ) ;

// View the resulted region
FrameRgn ( hDC, hRgn, GetStockObject ( BLACK_BRUSH ), 1, 1 ) ;

// Delete the region
DeleteRgn ( hRgn ) ;

// Release the device context
ReleaseDC ( hWnd, hDC ) ;
}

3.

Add the following line after the "return 0L ;" of the "case IDM_PAINTTEST_SHAPE:" statement:

case IDM_PAINTTEST_REGION:
OnRegion ( hWnd, pPaint ) ;
return 0L ;

4. | Compile and run the project by selecting Build->Execute tutorial.exe from the menu.
5. | Go to the "File" menu and use the "Open…" item to open an image.
6. | Go to the "Painting Test" and select the "Region" item. This will create a region using the current region properties.


Low-Level DigitalPaint: Filling an Area

Start with the project you created in Low-Level DigitalPaint: Creating a Region .

1. | Add the following item to the popup menu "Painting Test " that you added to the main menu:
 | &Painting Test |
 | &Fill | with ID = IDM_PAINTTEST_FILL
2. | Add the following function before the OnOpen function definition:

static L_VOID OnFill ( HWND hWnd, pPAINTHANDLE pPaint )
{
HDC hDC ;
PAINTSHAPE shape ;
PAINTFILL fill ;
RECT rcShape ;
RECT rcDCExtents ;

// Get device context to draw on
hDC = GetDC ( hWnd ) ;

// Set the required shape properties
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERWIDTH |
PSF_BORDERCOLOR |
PSF_BACKGROUNDCOLOR ;

shape.nBorderWidth = 10 ;
shape.crBorderColor = RGB ( 255, 0, 0 ) ;
shape.crBackgroundColor = RGB ( 255, 0, 0 ) ;

// Set the new shape properties
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

// Set the coordinates with respect to the DC dimensions
SetRect ( &rcShape, 10, 10, 60, 60 ) ;

// Use the current shape properties to draw an ellipse to the DC (hDC)
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;

SetRect ( &rcShape, 100, 10, 150, 60 ) ;
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;

SetRect ( &rcShape, 60, 60, 95, 95 ) ;
L_PntDrawShapeRectangle ( pPaint, hDC, &rcShape ) ;

SetRect ( &rcShape, 10, 100, 60, 150 ) ;
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;

SetRect ( &rcShape, 100, 100, 150, 150 ) ;
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;

// Get the destination DC dimensions
GetClientRect ( hWnd, &rcDCExtents ) ;

// Set the toolkit user DC extents
L_PntSetDCExtents ( pPaint, &rcDCExtents ) ;

// Set the required fill properties
fill.nSize = sizeof ( PAINTFILL ) ;
fill.dwMask = PFF_STYLE ;
fill.nStyle = PAINT_FILL_STYLE_GRADIENT ;

// Set the new fill properties
L_PntSetProperty ( pPaint, PAINT_GROUP_FILL, &fill ) ;

// Fill the target area
L_PntFillColorReplace ( pPaint, hDC, RGB ( 255, 0, 0 ) ) ;

// Release the device context
ReleaseDC ( hWnd, hDC ) ;
}

3.

Add the following line after the "return 0L ;" of the "case IDM_PAINTTEST_REGION:" statement:

case IDM_PAINTTEST_FILL:
OnFill ( hWnd, pPaint ) ;
return 0L ;

4. | Compile and run the project by selecting Build->Execute tutorial.exe from the menu.
5. | Go to the "File" menu and use the "Open…" item to open an image.
6. | Go to the "Painting Test" and select the "Fill" item. This will replace all the RGB ( 255, 0, 0 ) color using the current fill group properties.


Low-Level DigitalPaint: Drawing Text

Start with the project you created in Low-Level DigitalPaint: Filling an Area .

1. | Add the following item to the popup menu "Painting Test " that you added to the main menu:
 | &Painting Test |
 | &Text | with ID = IDM_PAINTTEST_TEXT
2. | Add the following function before the OnOpen function definition:

static L_VOID OnText ( HWND hWnd, pPAINTHANDLE pPaint )
{
HDC hDC ;
PAINTTEXT text ;
RECT rcText ;
LOGFONT lf ;
HFONT hFont ;

// Get device context to draw on
hDC = GetDC ( hWnd ) ;

// Set the required text font properties
lf.lfHeight = 48 ;
lf.lfWidth = 0 ;
lf.lfEscapement = 0 ;
lf.lfOrientation = 0 ;
lf.lfWeight = FW_NORMAL ;
lf.lfItalic = FALSE ;
lf.lfUnderline = FALSE ;
lf.lfStrikeOut = FALSE ;
lf.lfCharSet = ANSI_CHARSET ;
lf.lfOutPrecision = OUT_DEFAULT_PRECIS ;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS ;
lf.lfQuality = DEFAULT_QUALITY ;
lf.lfPitchAndFamily = FF_DONTCARE ;
lstrcpy ( lf.lfFaceName, TEXT("Times New Roman")) ;

// Create the desired text font
hFont = CreateFontIndirect ( &lf ) ;

// Set the desired text properties
text.nSize = sizeof ( PAINTTEXT ) ;
text.dwMask = PTF_TEXT | PTF_FONT | PTF_TRANSFORMINFO ;
text.pszText = TEXT("LEAD") ;
text.hFont = hFont ;
text.TransformInfo.Scale.cx = 100 ;
text.TransformInfo.Scale.cy = 100 ;
text.TransformInfo.nRotate = 45 ;

// Set the new text properties
L_PntSetProperty ( pPaint, PAINT_GROUP_TEXT, &text ) ;

// Set the target text drawing box coordinates with respect to the DC dimensions
SetRect ( &rcText, 10, 10, 200, 200 ) ;

// Use the current text properties and the current transformations properties
// to draw the text to the DC
L_PntApplyText ( pPaint, hDC, &rcText ) ;

// Delete the font object
DeleteObject ( hFont ) ;

// Release the device context
ReleaseDC ( hWnd, hDC ) ;
}

3.

Add the following line after the "return 0L ;" of the "case IDM_PAINTTEST_FILL:" statement:

case IDM_PAINTTEST_TEXT:
OnText ( hWnd, pPaint ) ;
return 0L ;

4. | Compile and run the project by selecting Build->Execute tutorial.exe from the menu.
5. | Go to the "File" menu and use the "Open…" item to open an image.
6. | Go to the "Painting Test" and select the "Text" item. This will draw a text using the current text group properties.


Low-Level DigitalPaint: Processing the Window Activation Messages

This tutorial is giving an example on how to process the window activation messages:

Start with the project you created in Low-Level DigitalPaint: Drawing Text.

1.

Add the following function before the OnOpen function definition:

static L_VOID OnActivate
(
HWND hWnd,
pPAINTHANDLE pPaint,
pBITMAPHANDLE pBitmap,
HPALETTE hPalette,
L_INT nZoom,
L_INT nHScroll,
L_INT nVScroll
)
{
PAINTXFORM XForm ;
HDC hdcCompatibility ;
RECT rcDCRect ;

//set the painting toolkit data
hdcCompatibility = GetDC ( hWnd ) ;

L_PntSetMetrics ( pPaint, hdcCompatibility, pBitmap, hPalette ) ;

ReleaseDC ( hWnd, hdcCompatibility ) ;

XForm.nZoom = nZoom ;
XForm.nXOffset = nHScroll ;
XForm.nYOffset = nVScroll ;

L_PntSetTransformation ( pPaint, &XForm ) ;

GetClientRect ( hWnd, &rcDCRect ) ;

L_PntSetDCExtents ( pPaint, &rcDCRect ) ;
}

2.

Add the following line after the "break;" statement of the "case WM_PAINT:" statement:

case WM_ACTIVATE:
if ( WA_INACTIVE != LOWORD ( wParam ) )
{
OnActivate ( hWnd, pPaint, &hBitmap, hPalette, nZoomFactor, nHScroll, nVScroll ) ;

return 0 ;
}

break ;

3.

Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


Low-Level DigitalPaint: Using the DigitalPaint Common Dialogs

Start with the project you created in Low-Level DigitalPaint: Processing the Window Activation Messages.

1.

Add the following popup menu to the main menu you created in Low-Level DigitalPaint: Initializing and Freeing a Paint Handle

&Dialog Test |
&Shape … | with ID = IDM_DIALOGTEST_SHAPE

2.

Add the following include statement before #include "resource.h" statement:

#include "c:\lead14\ include\ltpdg.h"

3.

Add the following function before the OnOpen function definition:

L_VOID OnShapeDlg ( HWND hWnd, pPAINTHANDLE pPaint )
{
PAINTSHAPE shape ;
PAINTDLGSHAPEINFO ShapeDlgInfo ;
L_INT nRet ;
RECT rcRect;
HDC hdcTest;

hdcTest = GetDC (hWnd);
L_PntGetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

ShapeDlgInfo.dwFlags = PAINT_DLG_SHAPE_SHOWALL ;
ShapeDlgInfo.pszTitle = "Shape Properties" ;
ShapeDlgInfo.nBackgroundStyle = shape.nBackgroundStyle ;
ShapeDlgInfo.crBackgroundColor = shape.crBackgroundColor ;
ShapeDlgInfo.ppszBackgroundTileBitmap = NULL ;
ShapeDlgInfo.uBackgroundTileBitmapCount = 0 ;
ShapeDlgInfo.nActiveBackgroundTileBitmapItem = -1 ;
ShapeDlgInfo.nBorderStyle = shape.nBorderStyle ;
ShapeDlgInfo.nBorderBrushStyle = shape.nBorderBrushStyle ;
ShapeDlgInfo.crBorderColor = shape.crBorderColor ;
ShapeDlgInfo.ppszBorderTileBitmap = NULL ;
ShapeDlgInfo.uBorderTileBitmapCount = 0 ;
ShapeDlgInfo.nActiveBorderTileBitmapItem = -1 ;
ShapeDlgInfo.nBorderWidth = shape.nBorderWidth ;
ShapeDlgInfo.nBorderEndCap = shape.nBorderEndCap ;
ShapeDlgInfo.nGradientStyle = shape.nGradientStyle ;
ShapeDlgInfo.crGradientStartColor = shape.crGradientStartColor ;
ShapeDlgInfo.crGradientEndColor = shape.crGradientEndColor ;
ShapeDlgInfo.uGradientSteps = shape.uGradientSteps ;
ShapeDlgInfo.nRoundRectEllipseWidth = shape.nRoundRectEllipseWidth ;
ShapeDlgInfo.nRoundRectEllipseHeight = shape.nRoundRectEllipseHeight ;
ShapeDlgInfo.nOpacity = shape.nOpacity ;
ShapeDlgInfo.ppszPaperTexture = NULL ;
ShapeDlgInfo.uPaperTextureCount = 0 ;
ShapeDlgInfo.nActivePaperTextureItem = -1 ;

nRet = L_PntDlgShape ( hWnd, &ShapeDlgInfo ) ;

if ( SUCCESS == nRet )
{
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_ALL ;
shape.nBackgroundStyle = ShapeDlgInfo.nBackgroundStyle ;
shape.crBackgroundColor = ShapeDlgInfo.crBackgroundColor ;
shape.pBackgroundTileBitmap = NULL ;
shape.nBorderStyle = ShapeDlgInfo.nBorderStyle ;
shape.nBorderBrushStyle = ShapeDlgInfo.nBorderBrushStyle ;
shape.crBorderColor = ShapeDlgInfo.crBorderColor ;
shape.hBorderTileBitmap = NULL ;
shape.nBorderWidth = ShapeDlgInfo.nBorderWidth ;
shape.nBorderEndCap = ShapeDlgInfo.nBorderEndCap ;
shape.nGradientStyle = ShapeDlgInfo.nGradientStyle ;
shape.crGradientStartColor = ShapeDlgInfo.crGradientStartColor ;
shape.crGradientEndColor = ShapeDlgInfo.crGradientEndColor ;
shape.uGradientSteps = ShapeDlgInfo.uGradientSteps ;
shape.nRoundRectEllipseWidth = ShapeDlgInfo.nRoundRectEllipseWidth ;
shape.nRoundRectEllipseHeight = ShapeDlgInfo.nRoundRectEllipseHeight ;
shape.nOpacity = ShapeDlgInfo.nOpacity ;
shape.pTexture = NULL ;

L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;
// now draw something to see the results of the dialog settings
SetRect(&rcRect, 10, 10, 100, 100);
L_PntDrawShapeRectangle(pPaint, hdcTest, &rcRect);
}
}

4.

Add the following line after the "return 0L ;" of the "case IDM_PAINTTEST_TEXT:" statement:

case IDM_DIALOGTEST_SHAPE:
OnShapeDlg ( hWnd, pPaint ) ;
return 0L ;

5. | Select Insert->Files into Project from the menu, in the dialog box that will appear, browse to c:\lead\lib\ltpdg_n.lib, select it and click Add.
6. | Compile and run the project by selecting Build->Execute tutorial.exe from the menu.
7. | Go to the "Dialog Test" menu and select the item "Shape…" to start playing with the shape dialog.


L_PntApplyText

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntApplyText (pPaint, UserDC, prcRect)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
LPRECT prcRect; | /* pointer to a RECT structure */

Writes a character string in the specified rectangle.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
prcRect | Pointer to a RECT structure that contains the bounding rectangle in which to write the text. This rectangle will also be used to align the text.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The text will be drawn using the current text properties. To determine the current text properties, call L_PntGetProperty. To set or change the current text properties, call L_PntSetProperty. For more information on the text properties, refer to the PAINTTEXT structure.

The text string and font must be set before calling this function. Otherwise, the function will return an error.

If UserDC is not NULL, the toolkit will paint the text on the specified device context. If UserDC is NULL, the text will not be painted on a device context.

If a bitmap has been set using the L_PntSetMetrics function, the text will be drawn on the specified bitmap. If UserDC is not NULL and a bitmap has been set using the L_PntSetMetrics function, then the text will be drawn to both the device context and the bitmap.

The font handle in the hFont field of the PAINTTEXT structure should still be valid after calling this function.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetProperty, L_PntSetTransformation, L_PntSetClipRgn, L_PntSetMetrics, L_PntGetProperty, L_PntGetTransformation, L_PntGetClipRgn
Topics: | Painting Text
 | DigitalPaint Functions: Painting Shapes and Text

Example

L_INT TextTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
PAINTTEXT text ;
RECT rcText ;
LOGFONT lf ;
HFONT hFont ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/* Set the required text font properties */
lf.lfHeight = 48 ;
lf.lfWidth = 0 ;
lf.lfEscapement = 0 ;
lf.lfOrientation = 0 ;
lf.lfWeight = FW_NORMAL ;
lf.lfItalic = FALSE ;
lf.lfUnderline = FALSE ;
lf.lfStrikeOut = FALSE ;
lf.lfCharSet = ANSI_CHARSET ;
lf.lfOutPrecision = OUT_DEFAULT_PRECIS ;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS ;
lf.lfQuality = DEFAULT_QUALITY ;
lf.lfPitchAndFamily = FF_DONTCARE ;
lstrcpy(lf.lfFaceName, TEXT("Times New Roman"));

/* Create the desired text font */
hFont = CreateFontIndirect ( &lf ) ;

/* Get text properties */
L_PntGetProperty ( pPaint, PAINT_GROUP_TEXT, &text ) ;

/* Set the desired text properties */
text.nSize = sizeof ( PAINTTEXT ) ;
text.dwMask = PTF_TEXT | PTF_FONT | PTF_TRANSFORMINFO ;
text.pszText = TEXT("LEAD") ;
text.hFont = hFont ;
text.TransformInfo.Scale.cx = 100 ;
text.TransformInfo.Scale.cy = 100 ;
text.TransformInfo.nRotate = 45 ;

/* Set the new text properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_TEXT, &text ) ;

/* Set the target text drawing box coordinates with respect to the DC dimensions */
SetRect ( &rcText, 10, 10, 200, 200 ) ;

/* Use the current text properties and the current transformations properties to draw the text to the DC (hDC) */
L_PntApplyText ( pPaint, hDC, &rcText ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/* Delete the font object */
DeleteObject ( hFont ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntBrushLineTo

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntBrushLineTo(pPaint, UserDC, nX, nY)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
L_INT nX; | /* x position */
L_INT nY; | /* y position */

Draws a paintbrush stroke from the current position to the specified point.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
nX | Specifies the x-coordinate of the new position.
nY | Specifies the y-coordinate of the new position.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The current position, which serves as the starting point for this function, is set using the L_PntBrushMoveTo function. If L_PntBrushMoveTo is not been called before L_PntBrushLineTo, the default starting point is (0, 0).

The paintbrush stroke will be drawn using the current paintbrush properties. To determine the current paintbrush properties, call L_PntGetProperty. To set or change the current shape properties, call L_PntSetProperty. For more information on the shape properties, refer to the PAINTBRUSH structure.

If UserDC is not NULL, the toolkit will paint the paintbrush stroke on the specified device context. If UserDC is NULL, the paintbrush stroke will not be painted on a device context.

If a bitmap has been set using the L_PntSetMetrics function, the paintbrush stroke will be drawn on the specified bitmap. If UserDC is not NULL and a bitmap has been set using the L_PntSetMetrics function, then the paintbrush stroke will be drawn to both the device context and the bitmap.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetProperty, L_PntSetTransformation, L_PntSetClipRgn, L_PntSetMetrics, L_PntGetProperty, L_PntGetTransformation, L_PntGetClipRgn, L_PntBrushMoveTo
Topics: | DigitalPaint Functions: Painting Shapes and Text
 | Painting with a Brush

Example

For an example, refer to L_PntBrushMoveTo.


L_PntBrushMoveTo

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntBrushMoveTo(pPaint, UserDC, nX, nY)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
L_INT nX; | /* x position */
L_INT nY; | /* y position */

Updates the current position of the paintbrush and paints a single brush touch.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
nX | Specifies the x-coordinate of the new position.
nY | Specifies the y-coordinate of the new position.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The paintbrush touch will be drawn using the current paintbrush properties. To determine the current paintbrush properties, call L_PntGetProperty. To set or change the current paintbrush properties, call L_PntSetProperty. For more information on the paintbrush properties, refer to the PAINTBRUSH structure.

If UserDC is not NULL, the toolkit will paint the paintbrush touch on the specified device context. If UserDC is NULL, the paintbrush touch will not be painted on a device context.

If a bitmap has been set using the L_PntSetMetrics function, the paintbrush touch will be drawn on the specified bitmap. If UserDC is not NULL and a bitmap has been set using the L_PntSetMetrics function, then the paintbrush touch will be drawn to both the device context and the bitmap.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetProperty, L_PntSetTransformation, L_PntSetClipRgn, L_PntSetMetrics, L_PntGetProperty, L_PntGetTransformation, L_PntGetClipRgn, L_PntBrushLineTo
Topics: | DigitalPaint Functions: Painting Shapes and Text
 | Painting with a Brush

Example

L_INT PaintbrushTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC     hDC;
PAINTBRUSH   brush;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/* Get the current paintbrush properties */
L_PntGetProperty ( pPaint, PAINT_GROUP_BRUSH, &brush ) ;

/* Set the required paintbrush properties */
brush.nSize  = sizeof ( PAINTBRUSH ) ;
brush.dwMask = PBF_DIAMETER | PBF_TOUCH |
 PBF_SPACING ;
brush.nDiameter     = 20 ;
brush.Touch.crColor = RGB ( 255, 0, 0 ) ;
brush.nSpacing      = 25 ;

/* Set the new paintbruch properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_BRUSH, &brush ) ;

/* Use the current paintbruch properties to draw a paintbruch strock to DC (hDC) */
L_PntBrushMoveTo ( pPaint, hDC, 10, 10 ) ;
L_PntBrushLineTo ( pPaint, hDC, 100, 100 ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntDlgBrush

#include "ltpdg.h"

L_INT EXT_FUNCTION L_PntDlgBrush(hWnd, pBrushDlgInfo)

HWND hWnd; | /*owner of the dialog */
pPAINTDLGBRUSHINFO pBrushDlgInfo; | /* pointer to a structure */

Brings up the paintbrush properties dialog box.

Parameter | Description
hWnd | Handle of the window that owns the dialog.
pBrushDlgInfo | Pointer to a PAINTDLGBRUSHINFO structure that contains paintbrush information. The values present in pBrushDlgInfo when the function is called are used to initialize the dialog, if PAINT_DLG_BRUSH_INITUSEDEFAULT is not set in the dwFlags member of pBrushDlgInfo. When this function returns, this parameter is updated with the values entered through the dialog.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTPDG

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetProperty, L_PntGetProperty, L_PntBrushLineTo, L_PntBrushMoveTo
Topics: | DigitalPaint Functions: DigitalPaint Common Dialogs
 | Using the DigitalPaint Common Dialogs

Example

// This example will display the brush common dialog

L_TCHAR * g_ppszTouchImage [ ] = { TEXT("Image 0"), TEXT("Image 1"), TEXT("Image 2"), TEXT("Image 3"), TEXT("Image 4") } ;
PAINTDLGBRUSHINFO g_DlgBrushInfo ;

L_VOID BrushDlgTest ( HWND hWnd, L_BOOL fUseDef )
{
if ( fUseDef == TRUE )
{
g_DlgBrushInfo.dwFlags = PAINT_DLG_BRUSH_INITUSEDEFAULT | PAINT_DLG_BRUSH_SHOWALL ;
}
else
{
g_DlgBrushInfo.nSize = sizeof ( PAINTDLGBRUSHINFO ) ;
g_DlgBrushInfo.dwFlags = PAINT_DLG_BRUSH_SHOWTOUCHCONTENT |
PAINT_DLG_BRUSH_SHOWTOUCHCOLOR |
PAINT_DLG_BRUSH_SHOWTOUCHIMAGE |
PAINT_DLG_BRUSH_SHOWDIAMETER |
PAINT_DLG_BRUSH_SHOWHARDNESS |
PAINT_DLG_BRUSH_SHOWSPACING |
PAINT_DLG_BRUSH_SHOWOPACITY |
PAINT_DLG_BRUSH_SHOWDEFAULT;

g_DlgBrushInfo.pszTitle = TEXT("Lead Brush Common Dialog ") ;
g_DlgBrushInfo.nContentsType = PAINT_TOUCH_CONTENTS_COLOR;
g_DlgBrushInfo.crColor = RGB ( 255, 0, 0 ) ;
g_DlgBrushInfo.ppszTouchImage = g_ppszTouchImage ;
g_DlgBrushInfo.uTouchImageCount = 5 ;
g_DlgBrushInfo.nActiveTouchImageItem = 1 ;
g_DlgBrushInfo.crTransparentColor = RGB(0, 0, 0) ;
g_DlgBrushInfo.nDiameter = 15 ;
g_DlgBrushInfo.nHardnessValue = 75 ;
g_DlgBrushInfo.nSpacing = 10 ;
g_DlgBrushInfo.nOpacity = 10 ;

}
L_PntDlgBrush ( hWnd, &g_DlgBrushInfo ) ;

return ;

}


L_PntDlgFill

#include "ltpdg.h"

L_INT EXT_FUNCTION L_PntDlgFill(hWnd, pFillDlgInfo)

HWND hWnd; | /*owner of the dialog */
pPAINTDLGFILLINFO pFillDlgInfo; | /* pointer to a structure */

Brings up the fill properties dialog box.

Parameter | Description
hWnd | Handle of the window that owns the dialog.
pFillDlgInfo | Pointer to a PAINTDLGFILLINFO structure that contains fill information. The values present in pFillDlgInfo when the function is called are used to initialize the dialog, if PAINT_DLG_FILL_INITUSEDEFAULT is not set in the dwFlags member of pFillDlgInfo. When this function returns, this parameter is updated with the values entered through the dialog.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTPDG

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetProperty, L_PntGetProperty, L_PntFillBorder, L_PntFillColorReplace, L_PntFillSurface
Topics: | DigitalPaint Functions: DigitalPaint Common Dialogs
 | Using the DigitalPaint Common Dialogs

Example

// This example will display the Fill common dialog

L_TCHAR * g_ppszPaperTexture [ ] = { TEXT("Paper 0"), TEXT("Paper 1"), TEXT("Paper 2"),
TEXT("Paper 3"), TEXT("Paper 4"), TEXT("Paper 5")
} ;

L_TCHAR * g_ppszBackgroundTileBitmap [ ] = { TEXT("Tile 0"), TEXT("Tile 1"), TEXT("Tile 2"),
TEXT("Tile 3"), TEXT("Tile 4"), TEXT("Tile 5")
};
PAINTDLGFILLINFO g_DlgFillInfo ;

L_VOID FillDlgTest ( HWND hWnd, L_BOOL fUseDef )
{
if ( fUseDef == TRUE )
{
g_DlgFillInfo.dwFlags = PAINT_DLG_FILL_INITUSEDEFAULT | PAINT_DLG_FILL_SHOWALL ;
}
else
{
g_DlgFillInfo.nSize = sizeof ( PAINTDLGFILLINFO ) ;
g_DlgFillInfo.dwFlags = PAINT_DLG_FILL_SHOWSTYLE |
PAINT_DLG_FILL_SHOWSOLIDFILLCOLOR |
PAINT_DLG_FILL_SHOWBKGRNDTILE |
PAINT_DLG_FILL_SHOWGRADIENTSTYLE |
PAINT_DLG_FILL_SHOWGRADIENTDIRECTION |
PAINT_DLG_FILL_SHOWGRADIENTPREVIEW |
PAINT_DLG_FILL_SHOWGRADIENTSTARTCOLOR |
PAINT_DLG_FILL_SHOWGRADIENTENDCOLOR |
PAINT_DLG_FILL_SHOWGRADIENTSTEPS |
PAINT_DLG_FILL_SHOWTEXTURE |
PAINT_DLG_FILL_SHOWDEFAULT;

g_DlgFillInfo.pszTitle = TEXT("Lead Fill Common Dialog ") ;
g_DlgFillInfo.nStyle = PAINT_FILL_STYLE_GRADIENT ;
g_DlgFillInfo.crSolidFillColor = RGB ( 255, 0, 0 ) ;
g_DlgFillInfo.ppszBackgroundTileBitmap = g_ppszBackgroundTileBitmap ;
g_DlgFillInfo.uBackgroundTileBitmapCount = 6;
g_DlgFillInfo.nActiveBackgroundTileBitmapItem = 1 ;
g_DlgFillInfo.nGradientStyle = PAINT_FILL_GRADIENT_STYLE_CONE_FROM_L;
g_DlgFillInfo.crGradientStartColor = RGB ( 255, 0, 0 ) ;
g_DlgFillInfo.crGradientEndColor = RGB ( 0, 0, 255 ) ;
g_DlgFillInfo.uGradientSteps = 200 ;
g_DlgFillInfo.ppszPaperTexture = g_ppszPaperTexture ;
g_DlgFillInfo.uPaperTextureCount = 6 ;
g_DlgFillInfo.nActivePaperTextureItem = -1 ;
}

L_PntDlgFill ( hWnd, &g_DlgFillInfo ) ;

return ;
}


L_PntDlgRegion

#include "ltpdg.h"

L_INT EXT_FUNCTION L_PntDlgRegion(hWnd, pRegionDlgInfo)

HWND hWnd; | /*owner of the dialog */
pPAINTDLGREGIONINFO pRegionDlgInfo; | /* pointer to a structure */

Brings up the region properties dialog box.

Parameter | Description
hWnd | Handle of the window that owns the dialog.
pRegionDlgInfo | Pointer to a PAINTDLGREGIONINFO structure that contains region information. The values present in pRegionDlgInfo when the function is called are used to initialize the dialog, if PAINT_DLG_REGION_INITUSEDEFAULT is not set in the dwFlags member of pRegionDlgInfo. When this function returns, this parameter is updated with the values entered through the dialog.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTPDG

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntGetProperty, L_PntSetProperty, L_PntRegionBorder, L_PntRegionColor, L_PntRegionEllipse, L_PntRegionPolygon, L_PntRegionRect, L_PntRegionRoundRect, L_PntRegionScale, L_PntRegionSurface, L_PntRegionTranslate
Topics: | DigitalPaint Functions: DigitalPaint Common Dialogs
 | Using the DigitalPaint Common Dialogs

Example

// This example will display the Region common dialog

PAINTDLGREGIONINFO g_DlgRegionInfo ;

L_VOID RegionDlgTest ( HWND hWnd, L_BOOL fUseDef )
{

if ( fUseDef == TRUE )
{
g_DlgRegionInfo.dwFlags = PAINT_DLG_REGION_SHOWALL | PAINT_DLG_REGION_INITUSEDEFAULT ;
}
else
{
g_DlgRegionInfo.nSize = sizeof ( PAINTDLGREGIONINFO ) ;
g_DlgRegionInfo.dwFlags = PAINT_DLG_REGION_SHOWLOWERTOLERANCE |
PAINT_DLG_REGION_SHOWUPPERTOLERANCE |
PAINT_DLG_REGION_SHOWELLIPSEWIDTH |
PAINT_DLG_REGION_SHOWELLIPSEHEIGHT ;

g_DlgRegionInfo.pszTitle = TEXT("Lead Region Common Dialog ") ;
g_DlgRegionInfo.crLowerTolerance = RGB ( 10, 10, 10 ) ;
g_DlgRegionInfo.crUpperTolerance = RGB ( 10, 10, 10 ) ;
g_DlgRegionInfo.nRoundRectEllipseWidth = 20 ;
g_DlgRegionInfo.nRoundRectEllipseHeight = 20 ;
}

L_PntDlgRegion ( hWnd, &g_DlgRegionInfo ) ;

return ;
}


L_PntDlgShape

#include "ltpdg.h"

L_INT EXT_FUNCTION L_PntDlgShape( hWnd, pShapeDlgInfo )

HWND hWnd; | /*owner of the dialog */
pPAINTDLGSHAPEINFO pShapeDlgInfo; | /* pointer to a structure */

Brings up the shape properties dialog box.

Parameter | Description
hWnd | Handle of the window that owns the dialog.
pShapeDlgInfo | Pointer to a PAINTDLGSHAPEINFO structure that contains shape information. The values present in pShapeDlgInfo when the function is called are used to initialize the dialog, if PAINT_DLG_SHAPE_INITUSEDEFAULT is not set in the dwFlags member of pShapeDlgInfo. When this function returns, this parameter is updated with the values entered through the dialog.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTPDG

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntGetProperty, L_PntSetProperty, L_PntDrawShapeEllipse, L_PntDrawShapeLine, L_PntDrawShapePolyBezier, L_PntDrawShapePolygon, L_PntDrawShapeRectangle, L_PntDrawShapeRoundRect
Topics: | DigitalPaint Functions: DigitalPaint Common Dialogs
 | Using the DigitalPaint Common Dialogs

Example

// This example will display the Shape common dialog

L_TCHAR * g_ppszPaperTexture [ ] = { TEXT("Paper 0"), TEXT("Paper 1"), TEXT("Paper 2"),
TEXT("Paper 3"), TEXT("Paper 4"), TEXT("Paper 5") } ;

PAINTDLGSHAPEINFO g_DlgShapeInfo ;

L_VOID ShapeDlgTest ( HWND hWnd, L_BOOL fUseDef )
{
if ( fUseDef == TRUE )
{
g_DlgShapeInfo.dwFlags = PAINT_DLG_SHAPE_INITUSEDEFAULT | PAINT_DLG_SHAPE_SHOWALL ;
}
else
{
g_DlgShapeInfo.nSize = sizeof ( PAINTDLGSHAPEINFO ) ;
g_DlgShapeInfo.dwFlags = PAINT_DLG_SHAPE_SHOWBKGRNDSTYLE |
PAINT_DLG_SHAPE_SHOWBKOPAQUECOLOR |
PAINT_DLG_SHAPE_SHOWBORDERSTYLE |
PAINT_DLG_SHAPE_SHOWBORDERWIDTH |
PAINT_DLG_SHAPE_SHOWBORDERBRUSHSTYLE |
PAINT_DLG_SHAPE_SHOWBORDERCOLOR |

PAINT_DLG_SHAPE_SHOWGRADIENTSTYLE |
PAINT_DLG_SHAPE_SHOWGRADIENTDIRECTION |
PAINT_DLG_SHAPE_SHOWGRADIENTSTARTCOLOR|
PAINT_DLG_SHAPE_SHOWGRADIENTENDCOLOR |
PAINT_DLG_SHAPE_SHOWGRADIENTPREVIEW |
PAINT_DLG_SHAPE_SHOWGRADIENTSTEPS |
PAINT_DLG_SHAPE_SHOWENDCAP |
PAINT_DLG_SHAPE_SHOWELLIPSEWIDTH |
PAINT_DLG_SHAPE_SHOWELLIPSEHEIGHT |
PAINT_DLG_SHAPE_SHOWOPACITY |
PAINT_DLG_SHAPE_SHOWTEXTURE |
PAINT_DLG_SHAPE_SHOWDEFAULT;

g_DlgShapeInfo.pszTitle = TEXT("Lead Shape Common Dialog ") ;
g_DlgShapeInfo.nBackgroundStyle = PAINT_SHAPE_BACK_STYLE_GRADIENT ;
g_DlgShapeInfo.crBackgroundColor = RGB ( 255, 0, 0 ) ;
g_DlgShapeInfo.nBorderStyle = PAINT_SHAPE_BORDER_STYLE_DOT;
g_DlgShapeInfo.nBorderWidth = 10;
g_DlgShapeInfo.nBorderBrushStyle = PAINT_SHAPE_BORDER_BRUSH_STYLE_COLOR ;
g_DlgShapeInfo.crBorderColor = RGB ( 0, 255, 0 ) ;

g_DlgShapeInfo.nGradientStyle = PAINT_SHAPE_GRADIENT_STYLE_RECTANGLE_FROM_C;
g_DlgShapeInfo.crGradientStartColor = RGB ( 255, 0, 0 ) ;
g_DlgShapeInfo.crGradientEndColor = RGB ( 0, 0, 255 ) ;
g_DlgShapeInfo.uGradientSteps = 200 ;
g_DlgShapeInfo.nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_FLAT ;
g_DlgShapeInfo.nRoundRectEllipseWidth = 10 ;
g_DlgShapeInfo.nRoundRectEllipseHeight = 10 ;
g_DlgShapeInfo.nOpacity = 10;
g_DlgShapeInfo.ppszPaperTexture = g_ppszPaperTexture ;
g_DlgShapeInfo.uPaperTextureCount = 6;
g_DlgShapeInfo.nActivePaperTextureItem = 3;
}
L_PntDlgShape ( hWnd, &g_DlgShapeInfo ) ;
return ;
}


L_PntDlgText

#include "ltpdg.h"

L_INT EXT_FUNCTION L_PntDlgText(hWnd, pTextDlgInfo)

HWND hWnd; | /*owner of the dialog */
pPAINTDLGTEXTINFO pTextDlgInfo; | /* pointer to a structure */

Brings up the text properties dialog box.

Parameter | Description
hWnd | Handle of the window that owns the dialog.
pTextDlgInfo | Pointer to a PAINTDLGTEXTINFO structure that contains text information. The values present in pTextDlgInfo when the function is called are used to initialize the dialog, if PAINT_DLG_TEXT_INITUSEDEFAULT is not set in the dwFlags member of pTextDlgInfo. When this function returns, this parameter is updated with the values entered through the dialog.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTPDG

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntGetProperty, L_PntSetProperty, L_PntApplyText
Topics: | DigitalPaint Functions: DigitalPaint Common Dialogs
 | Using the DigitalPaint Common Dialogs

Example

// This example will display the Text common dialog

L_TCHAR * g_ppszBackgroundTileBitmap [ ] = { TEXT("Tile 0"), TEXT("Tile 1"), TEXT("Tile 2"),
TEXT("Tile 3"), TEXT("Tile 4"), TEXT("Tile 5") };

PAINTDLGTEXTINFO g_DlgTextInfo ;

L_VOID TextDlgTest ( HWND hWnd, L_BOOL fUseDef )
{
LOGFONT lf ;
PAINTTRANSFORM Painttransform ;
if ( fUseDef == TRUE )
{
g_DlgTextInfo.dwFlags = PAINT_DLG_TEXT_INITUSEDEFAULT | PAINT_DLG_TEXT_SHOWALL ;
}
else
{
lf.lfHeight = 48;
lf.lfWidth = 0 ;
lf.lfEscapement = 0 ;
lf.lfOrientation = 0 ;
lf.lfWeight = FW_NORMAL ;
lf.lfItalic = FALSE ;
lf.lfUnderline = FALSE ;
lf.lfStrikeOut = FALSE ;
lf.lfCharSet = ANSI_CHARSET ;
lf.lfOutPrecision = OUT_DEFAULT_PRECIS ;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS ;
lf.lfQuality = DEFAULT_QUALITY ;
lf.lfPitchAndFamily = FF_DONTCARE ;
lstrcpy(lf.lfFaceName, TEXT("Times New Roman") ) ;

Painttransform.nRotate = 45 ;
Painttransform.Scale.cx = 200 ;
Painttransform.Scale.cy = 200 ;

g_DlgTextInfo.nSize = sizeof ( PAINTDLGTEXTINFO ) ;
g_DlgTextInfo.dwFlags = PAINT_DLG_TEXT_SHOWTEXT |
PAINT_DLG_TEXT_SHOWBKGRNDSTYLE |
PAINT_DLG_TEXT_SHOWBKGRNDOPAQUECOLOR |
PAINT_DLG_TEXT_SHOWBKGRNDTILE |
PAINT_DLG_TEXT_SHOWBORDERWIDTH |
PAINT_DLG_TEXT_SHOWBORDERCOLOR |
PAINT_DLG_TEXT_SHOWHORZALIGNMENT |
PAINT_DLG_TEXT_SHOWVERTALIGNMENT |
PAINT_DLG_TEXT_SHOWROTATE |
PAINT_DLG_TEXT_SHOWSCALE |
PAINT_DLG_TEXT_SHOWTRUETYPEFONT |
PAINT_DLG_TEXT_SHOWOPACITY |
PAINT_DLG_TEXT_SHOWDEFAULT;

g_DlgTextInfo.pszTitle = TEXT("Lead Text Common Dialog ") ;
g_DlgTextInfo.pszText = TEXT("Test Test Test");
g_DlgTextInfo.logFont = lf ;

g_DlgTextInfo.nBorderWidth = 10 ;
g_DlgTextInfo.crBorderColor = RGB ( 0, 0, 255 ) ;
g_DlgTextInfo.nBackgroundStyle = PAINT_TEXT_BACK_STYLE_TILEDIMAGE ;
g_DlgTextInfo.crBackgroundColor = RGB ( 255, 0, 0 ) ;
g_DlgTextInfo.ppszBackgroundTileBitmap = g_ppszBackgroundTileBitmap ;
g_DlgTextInfo.uBackgroundTileBitmapCount = 6 ;
g_DlgTextInfo.nActiveBackgroundTileBitmapItem= 2 ;
g_DlgTextInfo.nAlignment = ( PAINTALIGNMENT ) ( PAINT_ALIGNMENT_RIGHT | PAINT_ALIGNMENT_VCENTER ) ;
g_DlgTextInfo.nOpacity = 10 ;
g_DlgTextInfo.TransformInfo = Painttransform ;
}

L_PntDlgText ( hWnd, &g_DlgTextInfo ) ;

return ;

}


L_PntDrawShapeEllipse

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntDrawShapeEllipse(pPaint, UserDC, prcRect)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
LPRECT prcRect; | /* pointer to a RECT structure */

Draws an ellipse using the specified points.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
prcRect | Pointer to a RECT structure that specifies the ellipse’s bounding rectangle.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The ellipse will be drawn using the current shape properties. To determine the current shape properties, call L_PntGetProperty. To set or change the current shape properties, call L_PntSetProperty. For more information on the shape properties, refer to the PAINTSHAPE structure.

If UserDC is not NULL, the toolkit will paint the ellipse on the specified device context. If UserDC is NULL, the ellipse will not be painted on a device context.

If a bitmap has been set using the L_PntSetMetrics function, the ellipse will be drawn on the specified bitmap. If UserDC is not NULL and a bitmap has been set using the L_PntSetMetrics function, then the ellipse will be drawn to both the device context and the bitmap.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntGetProperty, L_PntSetProperty, L_PntSetTransformation, L_PntGetTransformation, L_PntGetClipRgn, L_PntSetClipRgn, L_PntSetMetrics, L_PntDlgShape, L_PntDrawShapeLine, L_PntDrawShapePolyBezier, L_PntDrawShapePolygon, L_PntDrawShapeRectangle, L_PntDrawShapeRoundRect
Topics: | DigitalPaint Functions: Painting Shapes and Text
 | Painting a Shape

Example

L_INT DrawEllipseTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC;
PAINTSHAPE shape;
RECT rcShape;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/* Get the current shape properties */
L_PntGetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Set the required shape properties */
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERWIDTH |
PSF_BORDERSTYLE |
PSF_BORDERCOLOR |
PSF_BORDERENDCAP |
PSF_BACKGROUNDCOLOR ;

shape.nBorderWidth = 8 ;
shape.nBorderStyle = PAINT_SHAPE_BORDER_STYLE_DOT ;
shape.crBorderColor = RGB ( 255, 0, 255 ) ;
shape.nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_ROUND ;
shape.crBackgroundColor = RGB ( 255, 255, 0 ) ;

/* Set the new shape properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Set the coordinates with respect to the DC dimensions*/
SetRect ( &rcShape, 10, 10, 210, 210 ) ;

/* Use the current shape properties to draw an ellipse to the DC (hDC) */
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntDrawShapeLine

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntDrawShapeLine(pPaint, UserDC, nStartX, nStartY, nEndX, nEndY)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
L_INT nStartX; | /* x-coordinate of the start point */
L_INT nStartY; | /* y-coordinate of the start point */
L_INT nEndX; | /* x-coordinate of the end point */
L_INT nEndY; | /* y-coordinate of the end point */

Draws a line between the specified points.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
nStartX | Specifies the x-coordinate of the start position.
nStartY | Specifies the y-coordinate of the start position.
nEndX | Specifies the x-coordinate of the end position.
nEndY | Specifies the y-coordinate of the end position.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The line will be drawn using the current shape properties. To determine the current shape properties, call L_PntGetProperty. To set or change the current shape properties, call L_PntSetProperty. For more information on the shape properties, refer to the PAINTSHAPE structure.

If UserDC is not NULL, the toolkit will paint the line on the specified device context. If UserDC is NULL, the line will not be painted on a device context.

If a bitmap has been set using the L_PntSetMetrics function, the line will be drawn on the specified bitmap. If UserDC is not NULL and a bitmap has been set using the L_PntSetMetrics function, then the line will be drawn to both the device context and the bitmap.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntGetProperty, L_PntSetProperty, L_PntSetTransformation, L_PntGetTransformation, L_PntGetClipRgn, L_PntSetClipRgn, L_PntSetMetrics, L_PntDlgShape, L_PntDrawShapeEllipse, L_PntDrawShapePolyBezier, L_PntDrawShapePolygon, L_PntDrawShapeRectangle, L_PntDrawShapeRoundRect
Topics: | DigitalPaint Functions: Painting Shapes and Text
 | Painting a Shape

Example

L_INT DrawLineTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC;
PAINTSHAPE shape;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/* Get the current shape properties */
L_PntGetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Set the required shape properties */
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERWIDTH |
PSF_BORDERSTYLE |
PSF_BORDERCOLOR |
PSF_BORDERENDCAP ;
shape.nBorderWidth = 10 ;
shape.nBorderStyle = PAINT_SHAPE_BORDER_STYLE_DASHDOT ;
shape.crBorderColor = RGB ( 255, 0, 0 ) ;
shape.nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_ROUND ;

/* Set the new shape properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Use the current shape properties to draw a line to the DC (hDC) */
L_PntDrawShapeLine ( pPaint, hDC, 10, 10, 200, 200 ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntDrawShapePolyBezier

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntDrawShapePolyBezier(pPaint, UserDC, pptPoints, nCount)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
LPPOINT pptPoints; | /* pointer to an array of POINT structures */
L_INT nCount; | /* number of points */

Draws a polybezier using the specified points

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
pptPoints | Pointer to an array of POINT structures that contain the endpoints and control points of the curve(s).
nCount | Specifies the number of points in the pptPoints array. This value must be one more than three times the number of curves to be drawn, because each Bézier curve requires two control points and an endpoint, and the initial curve requires an additional starting point.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The Bézier curve(s) will be drawn using the current shape properties. To determine the current shape properties, call L_PntGetProperty. To set or change the current shape properties, call L_PntSetProperty. For more information on the shape properties, refer to the PAINTSHAPE structure.

If UserDC is not NULL, the toolkit will paint the Bézier curve(s) on the specified device context. If UserDC is NULL, the Bézier curve(s) will not be painted on a device context.

If a bitmap has been set using the L_PntSetMetrics function, the Bézier curve(s) will be drawn on the specified bitmap. If UserDC is not NULL and a bitmap has been set using the L_PntSetMetrics function, then the Bézier curve(s) will be drawn to both the device context and the bitmap.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntGetProperty, L_PntSetProperty, L_PntSetTransformation, L_PntGetTransformation, L_PntGetClipRgn, L_PntSetClipRgn, L_PntSetMetrics, L_PntDlgShape, L_PntDrawShapeEllipse, L_PntDrawShapeLine, L_PntDrawShapePolygon, L_PntDrawShapeRectangle, L_PntDrawShapeRoundRect
Topics: | DigitalPaint Functions: Painting Shapes and Text
 | Painting a Shape

Example

L_INT DrawPolyBezierTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC;
PAINTSHAPE shape;
POINT ptPolyBezier [5];

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/* Get the current shape properties */
L_PntGetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Set the required shape properties */
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERWIDTH |
PSF_BORDERSTYLE |
PSF_BORDERCOLOR |
PSF_BORDERENDCAP |
PSF_BACKGROUNDCOLOR ;

shape.nBorderWidth = 2 ;
shape.nBorderStyle = PAINT_SHAPE_BORDER_STYLE_DASH ;
shape.crBorderColor = RGB ( 255, 0, 0 ) ;
shape.nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_FLAT ;
shape.crBackgroundColor = RGB ( 255, 255, 192 ) ;

/* set the new shape properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* set the coordinates with respect to the DC dimensions*/
ptPolyBezier [ 0 ].x = 10 ;
ptPolyBezier [ 0 ].y = 10 ;
ptPolyBezier [ 1 ].x = 150 ;
ptPolyBezier [ 1 ].y = 15 ;
ptPolyBezier [ 2 ].x = 100 ;
ptPolyBezier [ 2 ].y = 160 ;
ptPolyBezier [ 3 ].x = 70 ;
ptPolyBezier [ 3 ].y = 10;
ptPolyBezier [ 4 ].x = 20 ;
ptPolyBezier [ 4 ].y = 20 ;

/* Use the current shape properties to draw a polyBezier to the DC (hDC) */
L_PntDrawShapePolyBezier ( pPaint, hDC, ptPolyBezier, 4 ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntDrawShapePolygon

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntDrawShapePolygon(pPaint, UserDC, pptPoints, nCount)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
LPPOINT pptPoints; | /* pointer to an array of POINT structures */
L_INT nCount; | /* number of points */

Draws a polygon using the specified points.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
pptPoints | Pointer to an array of POINT structures that specify the vertices of the polygon.
nCount | Specifies the number of vertices in the array. This value must be greater than 2.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The polygon is closed automatically by drawing a line from the last vertex to the first.

The polygon will be drawn using the current shape properties. To determine the current shape properties, call L_PntGetProperty. To set or change the current shape properties, call L_PntSetProperty. For more information on the shape properties, refer to the PAINTSHAPE structure.

If UserDC is not NULL, the toolkit will paint the polygon on the specified device context. If UserDC is NULL, the polygon will not be painted on a device context.

If a bitmap has been set using the L_PntSetMetrics function, the polygon will be drawn on the specified bitmap. If UserDC is not NULL and a bitmap has been set using the L_PntSetMetrics function, then the polygon will be drawn to both the device context and the bitmap.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntGetProperty, L_PntSetProperty, L_PntSetTransformation, L_PntGetTransformation, L_PntGetClipRgn, L_PntSetClipRgn, L_PntSetMetrics, L_PntDlgShape, L_PntDrawShapeEllipse, L_PntDrawShapeLine, L_PntDrawShapePolyBezier, L_PntDrawShapeRectangle, L_PntDrawShapeRoundRect
Topics: | DigitalPaint Functions: Painting Shapes and Text
 | Painting a Shape

Example

L_INT DrawPolygonTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
PAINTSHAPE shape ;
POINT ptPolyPoints [ 5 ] ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/* Get the current shape properties */
L_PntGetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Set the required shape properties */
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERWIDTH |
PSF_BORDERCOLOR |
PSF_BACKGROUNDCOLOR ;

shape.nBorderWidth = 2 ;
shape.crBorderColor = RGB ( 255, 0, 0 ) ;
shape.crBackgroundColor = RGB ( 255, 255, 192 ) ;

/* Set the new shape properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* set the coordinates with respect to the DC dimensions*/
ptPolyPoints [ 0 ].x = 10 ;
ptPolyPoints [ 0 ].y = 10 ;
ptPolyPoints [ 1 ].x = 50 ;
ptPolyPoints [ 1 ].y = 15 ;
ptPolyPoints [ 2 ].x = 100 ;
ptPolyPoints [ 2 ].y = 160 ;
ptPolyPoints [ 3 ].x = 100 ;
ptPolyPoints [ 3 ].y = 100;
ptPolyPoints [ 4 ].x = 20 ;
ptPolyPoints [ 4 ].y = 60 ;

/* Use the current shape properties to draw a polygon to the DC (hDC) */
L_PntDrawShapePolygon ( pPaint, hDC, ptPolyPoints, 5 ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntDrawShapeRectangle

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntDrawShapeRectangle(pPaint, UserDC, prcRect)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
LPRECT prcRect; | /* pointer to a RECT structure */

Draws a rectangle using the specified points.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
prcRect | Pointer to a RECT structure that specifies the rectangle.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The rectangle will be drawn using the current shape properties. To determine the current shape properties, call L_PntGetProperty. To set or change the current shape properties, call L_PntSetProperty. For more information on the shape properties, refer to the PAINTSHAPE structure.

If UserDC is not NULL, the toolkit will paint the rectangle on the specified device context. If UserDC is NULL, the rectangle will not be painted on a device context.

If a bitmap has been set using the L_PntSetMetrics function, the rectangle will be drawn on the specified bitmap. If UserDC is not NULL and a bitmap has been set using the L_PntSetMetrics function, then the rectangle will be drawn to both the device context and the bitmap.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntGetProperty, L_PntSetProperty, L_PntSetTransformation, L_PntGetTransformation, L_PntGetClipRgn, L_PntSetClipRgn, L_PntSetMetrics, L_PntDlgShape, L_PntDrawShapeEllipse, L_PntDrawShapeLine, L_PntDrawShapePolyBezier, L_PntDrawShapePolygon, L_PntDrawShapeRoundRect
Topics: | DigitalPaint Functions: Painting Shapes and Text
 | Painting a Shape

Example

L_INT DrawRectangleTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
PAINTSHAPE shape ;
RECT rcShape ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/* Get the current shape properties */
L_PntGetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Set the required shape properties */
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERWIDTH |
PSF_BORDERSTYLE |
PSF_BORDERCOLOR |
PSF_BORDERENDCAP ;
shape.nBorderWidth = 5 ;
shape.nBorderStyle = PAINT_SHAPE_BORDER_STYLE_DASH ;
shape.crBorderColor = RGB ( 255, 0, 0 ) ;
shape.nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_FLAT ;

/* Set the new shape properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Set the rectangle coordinates with respect to the DC dimensions*/
SetRect ( &rcShape, 10, 10, 100, 100 ) ;

/* Use the current shape properties to draw a rectangle to the DC (hDC) */
L_PntDrawShapeRectangle ( pPaint, hDC, &rcShape ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntDrawShapeRoundRect

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntDrawShapeRoundRect(pPaint, UserDC, prcRect)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
LPRECT prcRect; | /* pointer to a RECT structure */

Draws a rounded rectangle using the specified points.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
prcRect | Pointer to a RECT structure that specifies the rounded rectangle to be drawn.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The rounded rectangle will be drawn using the current shape properties. To determine the current shape properties, call L_PntGetProperty. To set or change the current shape properties, call L_PntSetProperty. For more information on the shape properties, refer to the PAINTSHAPE structure.

If UserDC is not NULL, the toolkit will paint the rounded rectangle on the specified device context. If UserDC is NULL, the rounded rectangle will not be painted on a device context.

If a bitmap has been set using the L_PntSetMetrics function, the rounded rectangle will be drawn on the specified bitmap. If UserDC is not NULL and a bitmap has been set using the L_PntSetMetrics function, then the rounded rectangle will be drawn to both the device context and the bitmap.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntGetProperty, L_PntSetProperty, L_PntSetTransformation, L_PntGetTransformation, L_PntGetClipRgn, L_PntSetClipRgn, L_PntSetMetrics, L_PntDlgShape, L_PntDrawShapeEllipse, L_PntDrawShapeLine, L_PntDrawShapePolyBezier, L_PntDrawShapePolygon, L_PntDrawShapeRectangle
Topics: | DigitalPaint Functions: Painting Shapes and Text
 | Painting a Shape

Example

L_INT DrawRoundedRectTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC;
PAINTSHAPE shape;
RECT rcShape;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/* Get the current shape properties */
L_PntGetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Set the required shape properties */
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERWIDTH |
PSF_BORDERSTYLE |
PSF_BORDERCOLOR |
PSF_BORDERENDCAP |
PSF_ROUNDRECTELLIPSEWIDTH |
PSF_ROUNDRECTELLIPSEHEIGHT ;

shape.nBorderWidth = 5 ;
shape.nBorderStyle = PAINT_SHAPE_BORDER_STYLE_DASH ;
shape.crBorderColor = RGB ( 255, 0, 0 ) ;
shape.nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_FLAT ;
shape.nRoundRectEllipseWidth = 30 ;
shape.nRoundRectEllipseHeight = 30 ;

/* Set the new shape properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Set the rectangle coordinates with respect to the DC dimensions*/
SetRect ( &rcShape, 10, 10, 200, 200 ) ;

/* Use the current shape properties to draw a rounded rectangle to the DC (hDC) */
L_PntDrawShapeRoundRect ( pPaint, hDC, &rcShape ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntFillBorder

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntFillBorder(pPaint, UserDC, pptPoint, crBorderColor)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
LPPOINT pptPoint; | /* pointer to a POINT structure */
COLORREF crBorderColor; | /* border color */

Fills an area starting at a specified point and continuing in all directions until finding the specified color.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
pptPoint | Pointer to a POINT structure that the toolkit will use as a starting point to fill the area.
crBorderColor | The COLORREF value that specifies the color to use as the filling boundary.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The filling procedure will be carried out using the current fill properties. To determine the current fill properties, call L_PntGetProperty. To set or change the current fill properties, call L_PntSetProperty. For more information on the fill properties, refer to the PAINTFILL structure.

Within the PAINTFILL structure, upper and lower tolerance values can be set for the border color specified in crBorderColor. For example, if the border color passed to this function has an RGB value of 40, 40 , 200, and the lower tolerance and upper tolerance set in the PAINTFILL structure are 10, 10, 10, and 5, 5, 5, respectively, then this function will recognize colors from 30, 30, 190 to 45, 45, 205 as the border color.

If UserDC is not NULL, the toolkit will paint on the specified device context. If UserDC is NULL, the toolkit will not paint on a device context.

The images below show an example of the results of calling L_PntFillBorder.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetProperty, L_PntSetTransformation, L_PntSetClipRgn, L_PntSetMetrics, L_PntSetDCExtents, L_PntGetProperty, L_PntGetTransformation, L_PntGetClipRgn, L_PntGetDCExtents, L_PntFillColorReplace, L_PntFillSurface, L_PntDlgFill
Topics: | DigitalPaint Functions: Filling an Area
 | Filling an Area

Example

L_INT FillBorderTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
PAINTSHAPE shape ;
PAINTFILL fill ;
RECT rcShape ;
RECT rcDCExtents ;
POINT ptFill ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/* Set the required shape properties */
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERWIDTH |
PSF_BORDERCOLOR |
PSF_BACKGROUNDSTYLE ;
shape.nBorderWidth = 10 ;
shape.crBorderColor = RGB ( 255, 0, 0 ) ;
shape.nBackgroundStyle = PAINT_SHAPE_BACK_STYLE_GRADIENT ;

/* Set the new shape properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Set the coordinates with respect to the DC dimensions*/
SetRect ( &rcShape, 10, 10, 210, 110 ) ;

/* Use the current shape properties to draw an ellipse to the DC (hDC) */
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;

/* Set the fill start point */
ptFill.x = 100 ;
ptFill.y = 100 ;

/* Get the destination DC dimensions */
GetClientRect ( hWnd, &rcDCExtents ) ;

/* Set the toolkit user DC extents */
L_PntSetDCExtents ( pPaint, &rcDCExtents ) ;

/* Set the required fill properties */
fill.nSize = sizeof ( PAINTFILL ) ;
fill.dwMask = PFF_SOLIDFILLCOLOR ;
fill.crSolidFillColor = RGB ( 0, 192, 0 ) ;

/* Set the new fil properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_FILL, &fill ) ;

/* Fill the target area */
L_PntFillBorder ( pPaint, hDC, &ptFill, RGB ( 255, 0, 0 ) ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntFillColorReplace

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntFillColorReplace(pPaint, UserDC, crColor)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* device context */
COLORREF crColor; | /* the color to be replaced */

Replaces every pixel using the current fill settings.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
crColor | The COLORREF value that specifies the color to be replaced.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The filling procedure will be carried out using the current fill properties. To determine the current fill properties, call L_PntGetProperty. To set or change the current fill properties, call L_PntSetProperty. For more information on the fill properties, refer to the PAINTFILL structure.

Within the PAINTFILL structure, upper and lower tolerance values can be set for the color specified in crColor. For example, if the color passed to this function has an RGB value of 40, 40 , 200, and the lower tolerance and upper tolerance set in the PAINTFILL structure are 10, 10, 10, and 5, 5, 5, respectively, then this function will replace colors from 30, 30, 190 to 45, 45, 205.

The images below show an example of the results of calling L_PntFillColorReplace.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetProperty, L_PntSetTransformation, L_PntSetClipRgn, L_PntSetMetrics, L_PntSetDCExtents, L_PntGetProperty, L_PntGetTransformation, L_PntGetClipRgn, L_PntGetDCExtents, L_PntFillBorder, L_PntFillSurface, L_PntDlgFill
Topics: | DigitalPaint Functions: Filling an Area
 | Filling an Area

Example

L_INT FillColorReplaceTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
PAINTSHAPE shape ;
PAINTFILL fill ;
RECT rcShape ;
RECT rcDCExtents ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/* Set the required shape properties */
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERWIDTH |
PSF_BORDERCOLOR |
PSF_BACKGROUNDCOLOR ;

shape.nBorderWidth = 10 ;
shape.crBorderColor = RGB ( 255, 0, 0 ) ;
shape.crBackgroundColor = RGB ( 255, 0, 0 ) ;

/* Set the new shape properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Set the coordinates with respect to the DC dimensions */
SetRect ( &rcShape, 10, 10, 60, 60 ) ;

/* Use the current shape properties to draw an ellipse to the DC (hDC) */
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;

SetRect ( &rcShape, 100, 10, 150, 60 ) ;
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;

SetRect ( &rcShape, 60, 60, 95, 95 ) ;
L_PntDrawShapeRectangle ( pPaint, hDC, &rcShape ) ;

SetRect ( &rcShape, 10, 100, 60, 150 ) ;
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;

SetRect ( &rcShape, 100, 100, 150, 150 ) ;
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;

/* Get the destination DC dimensions */
GetClientRect ( hWnd, &rcDCExtents ) ;

/* Set the toolkit user DC extents */
L_PntSetDCExtents ( pPaint, &rcDCExtents ) ;

/* Set the required fill properties */
fill.nSize = sizeof ( PAINTFILL ) ;
fill.dwMask = PFF_STYLE ;
fill.nStyle = PAINT_FILL_STYLE_GRADIENT ;

/* Set the new fill properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_FILL, &fill ) ;

/* Fill the target area */
L_PntFillColorReplace ( pPaint, hDC, RGB ( 255, 0, 0 ) ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntFillSurface

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntFillSurface(pPaint, UserDC, pptPoint)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* device context */
LPPOINT pptPoint; | /* pointer to POINT structure */

Fills an area, starting at a specified point and continuing in all directions, that contains a specified color and some tolerance.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
pptPoint | Pointer to POINT structure that the toolkit will us as a starting point to fill the area. This point color will specify the surface color.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The filling procedure will be carried out using the current fill properties. To determine the current fill properties, call L_PntGetProperty. To set or change the current fill properties, call L_PntSetProperty. For more information on the fill properties, refer to the PAINTFILL structure.

Within the PAINTFILL structure, upper and lower tolerance values can be set for the border color specified in crBorderColor. For example, if the border color passed to this function has an RGB value of 40, 40 , 200, and the lower tolerance and upper tolerance set in the PAINTFILL structure are 10, 10, 10, and 5, 5, 5, respectively, then this function will recognize colors from 30, 30, 190 to 45, 45, 205 as the border color.

If UserDC is not NULL, the toolkit will paint on the specified device context. If UserDC is NULL, the toolkit will not paint on a device context.

The images below show an example of the results of calling L_PntFillSurface.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetProperty, L_PntSetTransformation, L_PntSetClipRgn, L_PntSetMetrics, L_PntSetDCExtents, L_PntGetProperty, L_PntGetTransformation, L_PntGetClipRgn, L_PntGetDCExtents, L_PntFillColorReplace, L_PntFillBorder, L_PntDlgFill
Topics: | DigitalPaint Functions: Filling an Area
 | Filling an Area

Example

L_INT FillSurfaceTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
PAINTSHAPE shape ;
RECT rcShape ;
RECT rcDCExtents ;
POINT ptFill ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/* Get the current shape properties */
L_PntGetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Set the required shape properties */
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERWIDTH |
PSF_BORDERSTYLE |
PSF_BORDERCOLOR |
PSF_BORDERENDCAP |
PSF_BACKGROUNDCOLOR ;

shape.nBorderWidth = 8 ;
shape.nBorderStyle = PAINT_SHAPE_BORDER_STYLE_DOT ;
shape.crBorderColor = RGB ( 255, 0, 255 ) ;
shape.nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_ROUND ;
shape.crBackgroundColor = RGB ( 255, 255, 0 ) ;

/* Set the new shape properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Set the coordinates with respect to the DC dimensions*/
SetRect ( &rcShape, 10, 10, 210, 210 ) ;

/* Use the current shape properties to draw an ellipse to the DC (hDC) */
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;

/* Set the fill start point */
ptFill.x = 100 ;
ptFill.y = 100 ;

/* Get the destination DC dimensions */
GetClientRect ( hWnd, &rcDCExtents ) ;

/* Set the toolkit user DC extents */
L_PntSetDCExtents ( pPaint, &rcDCExtents ) ;

/* Fill the target area */
L_PntFillSurface ( pPaint, hDC, &ptFill ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntFree

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntFree(pPaint)

pPAINTHANDLE pPaint;

/* pointer to a paint handle */

Frees the paint handle.

Parameter | Description
pPaint | Pointer to the paint handle to free.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function should be called when a paint handle is no longer needed by an application.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntInit, L_PntIsValid
Topics: | DigitalPaint Functions: Initializing and Freeing the Paint Handle
 | Initializing and Freeing DigitalPaint Handles

Example

For an example, refer to L_PntInit.


L_PntGetClipRgn

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntGetClipRgn(pPaint, phClipRgn)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
pHRGN phClipRgn; | /* pointer to a Windows region handle */

Gets the current clipping region, set using L_PntSetClipRgn.

Parameter | Description
pPaint | Pointer to a paint handle.
phClipRgn | Pointer to a Windows region handle to be updated with the current clipping region.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The phClipRgn parameter is updated with a windows region, which is a snapshot of the current clipping region, used by the toolkit. The user is responsible for deleting this region.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetClipRgn, L_PntOffsetClipRgn
Topics: | DigitalPaint Functions: Region Processing
 | Setting a DigitalPaint Clipping Region

Example

L_VOID GetClipRgnTest ( pPAINTHANDLE pPaint )
{
HRGN hRgn, hClipRgn ;

/* create some region */
hRgn = CreateRectRgn ( 0, 0, 100, 100 ) ;

/* get the current painting tools clip region */
L_PntGetClipRgn ( pPaint, &hClipRgn) ;

/* combine the regions */
CombineRgn ( hRgn, hClipRgn, hRgn, RGN_OR ) ;

/* set the painting tools new clip region */
L_PntSetClipRgn ( pPaint, hRgn) ;

/* delete the regions */
DeleteObject ( ( HRGN ) hRgn ) ;
DeleteObject ( ( HRGN ) hClipRgn ) ;
}


L_PntGetDCExtents

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntGetDCExtents(pPaint, prcRect)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
LPRECT prcRect; | /* pointer to a RECT structure */

Gets the current Device Context (DC) boundaries, set using the L_PntSetDCExtents function.

Parameter | Description
pPaint | Pointer to a paint handle.
prcRect | Pointer to a RECT structure to be updated with the current DC boundary information.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetDCExtents, L_PntGetTransformation, L_PntSetTransformation, L_PntSetMetrics, L_PntRegionSurface, L_PntRegionBorder, L_PntRegionColor, L_PntFillSurface, L_PntFillBorder, L_PntFillColorReplace, L_PntPickColor
Topics: | DigitalPaint Functions: Getting and Setting the DC Boundaries
 | Setting General DigitalPaint Information

Example

For an example, refer to L_PntSetDCExtents.


L_PntGetProperty

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntGetProperty(pPaint, nGroup, pProperty)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
PAINTGROUP nGroup; | /* type of paint properties */
L_VOID L_FAR * pProperty; | /* pointer to a PAINTXXXX structure */

Gets the specified paint properties.

Parameter | Description
pPaint | Pointer to a paint handle.
nGroup | Indicates the paint properties to get and the structure pointed to by pProperty. Possible values are:
 | Value | Meaning
 | PAINT4_GROUP_BRUSH | Get the Paintbrush properties. pProperty points to a PAINTBRUSH structure.
 | PAINT_GROUP_SHAPE | Get the Paint shape properties. pProperty points to a PAINTSHAPE structure.
 | PAINT_GROUP_REGION | Get the Paint region properties. pProperty points to a PAINTREGION structure.
 | PAINT_GROUP_FILL | Get the Paint fill properties. pProperty points to a PAINTFILL structure.
 | PAINT_GROUP_TEXT | Get the Paint fill properties. pProperty points to a PAINTTEXT structure.
pProperty | Pointer to a PAINTXXX structure to be updated with the specified property values. The type of structure that this parameter points to is indicated by the nGroup parameter.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

If this function is called after the paint handle is initialized, the default values will be returned. For more information about the default property values, refer to:

PAINTBRUSH

PAINTSHAPE

PAINTREGION

PAINTFILL

PAINTTEXT

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetProperty, L_PntDlgBrush, L_PntDlgFill, L_PntDlgRegion, L_PntDlgShape, L_PntDlgText, L_PntBrushLineTo, L_PntBrushMoveTo, L_PntApplyText, L_PntDrawShapeEllipse, L_PntDrawShapeLine, L_PntDrawShapePolyBezier, L_PntDrawShapePolygon, L_PntDrawShapeRectangle, L_PntDrawShapeRoundRect, L_PntRegionBorder, L_PntRegionColor, L_PntRegionEllipse, L_PntRegionPolygon, L_PntRegionRect, L_PntRegionRoundRect
Topics: | DigitalPaint Functions: Paint Properties
 | Setting DigitalPaint Properties

Example

/* This example shows the minimum requirements for painting a rectangle shape
using some user defined properties */
L_INT OnPaintShape ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
PAINTSHAPE shape ;
HDC hDC ;
RECT rcShapeRect ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/*Set the paint shape group properties */
L_PntGetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Do some check and chang 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 */
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;
}

/*Get the device context */
hDC = GetDC ( hWnd ) ;

/* Set the rectangle coordinates with respect to the DC dimensions*/
SetRect ( &rcShapeRect, 10, 10, 110, 110 ) ;

/* Use the current shape properties to draw an rectangle*/
L_PntDrawShapeRectangle ( pPaint, hDC, &rcShapeRect ) ;

/* Release the device context*/
ReleaseDC ( hWnd, hDC ) ;

// Free the paint tools handle.
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntGetTransformation

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntGetTransformation(pPaint, pXForm)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
pPAINTXFORM pXForm; | /* pointer to a structure */

Gets the current transformation information for the toolkit.

Parameter | Description
pPaint | Pointer to a paint handle.
pXForm | Pointer to a PAINTXFORM structure to be updated with the current painting transformations.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The transformation information is used for translating from external coordinates, such as mouse position, to the device context (DC) and/or bitmap coordinates.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetTransformation, L_PntGetDCExtents, L_PntSetDCExtents, L_PntSetMetrics
Topics: | DigitalPaint Functions: Transforming External Coordinates
 | Setting General DigitalPaint Information

Example

L_INT OnPaintShape ( pPAINTHANDLE pPaint, HWND hWnd, pBITMAPHANDLE pBitmap )
{
HDC hDC ;
RECT rcView ;
RECT rcShapeRect ;
PAINTXFORM PntXForm ;

/* Get the Current painting transformations */
L_PntGetTransformation ( pPaint, &PntXForm ) ;

rcView.left = - PntXForm.nXOffset ;
rcView.top = - PntXForm.nYOffset ;
rcView.right = rcView.left + MulDiv ( BITMAPWIDTH ( pBitmap ), PntXForm.nZoom, 100 ) ;
rcView.bottom = rcView.top + MulDiv ( BITMAPHEIGHT ( pBitmap ), PntXForm.nZoom, 100 ) ;

/* Get the device context */
hDC = GetDC ( hWnd ) ;

/* paint the bitmap */
L_PaintDC ( hDC, pBitmap, NULL, NULL, &rcView, NULL, SRCCOPY ) ;

/* Set the rectangle coordinates with respect to the DC dimensions*/
SetRect ( &rcShapeRect, 10, 10, 150, 150 ) ;

/* Use the current shape properties to draw a rectangle to DC (hDC) */
L_PntDrawShapeRectangle ( pPaint, hDC, &rcShapeRect ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

return SUCCESS ;
}


L_PntInit

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntInit(ppPaint)

ppPAINTHANDLE ppPaint;

/* pointer to a pointer to a paint handle */

Initializes the paint handle.

Parameter | Description
ppPaint | Pointer to a pointer to a paint handle to be initialized.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function must be called before calling any other paint functions.

A paint handle is valid after calling L_PntInit, and will remain valid until L_PntFree is called.

For every call to L_PntInit there must be a call to L_PntFree.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntIsValid, L_PntFree
Topics: | DigitalPaint Functions: Initializing and Freeing the Paint Handle
 | Initializing and Freeing DigitalPaint Handles

Example

/* This example shows the minimum requirements for painting a rectangle shape*/
L_INT OnPaintShape ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
RECT rcShapeRect ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/*Get the device context*/
hDC = GetDC ( hWnd ) ;

/* Set the rectangle coordinates with respect to the DC dimensions*/
SetRect ( &rcShapeRect, 10, 10, 100, 100 ) ;

/* Use the default properties for the shape to draw a rectangle*/
L_PntDrawShapeRectangle ( pPaint, hDC, &rcShapeRect ) ;

/* Release the device context*/
ReleaseDC ( hWnd, hDC ) ;

// Free the paint tools handle.
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntIsValid

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntIsValid(pPaint)

pPAINTHANDLE pPaint;

/* pointer to a paint handle */

Determines the validity of the given paint handle.

Parameter | Description
pPaint | Pointer to a paint handle.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The paint handle will be valid after calling L_PntInit, and will remain valid until L_PntFree is called.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntInit, L_PntFree
Topics: | DigitalPaint Functions: Initializing and Freeing the Paint Handle
 | Initializing and Freeing DigitalPaint Handles

Example

/* This example shows how to use the L_PntIsValid function */
L_INT Test ( pPAINTHANDLE pPaint, HWND hWnd )
{
if ( SUCCESS == L_PntIsValid ( pPaint ) )
{
HDC hDC;
RECT rcShape;

/* Get the device context */
hDC = GetDC ( hWnd ) ;

/* Set the coordinates with respect to the DC dimensions */
SetRect ( &rcShape, 10, 10, 150, 150 ) ;

/* Use the current shape properties to draw an ellipse to DC (hDC) */
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;
}
else
{
MessageBox ( hWnd, TEXT("Invalid PAINTHANDLE"), TEXT("Error"), MB_OK ) ;
}

return SUCCESS ;
}


L_PntOffsetClipRgn

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntOffsetClipRgn(pPaint, nDx, nDy)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
L_INT nDx; | /* x-offset */
L_INT nDy; | /* y-offset */

Offsets the paint-clipping region of the device context (DC) and the bitmap.

Parameter | Description
pPaint | Pointer to a paint handle.
nDx | The offset in the horizontal direction.
nDy | The offset in the vertical direction.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The toolkit will perform the necessary transformations to the offset values, using the current painting transformation values set by calling L_PntSetTransformation. Therefore, the user should provide the offset values without any transformations.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetClipRgn, L_PntGetClipRgn, L_PntSetTransformation, L_PntGetTransformation
Topics: | DigitalPaint Functions: Region Processing
 | Setting a DigitalPaint Clipping Region

Example

L_VOID OffsetClipRgnTest ( pPAINTHANDLE pPaint )
{
HRGN hRgn ;

/* create some region */
hRgn = CreateRectRgn ( 0, 0, 100, 100 ) ;

/* set the painting tools new DC clip region */
L_PntSetClipRgn ( pPaint, hRgn) ;

/* offset the current painting tools clipping region */
/* using the current transformatoin settings */
L_PntOffsetClipRgn ( pPaint, 10, 10) ;

/* delete the regions */
DeleteObject ( ( HRGN ) hRgn ) ;
}


L_PntPickColor

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntPickColor(pPaint, UserDC, nX, nY, pcrDestColor)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
L_INT nX; | /* x-coordinate */
L_INT nY; | /* y-coordinate */
COLORREF * pcrDestColor; | /* pointer to a color */

Gets the color at the specified position.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. . The mapping mode of the device context must be MM_TEXT.
nX | X-coordinate of the position to get its color.
nY | Y-coordinate of the position to get its color.
pcrDestColor | Pointer to a COLORREF value to be updated with the color at the specified position.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

If the user has set a bitmap in the toolkit, using the function L_PntSetMetrics, then the toolkit will get the color at the specified position of the bitmap. Otherwise, the toolkit will get the color from the specified position of the specified device context.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetTransformation, L_PntSetDCExtents, L_PntGetTransformation, L_PntGetDCExtents, L_PntFillBorder, L_PntFillColorReplace, L_PntFillSurface
Topics: | DigitalPaint Functions: Miscellaneous
 | Filling an Area

Example

#include <stdio.h>
.
.
.
L_INT PcikColorTest ( HWND hWnd, pBITMAPHANDLE pBitmap, L_INT nX, L_INT nY, COLORREF *pcrDestColor )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
HPALETTE hPalette ;
RECT rcSrc, rcDest ;
L_TCHAR buffer [ 80 ] ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get device context */
hDC = GetDC ( hWnd ) ;

/* Create restriction palette (if needed) */
hPalette = L_CreatePaintPalette ( hDC, pBitmap ) ;

/* Select the bitmap and the restriction palette into the toolkit */
L_PntSetMetrics ( pPaint, NULL, NULL, hPalette ) ;

/* Set the bitmap painting coordinates */
SetRect ( &rcSrc, 0, 0, BITMAPWIDTH ( pBitmap ), BITMAPHEIGHT ( pBitmap ) ) ;

CopyRect ( &rcDest, &rcSrc ) ;

/* Paint the bitmap to the screen */

L_PaintDC ( hDC, pBitmap, &rcSrc, NULL, &rcDest, NULL, SRCCOPY ) ;

/* Set the extents of the DC that we are going to pick the color from */
L_PntSetDCExtents ( pPaint, &rcDest ) ;

/* Get the color value */
L_PntPickColor ( pPaint, hDC, nX, nY, pcrDestColor ) ;

/* Display the results */
wsprintf ( buffer,
TEXT("R:%d G:%d B:%d"),
GetRValue ( *pcrDestColor ),
GetGValue ( *pcrDestColor ),
GetBValue ( *pcrDestColor ) ) ;

SetWindowText ( hWnd, buffer ) ;

/* Release the DC */
ReleaseDC ( hWnd, hDC ) ;

/* Delete the font object */
DeleteObject ( (HPALETTE ) hPalette ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntRegionBorder

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntRegionBorder(pPaint, UserDC, pptPoint, crBorderColor, phDestRgn)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
LPPOINT pptPoint; | /* pointer to an array of POINT structures */
COLORREF crBorderColor; | /* border color */
pHRGN phDestRgn; | /* pointer to a region handle */

Creates a region starting at a specified point and continuing in all directions until finding the specified color.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
pptPoint | Pointer to a POINT structure that the toolkit will use as a starting point to create the region.
crBorderColor | The COLORREF value that specifies the color of the region boundaries.
phDestRgn | Pointer to the region handle to be updated with the resulting region.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The region creation procedure will be carried out using the current region properties. To determine the current region properties, call L_PntGetProperty. To set or change the current region properties, call L_PntSetProperty. For more information on the region properties, refer to the PAINTREGION structure.

This function will also use the current painting transformation information when creating the new region. To get the current painting transformation information, call L_PntGetTransformation. To change or set the painting transformation information, call L_PntSetTransformation.

If the user has set a bitmap in the toolkit, using the function L_PntSetMetrics, then the toolkit will create the region for the bitmap. Otherwise, the toolkit will create the region for the specified device context.

If the UserDC is not NULL, the user should set the DC boundaries before calling this function, by calling L_PntSetDCExtents.

The images below show the region created by setting the border color to red and clicking inside the red border.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetProperty, L_PntSetTransformation, L_PntSetDCExtents, L_PntSetMetrics, L_PntDlgRegion, L_PntGetClipRgn, L_PntOffsetClipRgn, L_PntRegionColor, L_PntRegionEllipse, L_PntRegionPolygon, L_PntRegionRect, L_PntRegionRoundRect, L_PntRegionScale, L_PntRegionSurface, L_PntRegionTranslate, L_PntSetClipRgn
Topics: | DigitalPaint Functions: Region Processing
 | Creating a Region

Example

L_INT RegionBorderTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
PAINTSHAPE shape ;
RECT rcShape ;
RECT rcDCExtents ;
POINT ptRegionStart ;
HRGN hRgn ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/* Set the required shape properties */
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERWIDTH |
PSF_BORDERCOLOR |
PSF_BACKGROUNDSTYLE |
PSF_GRADIENTSTARTCOLOR |
PSF_GRADIENTENDCOLOR ;

shape.nBorderWidth = 10 ;
shape.crBorderColor = RGB ( 0, 255, 0 ) ;
shape.nBackgroundStyle = PAINT_SHAPE_BACK_STYLE_GRADIENT ;
shape.crGradientStartColor = RGB ( 255, 255, 255 ) ;
shape.crGradientEndColor = RGB ( 255, 255, 0 ) ;

/* Set the new shape properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Set the coordinates with respect to the DC dimensions*/
SetRect ( &rcShape, 10, 10, 210, 110 ) ;

/* Use the current shape properties to draw an ellipse to the DC (hDC) */
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;

/* Set the fill start point */
ptRegionStart.x = 100 ;
ptRegionStart.y = 100 ;

/* Get the destination DC dimensions */
GetClientRect ( hWnd, &rcDCExtents ) ;

/* Set the toolkit user DC extents */
L_PntSetDCExtents ( pPaint, &rcDCExtents ) ;

/* Create the region */
L_PntRegionBorder ( pPaint, hDC, &ptRegionStart, RGB ( 0, 255, 0 ), &hRgn) ;

/* Display the create region */
FrameRgn ( hDC, hRgn, ( HBRUSH ) GetStockObject ( BLACK_BRUSH ), 1, 1 ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/*Delete the region */
DeleteObject ( hRgn ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntRegionColor

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntRegionColor(pPaint, UserDC, crColor, phDestRgn)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
COLORREF crColor; | /* color used to create the region */
pHRGN phDestRgn; | /* pointer to a region handle */

Creates a region that contains the specified color.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
crColor | The COLORREF value that specifies the color to use to create the region.
phDestRgn | Pointer to the region handle to be updated with the resulting region.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The region creation procedure will be carried out using the current region properties. To determine the current region properties, call L_PntGetProperty. To set or change the current region properties, call L_PntSetProperty. For more information on the region properties, refer to the PAINTREGION structure.

This function will also use the current painting transformation information when creating the new region. To get the current painting transformation information, call L_PntGetTransformation. To change or set the painting transformation information, call L_PntSetTransformation.

If the user has set a bitmap in the toolkit, using the function L_PntSetMetrics, then the toolkit will create the region for the bitmap. Otherwise, the toolkit will create the region for the specified device context.

If the UserDC is not NULL, the user should set the DC boundaries before calling this function, by calling L_PntSetDCExtents.

The images below show the region created by clicking inside the yellow area.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetProperty, L_PntSetTransformation, L_PntSetDCExtents, L_PntSetMetrics, L_PntDlgRegion, L_PntGetClipRgn, L_PntOffsetClipRgn, L_PntRegionBorder, L_PntRegionEllipse, L_PntRegionPolygon, L_PntRegionRect, L_PntRegionRoundRect, L_PntRegionScale, L_PntRegionSurface, L_PntRegionTranslate, L_PntSetClipRgn
Topics: | DigitalPaint Functions: Region Processing
 | Creating a Region

Example

L_INT RegionColorTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
PAINTSHAPE shape ;
RECT rcShape ;
RECT rcDCExtents ;
HRGN hRgn ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/* Set the required shape properties */
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERWIDTH |
PSF_BORDERCOLOR |
PSF_BORDERENDCAP |
PSF_BACKGROUNDSTYLE |
PSF_GRADIENTSTARTCOLOR |
PSF_GRADIENTENDCOLOR ;

shape.nBorderWidth = 10 ;
shape.crBorderColor = RGB ( 0, 255, 0 ) ;
shape.nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_ROUND ;
shape.nBackgroundStyle = PAINT_SHAPE_BACK_STYLE_GRADIENT ;
shape.crGradientStartColor = RGB ( 255, 255, 255 ) ;
shape.crGradientEndColor = RGB ( 255, 255, 0 ) ;

/* Set the new shape properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Set the coordinates with respect to the DC dimensions */
SetRect ( &rcShape, 10, 10, 60, 60 ) ;

/* Use the current shape properties to draw an ellipse to the DC (hDC) */
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;

SetRect ( &rcShape, 100, 10, 150, 60 ) ;
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;

SetRect ( &rcShape, 60, 60, 95, 95 ) ;
L_PntDrawShapeRectangle ( pPaint, hDC, &rcShape ) ;

SetRect ( &rcShape, 10, 100, 60, 150 ) ;
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;

SetRect ( &rcShape, 100, 100, 150, 150 ) ;
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;

/* Get the destination DC dimensions */
GetClientRect ( hWnd, &rcDCExtents ) ;

/* Set the toolkit user DC extents */
L_PntSetDCExtents ( pPaint, &rcDCExtents ) ;

/* Create the region */
L_PntRegionColor ( pPaint, hDC, RGB ( 0, 255, 0 ), &hRgn) ;

/* Display the create region */
FrameRgn ( hDC, hRgn, ( HBRUSH ) GetStockObject ( BLACK_BRUSH ), 1, 1 ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/*Delete the region */
DeleteObject ( hRgn ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntRegionEllipse

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntRegionEllipse(pPaint, UserDC, prcRect, phDestRgn)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
LPRECT prcRect; | /* pointer to a RECT structure */
pHRGN phDestRgn; | /* pointer to a region handle */

Creates an elliptical region using the bounding rectangle, specified in prcRect.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
prcRect | Pointer to a RECT structure that specifies the region boundaries.
phDestRgn | Pointer to the region handle to be updated with the resulting region.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The region creation procedure will be carried out using the current region properties. To determine the current region properties, call L_PntGetProperty. To set or change the current region properties, call L_PntSetProperty. For more information on the region properties, refer to the PAINTREGION structure.

This function will also use the current painting transformation information when creating the new region. To get the current painting transformation information, call L_PntGetTransformation. To change or set the painting transformation information, call L_PntSetTransformation.

If the user has set a bitmap in the toolkit, using the function L_PntSetMetrics, then the toolkit will create the region for the bitmap. Otherwise, the toolkit will create the region for the specified device context.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetProperty, L_PntSetTransformation, L_PntSetDCExtents, L_PntSetMetrics, L_PntDlgRegion, L_PntGetClipRgn, L_PntOffsetClipRgn, L_PntRegionBorder, L_PntRegionColor, L_PntRegionPolygon, L_PntRegionRect, L_PntRegionRoundRect, L_PntRegionScale, L_PntRegionSurface, L_PntRegionTranslate, L_PntSetClipRgn
Topics: | DigitalPaint Functions: Region Processing
 | Creating a Region

Example

L_INT g_nZoomFactor = 300;
L_INT g_nHScroll = 0;
L_INT g_nVScroll = 0;

L_INT OnRegionTest ( HWND hWnd, pBITMAPHANDLE pBitmap )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
RECT rcView ;
PAINTXFORM PntXForm ;
L_INT nXOffset, nYOffset ;
HRGN hRgn ;
RECT rcRegionRect ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

PntXForm.nZoom = g_nZoomFactor;
PntXForm.nXOffset = g_nHScroll;
PntXForm.nYOffset = g_nVScroll;

/* Set the painting transformations to relfect a zoom-in by 3:1 */
L_PntSetTransformation ( pPaint, &PntXForm ) ;

/* set the painting rectangel */
SetRect ( &rcView, 0, 0, BITMAPWIDTH ( pBitmap ), BITMAPHEIGHT ( pBitmap ) ) ;

if ( g_nZoomFactor < 100 )
{
nXOffset = - MulDiv ( g_nHScroll, 100, g_nZoomFactor ) ;
nYOffset = - MulDiv ( g_nVScroll, 100, g_nZoomFactor ) ;
}
else
{
nXOffset = - g_nHScroll ;
nYOffset = - g_nVScroll ;
}

OffsetRect ( &rcView, nXOffset, nYOffset ) ;

rcView.left = MulDiv ( rcView.left, g_nZoomFactor, 100 ) ;
rcView.top = MulDiv ( rcView.top, g_nZoomFactor, 100 ) ;
rcView.right = MulDiv ( rcView.right, g_nZoomFactor, 100 ) ;
rcView.bottom = MulDiv ( rcView.bottom, g_nZoomFactor, 100 ) ;

/* Get the device context */
hDC = GetDC ( hWnd ) ;

/* paint the bitmap */
L_PaintDC ( hDC, pBitmap, NULL, NULL, &rcView, NULL, SRCCOPY ) ;

/* Set the rectangle coordinates with respect to the DC dimensions*/
/* Set the rectangle coordinates with respect to the DC dimensions*/
SetRect ( &rcRegionRect, 10, 10, 110, 110 ) ;

/* Use the current region properties and the current painting */
/* transformations to create an ellipse region */
L_PntRegionEllipse ( pPaint, hDC, &rcRegionRect, &hRgn ) ;

/* Display the resulted region */
FrameRgn ( hDC, hRgn, ( HBRUSH ) GetStockObject ( BLACK_BRUSH ), 1, 1 ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/* Delete the region */
DeleteObject ( hRgn ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntRegionPolygon

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntRegionPolygon(pPaint, UserDC, pptPoints, nCount, phDestRgn)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
LPPOINT pptPoints; | /* pointer to an array of POINT structures */
L_INT nCount; | /* number of points */
pHRGN phDestRgn; | /* pointer to a region handle */

Creates a polygonal region using the specified points.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
pptPoints | Pointer to an array of POINT structures that specify the vertices of the polygon.
nCount | Specifies the number of vertices in the array. This value must be greater than 2.
phDestRgn | Pointer to the region handle to be updated with the resulting region.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The region creation procedure will be carried out using the current region properties. To determine the current region properties, call L_PntGetProperty. To set or change the current region properties, call L_PntSetProperty. For more information on the region properties, refer to the PAINTREGION structure.

This function will also use the current painting transformation information when creating the new region. To get the current painting transformation information, call L_PntGetTransformation. To change or set the painting transformation information, call L_PntSetTransformation.

If the user has set a bitmap in the toolkit, using the function L_PntSetMetrics, then the toolkit will create the region for the bitmap. Otherwise, the toolkit will create the region for the specified device context.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetProperty, L_PntSetTransformation, L_PntSetDCExtents, L_PntSetMetrics, L_PntDlgRegion, L_PntGetClipRgn, L_PntOffsetClipRgn, L_PntRegionBorder, L_PntRegionColor, L_PntRegionEllipse, L_PntRegionRect, L_PntRegionRoundRect, L_PntRegionScale, L_PntRegionSurface, L_PntRegionTranslate, L_PntSetClipRgn
Topics: | DigitalPaint Functions: Region Processing
 | Creating a Region

Example

L_INT g_nZoomFactor = 500;
L_INT g_nHScroll = 0;
L_INT g_nVScroll = 0;

L_INT RegionTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
POINT ptPolyPoints [ 5 ] ;
PAINTXFORM PntXForm ;
HRGN hRgn ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

PntXForm.nZoom = g_nZoomFactor ;
PntXForm.nXOffset = g_nHScroll ;
PntXForm.nYOffset = g_nVScroll ;

/* Set the painting transformations to relfect a zoom in by 5:1 */
L_PntSetTransformation ( pPaint, &PntXForm ) ;

/* Get the device context */
hDC = GetDC ( hWnd ) ;

/* Set the coordinates with respect to the DC dimensions*/
ptPolyPoints [ 0 ].x = 10 ;
ptPolyPoints [ 0 ].y = 10 ;
ptPolyPoints [ 1 ].x = 50 ;
ptPolyPoints [ 1 ].y = 15 ;
ptPolyPoints [ 2 ].x = 70 ;
ptPolyPoints [ 2 ].y = 60 ;
ptPolyPoints [ 3 ].x = 120 ;
ptPolyPoints [ 3 ].y = 100;
ptPolyPoints [ 4 ].x = 20 ;
ptPolyPoints [ 4 ].y = 80 ;

/* Use the current region properties and the current painting */
/* trasnformations to create a polygon region */
L_PntRegionPolygon ( pPaint, hDC, ptPolyPoints, 5, &hRgn) ;

/* Display the resulted region */
FrameRgn ( hDC, hRgn, ( HBRUSH ) GetStockObject ( BLACK_BRUSH ), 1, 1 ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/*Delete the region */
DeleteObject ( hRgn ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntRegionRect

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntRegionRect(pPaint, UserDC, prcRect, phDestRgn)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
LPRECT prcRect; | /* pointer to a RECT structure */
pHRGN phDestRgn; | /* pointer to a region handle */

Creates a rectangular region using the specified points.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
prcRect | Pointer to a RECT structure that specifies the region boundaries.
phDestRgn | Pointer to the region handle to be updated with the resulting region.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The region creation procedure will be carried out using the current region properties. To determine the current region properties, call L_PntGetProperty. To set or change the current region properties, call L_PntSetProperty. For more information on the region properties, refer to the PAINTREGION structure.

This function will also use the current painting transformation information when creating the new region. To get the current painting transformation information, call L_PntGetTransformation. To change or set the painting transformation information, call L_PntSetTransformation.

If the user has set a bitmap in the toolkit, using the function L_PntSetMetrics, then the toolkit will create the region for the bitmap. Otherwise, the toolkit will create the region for the specified device context.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetProperty, L_PntSetTransformation, L_PntSetDCExtents, L_PntSetMetrics, L_PntDlgRegion, L_PntGetClipRgn, L_PntOffsetClipRgn, L_PntRegionBorder, L_PntRegionColor, L_PntRegionEllipse, L_PntRegionPolygon, L_PntRegionRoundRect, L_PntRegionScale, L_PntRegionSurface, L_PntRegionTranslate, L_PntSetClipRgn
Topics: | DigitalPaint Functions: Region Processing
 | Creating a Region

Example

L_INT RegionTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
RECT rcRegion ;
HRGN hRgn ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Set the painting transformations to their default values */
L_PntSetTransformation ( pPaint, NULL ) ;

/* Get the device context */
hDC = GetDC ( hWnd ) ;

/* Set the coordinates with respect to the DC dimensions*/
SetRect ( &rcRegion, 10, 10, 100, 100 ) ;

/* Use the current region properties and the current painting
trasnformations to create a rectangular region */
L_PntRegionRect ( pPaint, hDC, &rcRegion, &hRgn) ;

/* Display the resulted region */
FrameRgn ( hDC, hRgn, ( HBRUSH ) GetStockObject ( BLACK_BRUSH ), 1, 1 ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/*Delete the region */
DeleteObject ( hRgn ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntRegionRoundRect

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntRegionRoundRect(pPaint, UserDC, prcRect, phDestRgn)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
LPRECT prcRect; | /* pointer to a RECT structure */
pHRGN phDestRgn; | /* pointer to a region handle */

Create a rounded rectangle region using the specified points.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
prcRect | Pointer to a RECT structure that specifies the region boundaries.
phDestRgn | Pointer to the region handle to be updated with the resulting region.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The region creation procedure will be carried out using the current region properties. To determine the current region properties, call L_PntGetProperty. To set or change the current region properties, call L_PntSetProperty. For more information on the region properties, refer to the PAINTREGION structure.

This function will also use the current painting transformation information when creating the new region. To get the current painting transformation information, call L_PntGetTransformation. To change or set the painting transformation information, call L_PntSetTransformation.

If the user has set a bitmap in the toolkit, using the function L_PntSetMetrics, then the toolkit will create the region for the bitmap. Otherwise, the toolkit will create the region for the specified device context.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetProperty, L_PntSetTransformation, L_PntSetDCExtents, L_PntSetMetrics, L_PntDlgRegion, L_PntGetClipRgn, L_PntOffsetClipRgn, L_PntRegionBorder, L_PntRegionColor, L_PntRegionEllipse, L_PntRegionPolygon, L_PntRegionRect, L_PntRegionScale, L_PntRegionSurface, L_PntRegionTranslate, L_PntSetClipRgn
Topics: | DigitalPaint Functions: Region Processing
 | Creating a Region

Example

L_INT RegionTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC;
RECT rcRegion;
HRGN hRgn;
PAINTREGION region;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

region.nSize = sizeof ( PAINTREGION ) ;
region.dwMask = PRF_ROUNDRECTELLIPSEWIDTH |
PRF_ROUNDRECTELLIPSEHEIGHT ;
region.nRoundRectEllipseWidth = 40 ;
region.nRoundRectEllipseHeight = 40 ;

L_PntSetProperty ( pPaint, PAINT_GROUP_REGION, &region ) ;

/* Set the painting transformations to their default values */
L_PntSetTransformation ( pPaint, NULL ) ;

/* Get the device context */
hDC = GetDC ( hWnd ) ;

/* Set the coordinates with respect to the DC dimensions*/
SetRect ( &rcRegion, 10, 10, 100, 100 ) ;

/* Use the current region properties and the current painting
trasnformations to create a round rect region */
L_PntRegionRoundRect ( pPaint, hDC, &rcRegion, &hRgn) ;

/* Display the resulted region */
FrameRgn ( hDC, hRgn, ( HBRUSH ) GetStockObject ( BLACK_BRUSH ), 1, 1 ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/*Delete the region */
DeleteObject ( hRgn ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntRegionScale

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntRegionScale(pPaint, nHScaleFactor, nVScaleFactor, nAlignment, phDestRgn)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
L_INT nHScaleFactor; | /* horizontal scale factor */
L_INT nVScaleFactor; | /* vertical scale factor */
PAINTALIGNMENT nAlignment; | /* alignment type */
pHRGN phDestRgn; | /* pointer to the region handle */

Scales a region.

Parameter | Description
pPaint | Pointer to a paint handle.
nHScaleFactor | Horizontal scale factor. Valid values are between 1 and 10000. For example:
 | Value | Meaning
 | 100 | The same dimensions.
 | 110 | 1.1 times the original dimensions
 | 120 | 1.2 times the original dimensions.
 | 10000 | 100 times the original dimensions.
 | 99 | 0.99 times the original dimensions.
 | 98 | 0.98 times the original dimensions.
 | 1 | 0.01 times the original dimensions.
nVScaleFactor | Vertical scale factor. Valid values are between 1 and 10000. For example:
 | Value | Meaning
 | 100 | The same dimensions.
 | 110 | 1.1 times the original dimensions
 | 120 | 1.2 times the original dimensions.
 | 10000 | 100 times larger than the original dimensions.
 | 99 | 0.99 times the original dimensions.
 | 98 | 0.98 times the original dimensions.
 | 1 | 0.01 times the original dimensions.
nAlignment | A value that determines how the scaled region will be aligned with respect to the original region. For a list of possible values, refer to PAINTALIGNMENT.
phDestRgn | Pointer to the region to be translated. After translation, the toolkit will delete the old region and replace it with the new one.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The user is responsible for deleting the resulting region.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetProperty, L_PntSetTransformation, L_PntSetDCExtents, L_PntSetMetrics, L_PntDlgRegion, L_PntGetClipRgn, L_PntOffsetClipRgn, L_PntRegionBorder, L_PntRegionColor, L_PntRegionEllipse, L_PntRegionPolygon, L_PntRegionRect, L_PntRegionRoundRect, L_PntRegionSurface, L_PntRegionTranslate, L_PntSetClipRgn
Topics: | DigitalPaint Functions: Region Processing
 | Creating a Region

Example

L_INT RegionScaleTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
RECT rcRegion ;
HRGN hRgn ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get the device context */
hDC = GetDC ( hWnd ) ;

/* Set the coordinates with respect to the DC dimensions*/
SetRect ( &rcRegion, 250, 110, 350, 210 ) ;

/* Use the current region properties and the current painting
trasnformations to create an ellipse region */
L_PntRegionEllipse ( pPaint, hDC, &rcRegion, &hRgn) ;

/* Display the resulted region */
FrameRgn ( hDC, hRgn, ( HBRUSH ) GetStockObject ( BLACK_BRUSH ), 1, 1 ) ;

/* Scale the region */
L_PntRegionScale ( pPaint,
300,
300,
( PAINTALIGNMENT ) (PAINT_ALIGNMENT_HCENTER | PAINT_ALIGNMENT_VCENTER),
&hRgn ) ;

/* Display the scaled region */
FrameRgn ( hDC, hRgn, ( HBRUSH ) GetStockObject ( BLACK_BRUSH ), 1, 1 ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/*Delete the region */
DeleteObject ( hRgn ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntRegionSurface

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntRegionSurface(pPaint, UserDC, pptPoint, phDestRgn)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
LPPOINT pptPoint; | /* pointer to an array of POINT structures */
pHRGN phDestRgn; | /* pointer to a region handle */

Creates a region, starting at a specified point and continuing in all directions, that contains a specific color.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
pptPoint | Pointer to a POINT stucture that the toolkit will use as a starting point to create the region. The color located at this point will specify the surface color.
phDestRgn | Pointer to the region handle to be updated with the resulting region.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The region creation procedure will be carried out using the current region properties. To determine the current region properties, call L_PntGetProperty. To set or change the current region properties, call L_PntSetProperty. For more information on the region properties, refer to the PAINTREGION structure.

This function will also use the current painting transformation information when creating the new region. To get the current painting transformation information, call L_PntGetTransformation. To change or set the painting transformation information, call L_PntSetTransformation.

If the user has set a bitmap in the toolkit, using the function L_PntSetMetrics, then the toolkit will create the region for the bitmap. Otherwise, the toolkit will create the region for the specified device context.

If the UserDC is not NULL, the user should set the DC boundaries before calling this function, by calling L_PntSetDCExtents.

The images below show the region created by clicking in the red area.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetProperty, L_PntSetTransformation, L_PntSetDCExtents, L_PntSetMetrics, L_PntDlgRegion, L_PntGetClipRgn, L_PntOffsetClipRgn, L_PntRegionBorder, L_PntRegionColor, L_PntRegionEllipse, L_PntRegionPolygon, L_PntRegionRect, L_PntRegionRoundRect, L_PntRegionScale, L_PntRegionTranslate, L_PntSetClipRgn
Topics: | DigitalPaint Functions: Region Processing
 | Creating a Region

Example

L_INT RegionSurfaceTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
PAINTSHAPE shape ;
RECT rcShape ;
RECT rcDCExtents ;
POINT ptRegionStart ;
HRGN hRgn ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/* Get the current shape properties */
L_PntGetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Set the required shape properties */
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERWIDTH |
PSF_BORDERSTYLE |
PSF_BORDERCOLOR |
PSF_BORDERENDCAP |
PSF_BACKGROUNDCOLOR ;

shape.nBorderWidth = 8 ;
shape.nBorderStyle = PAINT_SHAPE_BORDER_STYLE_DASHDOT ;
shape.crBorderColor = RGB ( 255, 0, 255 ) ;
shape.nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_ROUND ;
shape.crBackgroundColor = RGB ( 255, 255, 0 ) ;

/* Set the new shape properties */
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/* Set the coordinates with respect to the DC dimensions*/
SetRect ( &rcShape, 10, 10, 210, 210 ) ;

/* Use the current shape properties to draw an ellipse to the DC (hDC) */
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;

/* Set the fill start point */
ptRegionStart.x = 100 ;
ptRegionStart.y = 100 ;

/* Get the destination DC dimensions */
GetClientRect ( hWnd, &rcDCExtents ) ;

/* Set the toolkit user DC extents */
L_PntSetDCExtents ( pPaint, &rcDCExtents ) ;

/* Create the region */
L_PntRegionSurface ( pPaint, hDC, &ptRegionStart, &hRgn) ;

/* Display the create region */
FrameRgn ( hDC, hRgn, ( HBRUSH ) GetStockObject ( BLACK_BRUSH ), 1, 1 ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/*Delete the region */
DeleteObject ( hRgn ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntRegionTranslate

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntRegionTranslate(pPaint, dx, dy, phDestRgn)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
L_INT dx; | /* x-direction offset */
L_INT dy; | /* y-direction offset */
pHRGN phDestRgn; | /* pointer to the region handle */

Translates (offsets) a region.

Parameter | Description
pPaint | Pointer to a paint handle.
dx | X-coordinate offset.
dy | Y-coordinate offset.
phDestRgn | Pointer to the region to be translated. After translation, the toolkit will delete the old region and replace it with the new one.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The values for dx and dy will be used "as is". No transformation will be performed on these values.

The user is responsible for deleting the resulting region.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntSetProperty, L_PntSetTransformation, L_PntSetDCExtents, L_PntSetMetrics, L_PntDlgRegion, L_PntGetClipRgn, L_PntOffsetClipRgn, L_PntRegionBorder, L_PntRegionColor, L_PntRegionEllipse, L_PntRegionPolygon, L_PntRegionRect, L_PntRegionRoundRect, L_PntRegionScale, L_PntRegionSurface, L_PntSetClipRgn
Topics: | DigitalPaint Functions: Region Processing
 | Creating a Region

Example

L_INT RegionTraslateTest ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
RECT rcRegion ;
HRGN hRgn ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get the device context */
hDC = GetDC ( hWnd ) ;

/* Set the coordinates with respect to the DC dimensions*/
SetRect ( &rcRegion, 10, 10, 100, 100 ) ;

/* Use the current region properties and the current painting
trasnformations to create a rectangle region */
L_PntRegionRect ( pPaint, hDC, &rcRegion, &hRgn) ;

/* Translate the region */
L_PntRegionTranslate ( pPaint, 50, 50, &hRgn ) ;

/* Display the resulted region */
FrameRgn ( hDC, hRgn, ( HBRUSH ) GetStockObject ( BLACK_BRUSH ), 1, 1 ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/*Delete the region */
DeleteObject ( hRgn ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntSetClipRgn

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntSetClipRgn(pPaint, hClipRgn)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HRGN hClipRgn; | /* region handle */

Sets the current clipping region for the toolkit.

Parameter | Description
pPaint | Pointer to a paint handle.
hClipRgn | A handle to the region to be used to clip the painting output. If this parameter is NULL, there is no clipping region.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function creates a copy of the specified region and uses it to clip the painting output. The toolkit will use the region as it is, without doing any transformations.

If a bitmap has been set using the L_PntSetMetrics function, the toolkit will perform any necessary clipping, draw to the bitmap, and finally draw the resulting bitmap to the specified device context.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntOffsetClipRgn, L_PntGetClipRgn
Topics: | DigitalPaint Functions: Region Processing
 | Setting a DigitalPaint Clipping Region

Example

L_INT OnPaintShape ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
HRGN hClipRgn ;
RECT rcShapeRect ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;

/* Set the rectangle coordinates with respect to the DC dimensions*/
SetRect ( &rcShapeRect, 10, 10, 110, 110 ) ;

/* Use the current shape properties to draw an ellipse to DC (hDC) */
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShapeRect ) ;

hClipRgn = CreateRectRgn ( 120, 20, 200, 100 ) ;

/* Set painting clip region */
L_PntSetClipRgn ( pPaint, hClipRgn) ;

/* Set the rectangle coordinates with respect to the DC dimensions*/
SetRect ( &rcShapeRect, 110, 10, 210, 110 ) ;

/* Use the current shape properties to draw an ellipse to DC (hDC) */
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShapeRect ) ;

/* Delete the clip region */
DeleteObject ( ( HRGN ) hClipRgn ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntSetDCExtents

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntSetDCExtents(pPaint, prcRect)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
LPRECT prcRect; | /* pointer to a RECT structure */

Sets the boundaries of the device context (DC).

Parameter | Description
pPaint | Pointer to a paint handle.
prcRect | Pointer to a RECT structure that contains the boundaries of the user DC.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

It is best to set the boundaries of the device context (DC) before calling any functions that use the DC. In addition, the device context boundaries should be updated whenever the old boundaries become invalid, such as when the client area of the window has been resized.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntRegionSurface, L_PntRegionBorder, L_PntRegionColor, L_PntFillSurface, L_PntFillBorder, L_PntFillColorReplace, L_PntPickColor, L_PntGetDCExtents
Topics: | DigitalPaint Functions: Getting and Setting the DC Boundaries
 | Setting General DigitalPaint Information

Example

/* This example shows how to set the user DC extents */
pPAINTHANDLE g_pPaint ;

L_VOID OnSize ( HWND hWnd, UINT state, L_INT cxClient, L_INT cyClient )
{
RECT rcNewRect, rcDCRect ;
.
.
.

SetRect ( &rcNewRect, 0, 0, cxClient, cyClient ) ;

/* Do the program sizing stuff */
L_PntGetDCExtents ( g_pPaint, &rcDCRect ) ;

if ( ! EqualRect ( &rcNewRect, &rcDCRect ) )
{
L_PntSetDCExtents ( g_pPaint, & rcNewRect ) ;
}
.
.
.
}


L_PntSetMetrics

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntSetMetrics(pPaint, UserDC, pBitmap, hRestrictionPalette)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
HDC UserDC; | /* handle to the device context */
pBITMAPHANDLE pBitmap; | /* pointer to a bitmap handle */
HPALETTE hRestrictionPalette; | /* palette handle */

Sets general painting information for the toolkit.

Parameter | Description
pPaint | Pointer to a paint handle.
UserDC | Handle to a Windows device context (DC), such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT. The toolkit will use this DC for future painting compatibility.
pBitmap | Pointer to a bitmap handle that references the bitmap on which the painting will occur. This parameter can be NULL if the user does not need a bitmap. This toolkit uses the LEAD DIB driver, which supports 1, 4, 8, 16 and 24 bit images. If an image that has some other number of bits per pixel is used, L_ColorResBitmap must be used to change the image to a bits per pixel value supported by the LEAD DIB driver.
hRestrictionPalette | Handle to the palette used to restrict the painting colors. This parameter can be NULL. This function makes a copy of the specified palette handle. Therefore, the handle should be deleted after the function returns.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

If the UserDC parameter is NULL, the toolkit will use the screen DC for compatibility issues.

The user should delete UserDC after this function returns.

If hRestrictionPalette is not NULL, painting will be restricted to the nearest colors found in the palette. If hRestrictionPalette is NULL, then no color restriction will be performed by the toolkit.

If pBitmap is not NULL, the toolkit will draw to the bitmap first, then it will draw everything to the device context.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntGetTransformation, L_PntSetTransformation, L_PntGetDCExtents, L_PntSetDCExtents
Topics: | Setting General DigitalPaint Information
 | DigitalPaint Functions: Miscellaneous

Example

L_INT OnPaintShape ( HWND hWnd, pBITMAPHANDLE pBitmap )
{
pPAINTHANDLE pPaint ;
HDC hDC ;
RECT rcShapeRect ;
HPALETTE hPalette ;

/* initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* get the device context */
hDC = GetDC ( hWnd ) ;

/* create the palette that we will be used to restrict painting colors to the DC to
/* the colors that are in the bitmap */
hPalette = L_CreatePaintPalette ( hDC, pBitmap ) ;

/* set the painting metrics */
L_PntSetMetrics ( pPaint, hDC, pBitmap, hPalette ) ;

/* set the rectangle coordinates with respect to the DC dimensions*/
SetRect ( &rcShapeRect, 10, 10, 110, 110 ) ;

/* use the current shape properties to draw an rectangle to DC (hDC) */
/* and to the currently selected bitmap using the L_PntSetMetrics function */
L_PntDrawShapeRectangle ( pPaint, hDC, &rcShapeRect ) ;

/* release the device context */
ReleaseDC ( hWnd, hDC ) ;

/* Delete the newly created palette */
if ( hPalette )
{
DeleteObject ( hPalette ) ;
}

/* free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntSetProperty

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntSetProperty(pPaint, nGroup, pProperty)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
PAINTGROUP nGroup; | /* type of paint properties */
L_VOID L_FAR * pProperty; | /* pointer to a PAINTXXXX structure */

Sets the specified paint properties.

Parameter | Description
pPaint | Pointer to a paint handle.
nGroup | Indicates the paint properties to get and the structure pointed to by pProperty. Possible values are:
 | Value | Meaning
 | PAINT_GROUP_BRUSH | Set the Paintbrush properties. pProperty points to a PAINTBRUSH structure.
 | PAINT_GROUP_SHAPE | Set the Paint shape properties. pProperty points to a PAINTSHAPE structure.
 | PAINT_GROUP_REGION | Set the Paint region properties. pProperty points to a PAINTREGION structure.
 | PAINT_GROUP_FILL | Set the Paint fill properties. pProperty points to a PAINTFILL structure.
 | PAINT_GROUP_TEXT | Set the Paint fill properties. pProperty points to a PAINTTEXT structure.
pProperty | Pointer to a PAINTXXX structure that contains the property values to set. The type of structure that this parameter points to is indicated by the nGroup parameter. The user should set the nSize and dwMask of any of the PAINTXXX structures with proper values before calling this function.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntGetProperty, L_PntDlgBrush, L_PntDlgFill, L_PntDlgRegion, L_PntDlgShape, L_PntDlgText, L_PntBrushLineTo, L_PntBrushMoveTo, L_PntApplyText, L_PntDrawShapeEllipse, L_PntDrawShapeLine, L_PntDrawShapePolyBezier, L_PntDrawShapePolygon, L_PntDrawShapeRectangle, L_PntDrawShapeRoundRect, L_PntRegionBorder, L_PntRegionColor, L_PntRegionEllipse, L_PntRegionPolygon, L_PntRegionRect, L_PntRegionRoundRect
Topics: | DigitalPaint Functions: Paint Properties
 | Setting DigitalPaint Properties

Example

/* This example shows the minimum requirements for painting a rectangle shape.
using some user defined properties */
L_INT OnPaintShape ( HWND hWnd )
{
pPAINTHANDLE pPaint ;
PAINTSHAPE shape ;
HDC hDC ;
RECT rcShapeRect ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* 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 */
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;

/*Get the device context */
hDC = GetDC ( hWnd ) ;

/* Set the rectangle coordinates with respect to the DC dimensions*/
SetRect ( &rcShapeRect, 10, 10, 110, 110 ) ;

/* Use the current shape properties to draw a rectangle*/
L_PntDrawShapeRectangle ( pPaint, hDC, &rcShapeRect ) ;

/* Release the device context*/
ReleaseDC ( hWnd, hDC ) ;

// Free the paint tools handle.
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


L_PntSetTransformation

#include "LtPnt.h"

L_INT EXT_FUNCTION L_PntSetTransformation(pPaint, pXForm)

pPAINTHANDLE pPaint; | /* pointer to a paint handle */
pPAINTXFORM pXForm; | /* pointer to a structure */

Sets the transformation information for the toolkit.

Parameter | Description
pPaint | Pointer to a paint handle.
pXForm | Pointer to a PAINTXFORM structure that contains transform values used to transform input coordinates. If this parameter is NULL, the zoom will default to 100 and the offset values will default to 0.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The toolkit will transform all input and output coordinates, using the values set by this function, unless otherwise stated.

Required DLLs and Libraries

LTPNT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_PntGetTransformation, L_PntGetDCExtents, L_PntSetDCExtents, L_PntSetMetrics
Topics: | DigitalPaint Functions: Transforming External Coordinates
 | Setting General DigitalPaint Information

Example

L_INT g_nZoomFactor = 500 ;
L_INT g_nHScroll = 0 ; /* current scroll bar horzontal value */
L_INT g_nVScroll = 0 ; /* current scroll bar vertical value */
L_INT OnPaintShape ( HWND hWnd, pBITMAPHANDLE pBitmap )
{
pPAINTHANDLE pPaint ;
HDC hDC;
RECT rcView ;
L_INT nXOffset, nYOffset ;
RECT rcShapeRect ;
PAINTXFORM PntXForm ;

/* Initiate the Paint toolkit */
if ( SUCCESS != L_PntInit ( &pPaint ) )
{
return FAILURE ;
}

/* set the painting rectangel */
SetRect ( &rcView, 0, 0, BITMAPWIDTH ( pBitmap ), BITMAPHEIGHT ( pBitmap ) ) ;

if ( g_nZoomFactor < 100 )
{
nXOffset = - MulDiv ( g_nHScroll, 100, g_nZoomFactor ) ;
nYOffset = - MulDiv ( g_nVScroll, 100, g_nZoomFactor ) ;
}
else
{
nXOffset = - g_nHScroll ;
nYOffset = - g_nVScroll ;
}

OffsetRect ( &rcView, nXOffset, nYOffset ) ;

rcView.left = MulDiv ( rcView.left, g_nZoomFactor, 100 ) ;
rcView.top = MulDiv ( rcView.top, g_nZoomFactor, 100 ) ;
rcView.right = MulDiv ( rcView.right, g_nZoomFactor, 100 ) ;
rcView.bottom = MulDiv ( rcView.bottom, g_nZoomFactor, 100 ) ;

// set the paintin transformatoins values.
PntXForm.nZoom = g_nZoomFactor ;
PntXForm.nXOffset = - rcView.left ;
PntXForm.nYOffset = - rcView.top ;

/* Set the painting transformations to reflect a zoom-in by 5:1 */
L_PntSetTransformation ( pPaint, &PntXForm ) ;

/* Get the device context */
hDC = GetDC ( hWnd ) ;

/* paint the bitmap */
L_PaintDC ( hDC, pBitmap, NULL, NULL, &rcView, NULL, SRCCOPY ) ;

/* Set the rectangle coordinates with respect to the DC dimensions*/
SetRect ( &rcShapeRect, 10, 10, 150, 150 ) ;

/* Use the current shape properties to draw a rectangle to DC (hDC) */
L_PntDrawShapeRectangle ( pPaint, hDC, &rcShapeRect ) ;

/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;

/* Free the paint tools handle */
L_PntFree ( pPaint ) ;

return SUCCESS ;
}


Raster Pro/Document/Medical Features

Raster Pro:

LEADTOOLS Raster Imaging Pro provides some imaging capabilities that are not available in the LEADTOOLS Raster Imaging product. In order to access these features, you must unlock them by calling L_UnlockSupport(L_SUPPORT_LTPRO, L_KEY_LTPRO). L_KEY_LTPRO can be found in ltkey.h.

If you are a licensed user of LEADTOOLS Raster Imaging, and would like to access Raster Imaging Pro features, you must contact Tech Support for information on obtaining a license and the unlock key for calling L_UnlockSupport.

Document/Medical:

LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite are the most comprehensive imaging toolkits on the market. No other toolkit provides as many imaging features for color, gray-scale and black & white images in one development package, and for one price. These toolkits comprise LEAD's best code and are designed for the programmer who is looking for the fastest performance, and/or the most extensive color, document, and medical imaging capabilities available.

These toolkits contain powerful annotation capabilities and optimized document image processing filters, and high performance compression, decompression and viewing of JPEG, LEAD CMP, MRC and CCITT G3/G4. The annotation capabilities enable the programmer to add text, highlights, sticky notes, audio, ellipses, buttons, lines, arrows, rectangles, polygons, redaction (blackout), hotspots, freehand scribble, pointers, bitmap and text stamps, to black & white and color images. Programmers working with document imaging will also find special processing filters such as despeckle, deskew, favor black, and scale to gray to enhance their black and white 1 bit images. Additionally, you can achieve faster rotation in 90-degree increments by applying a rotated view perspective to the bitmap. These LEADTOOLS toolkits offer the fastest software-only JPEG decoder available.

LEADTOOLS Document Imaging

The LEADTOOLS Document Imaging toolkit contains all the features available in the LEADTOOLS Raster Imaging Pro. In addition, it contains the following capabilities:

Special functions for Document (bitonal) images. The LEADTOOLS functions for bitonal images are especially useful for working with images from black-and-white scanners or FAX machines. These functions let you do things such as automatically straighten (deskew) an image, remove spots (despeckle), or clarify a scaled display (using scale-to-gray and favor-black features).

Annotation. LEADTOOLS supports annotation of images by letting you overlay images with text, lines, shapes, arrows, buttons, highlights, hot spots, sticky notes, stamps, buttons, and sounds.

Fast rotation. LEADTOOLS achieves fast rotation in 90-degree increments by applying a rotated view perspective to the bitmap.

ISIS support. LEADTOOLS supports ISIS interfaces for driving scanning devices.

Faster compression and decompression. The Document/Medical editions work faster when loading and saving LEAD CMP, JPEG, and CCITT Group 3 and Group 4 images. The LEADTOOLS functions for loading and saving are the same in all products. The only difference is in performance.

1-bit Image Clean-up. The Document toolkits include support for removing dots, blobs, holes, inverted text, lines, borders, bumps and nicks from 1-bit images.

Region Clean-up. [Document/Medical] Remove all the holes from a region.

Embedded Messages. The Document toolkits include support for embedding messages in lossless image formats like bmp, tiff, lossless jpeg, etc. The message is embedded without any visible changes to the image, and does not appreciably increase the size of the image. The message is password-protected.

Image Conversion. The Document toolkits include support for transforming a bitmap into a binary image using specified thresholds or a threshold calculated automatically based on statistical features of the bitmap.

12 and 16 bit grayscale images. [Document/Medical] Load, process, display, window level and save 12 and 16 bit grayscale images (including support for 16-bit grayscale TIFF).

48 and 64 bit color images. [Document/Medical] Load, process, display, and save 48 and 64 bit color images.

MRC Support. [Document/Medical] LEADTOOLS supports the Mixed Raster Content format for color documents containing mixed image and text components. For more information, refer to the .

Halftoning. [Document/Medical] Convert 1-, 4-, 8-, 16-, 24-, or 32-bit bitmaps to a halftoned bitmap, with a specified pattern rotation. A halftoned bitmap is a 1-bit bitmap that has been dithered for black and white printing or display.

LEADTOOLS Document Imaging Suite

The LEADTOOLS Document Imaging Suite toolkit contains all the capabilities of LEADTOOLS Document Imaging, and includes the features listed below. Please note that the OCR features are included in this toolkit, however they can also be purchased as a plug-in for the LEADTOOLS Document Imaging toolkit. Also, JBIG support is provided in this toolkit, however a JBIG Module may be added on to LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging or LEADTOOLS Medical Imaging Suite.

OCR features. [Document/Medical] LEAD offers OCR features that use Scansoft Textbridge technology. Support for these features is included in the LEADTOOLS Document Imaging Suite, and can be added, via plug-in to the LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite toolkits. The OCR features allow you to perform optical character recognition and turn images into documents. Features include preset confidence and accuracy levels for controlling how sensitive the engine is to unrecognized text, artificial intelligence for improving recognition on documents of the same type, and built-in and user-defined lexicons for limiting the type of text to recognize within a particular zone. LEADTOOLS provides the ability to verify or correct text during, and (using LEAD's unique OCR editor) after recognition. LEAD's OCR editor ties the text being edited directly to the image, providing a visual reference to the original bitmap data. The OCR engine can perform Automatic area segmentation creating multi-layered zones, recognizing areas such as tables, rules, images and text. Or, you can manually designate up to 250 such zones. The OCR features support different fonts, sizes (5 to 72 point) and styles. Fax, dot matrix and halftones can be preprocessed to improve recognition results. The OCR Engine supports major European and Scandinavian languages (Danish, Dutch, Finnish, French, German, Italian, Norwegian, Portuguese, Russian, Spanish, and Swedish) as well as English. Support for dialects such as US. English, French Canadian, Latin American Spanish, Swiss German, and Brazilian Portuguese is also provided.

Recognized text can be exported to more than 40 different formats, including MS Word, MS Excel, Dbase andWordPerfect. The LEADTOOLS OCR features contain superior OCR processing speeds, for use in form recognition and processing applications.

LEAD's JBIG filter. [Document/Medical] LEAD includes support for this filter in the LEADTOOLS Document Imaging Suite toolkit. Support for this filter can be added to LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging or LEADTOOLS Medical Imaging Suite by purchasing the JBIG Module. JBIG defines a method for lossless compression encoding of a bi-level image (two-color image). This method can also be used for coding grayscale and color images. LEADTOOLS completely supports all three types of images, giving you the ability to make full use of this powerful compression technology. LEADTOOLS also supports the progressive capability of JBIG, allowing you to store and send multiple representations of images at different resolutions without any extra storage overhead.

LEADTOOLS Medical Imaging

LEADTOOLS Medical Imaging contains all the capabilities of LEADTOOLS Document Imaging. It also includes general medical imaging technologies (1-16,24,32 bit color, 1-16 bit grayscale and window leveling of 12 and 16-bit grayscale images) and support for the DICOM file format.

DICOM file support. [Medical] LEADTOOLS Medical Imaging provides COMPLETE support for the DICOM 3.0 specification, including all standard IOD classes and modalities (CR, CT, MR, NM, US, RF, SC, VL, etc.) and complete DICOM Basic Directory support.

Window leveling. [Document/Medical] Detect and set LowBit and HighBit for image data, display images with automatic LUT intensity expansion, or set LUT entries and ranges with specific values and gradients. Display images through the LUT without changing the data, or process the image data using the LUT. Linearize the number of pixels locally in a bitmap, based on the specified color space in order to bring out the detail in dark areas of an image, and smooth the edges between blocks.

Medical Imaging Processing. [Medical] LEADTOOLS Medical Imaging provides image processing functionality designed specifically to allow you to examine and improve the quality of medical images.

LEADTOOLS Medical Imaging Suite

LEADTOOLS Medical Imaging Suite contains all the capabilities of LEADTOOLS Medical Imaging. In addition, it supports the following:

DICOM Communication support. [Medical Suite] LEADTOOLS provides COMPLETE support for DICOM Communications, including all Service Classes (Verification, Storage, Query/Retrieve, Patient Management, etc), and contains high-level communications functions simplifying the creation of DICOM client/server applications.

(Document/Medical) is used in the documentation to designate the features that are available in LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite. Those features that are available only in the Medical toolkits are indicated in the documentation by (Medical). Features available only in the LEADTOOLS Medical Imaging Suite toolkit are indicated in the documentation by (Medical Suite).

(Internet only) is used in the documentation to designate the features that are available only in the LEADTOOLS Internet toolkit.

For more information, refer to Document/Medical Edition Support and Licensing Requirements .


LEADTOOLS Reference Manuals

LEADTOOLS provides reference manuals that contain the same information as the online help. You can print them from PDF files. Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

To print the PDF files, you must use the Adobe Acrobat Reader 3.0 or higher. You can download a copy of the Acrobat Reader from the Adobe web site (http://www.adobe.com). Note that different versions of the Acrobat Reader are available for different operating systems, but they all can read the same PDF files.


Topic Selection

LEAD Technologies, Inc.
Suite 400
1201 Greenwood Cliff
Charlotte, NC 28204

Sales@Leadtools.com
www.leadtools.com

(704) 332-5532
FAX: (704) 372-8161
Tech Support: (704) 372-9681

LEADTOOLS is ideal for developers involved in still frame, multimedia, document, medical, and vector imaging projects, including Internet/Intranet applications. Independent of the specific application requirement – scanning, file format support/conversion, compression, image processing, annotation, database support, multimedia, etc. – LEADTOOLS provides the most comprehensive, robust, flexible, and powerful imaging solution available.

Click this button to start the Licensing help file to review the License Agreements governing your use of the software.

Click this button to start the Products help file to review the full line of LEADTOOLS Products.

Click this button to start the Imaging help file to review the full line of LEADTOOLS Image Categories.