SMOOTH

typedef struct tagSMOOTH
{
   L_UINT uStructSize;
   L_UINT uFlags;
   L_INT iLength;
   pBITMAPHANDLE pBitmapRegion;
   L_UINT uBitmapStructSize;
   HRGN hRgn;
} SMOOTH, *pSMOOTH;

The SMOOTH structure provides smoothing information for the LBitmap::Smooth function.

Member

Description

uStructSize

Size of this structure in bytes. Use the sizeof() macro to calculate this value.

uFlags

Flags that determine the behavior of the smoothing process. Flags may be combined using a bitwise OR (|). Possible values are:

 

 

Value

Meaning

 

SMOOTH_SINGLE_REGION

For each bump or nick encountered by LBitmap::Smooth, if the LBitmap::SmoothCallback member function returns SUCCESS_REMOVE, the removed bump or nick is added to an internal single region. If the callback member function returns SUCCESS_NOREMOVE, the bump or nick is not added to the single region. When LBitmap::Smooth returns, either pBitmapRegion or hRgn will reference a region that contains all the removed bumps or nicks. If SMOOTH_LEAD_REGION is also set, pBitmapRegion will be updated with a shallow copy of pBitmap that has a LEAD region that contains all the removed bumps or nicks. If SMOOTH_LEAD_REGION is not set, hRgn is updated with a Windows region that contains all the removed nicks or bumps. When the region (either LEAD or Windows) is no longer needed, it must be destroyed.

 

SMOOTH_LEAD_REGION

When LBitmap::Smooth returns, pBitmapRegion is updated with a shallow copy of pBitmap that also contains a region with all the removed bumps or nicks. This flag must be used in conjunction with SMOOTH_SINGLE_REGION. To use this flag declare a variable of type BITMAPHANDLE and point pBitmapRegion to this variable. Then set uFlags to SMOOTH_SINGLE_REGION | SMOOTH_LEAD_REGION. This variable will be updated when LBitmap::Smooth returns.

 

SMOOTH_IMAGE_UNCHANGED

The original image is unchanged.

 

SMOOTH_FAVOR_LONG

Processes long bumps or nicks before short bumps or nicks. If this flag is not passed, short is favored over long. For example:

 

 

Smooth the following image with iLength == 3

 

 

X X 

 

 

XXXXXXXXXX

 

 

Favoring short would remove the two "bumps" giving:

 

 

XXXXXXXXXX

 

 

Favoring long would fill in the "gap" giving:

 

 

XXXXX 

 

 

XXXXXXXXXX

 

SMOOTH_ALLFLAGS

Use all behaviors of the smoothing process.

 

iLength

Length of the bump (or nick) to remove (or fill). All bumps and nicks less than or equal to this size are processed. This value is in pixels.

pBitmapRegion

Pointer to a variable of type BITMAPHANDLE. If SMOOTH_SINGLE_REGION | SMOOTH_LEAD_REGION have been set in uFlags, then when LBitmap::Smooth returns, this is updated with a shallow copy of pBitmap that also has a region that contains the removed bumps and nicks. To use this, declare a variable of type BITMAPHANDLE and point pBitmapRegion to this variable. Set uFlags to (SMOOTH_SINGLE_REGION | SMOOTH_LEAD_REGION). It is the programmer's responsibility to free the region using LBitmapRgn::Free() when it is no longer needed.

uBitmapStructSize

Size of the structure pointed to by pBitmapRegion. Use sizeof(BITMAPHANDLE).

hRgn

Handle to a windows region. When LBitmap::Smooth returns this is updated with a single windows region corresponding to all changes, only if SMOOTH_SINGLE_REGION has been set in uFlags and SMOOTH_LEAD_REGION has not been set. To use this, set the flags field to (SMOOTH_SINGLE_REGION). It is the programmer's responsibility to delete this region using the windows API DeleteObject() when the region is no longer needed.