MAGGLASSOPTIONS

typedef struct _MAGGLASSOPTIONS
{
   L_UINT uStructSize; /* structure size */
   L_INT nWidth; /* width of the magnifying glass */
   L_INT nHeight; /* height of the magnifying glass */
   L_INT nZoom; /* zoom factor */
   L_COLORREF clrPen; /* border color */
   L_HCURSOR hMagCursor; /* handle to a custom cursor */
   L_COLORREF clrBack; /* color */
   L_BOOL bEllipse; /* flag that indicates the shape of the magnifying glass */
   L_INT nBorderSize; /* border size */
   L_BOOL b3D; /* flag that indicates whether the magnifying glass border is 3D */
   L_UINT uPaintFlags; /* flags that indicate how the zoomed image will be painted */
   L_COLORREF * pMask; /* array of color values */
   L_UINT uMaskCount; /* number of colors */
   L_UINT uMagGlassFlags; /* flags that control two behaviors of the magnifying glass */
   L_INT nCrosshair; /* type of crosshair */
   L_BOOL bIgnoreRgn; /* flag that indicates whether to magnify a region */
   L_BOOL bCenter; /* flag that indicates how to center the magnifie

} MAGGLASSOPTIONS, * pMAGGLASSOPTIONS;

The MAGGLASSOPTIONS structure provides magnifying glass options information for the LBitmapWindow::SetMagGlassOptions function.

The following functions make use of this structure:

LBitmapWindow::GetMagGlassOptions

LBitmapWindow::SetMagGlassOptions

 

Member

Description

uStructSize

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

nWidth

The width of the magnifying glass. Minimum size is 10 pixels.

nHeight

The height of the magnifying glass. Minimum size is 10 pixels.

nZoom

The zoom factor for the magnification, in percentage. This value must be >= 100. For example, to zoom the image 2X, specify 200 for nZoom.

clrPen

The color of the border of the magnifying glass. This is ignored when bEllipse = FALSE and b3D = TRUE.

hMagCursor

Handle to a custom cursor to use for the Magnify Glass procedure. Pass NULL to use the default cursor.

 

When bEllipse = TRUE, the default cursor will be:

 

image\MagGls.gif

 

When bEllipse = FALSE, the default cursor will be:

 

image\MagGls2.gif

clrBack

The color to use for painting areas not covered by the zoomed image. (that is, when the magnifying glass is not completely over the image.)

bEllipse

Flag that indicates the shape of the magnifying glass. Possible values are:

 

Value

Meaning

 

TRUE

The magnifying glass is an Ellipse

 

FALSE

The magnifying glass is a Rectangle

nBorderSize

The size of the magnifying glass border in pixels. This value is ignored when bEllipse = FALSE and b3D = TRUE. In this case the magnifying glass appears as a rectangle with a 3D border. The 3D border has a thickness of 2 pixels, one pixel for the highlight color and one for the shadow color.

b3D

Flag that indicates whether the border of a rectangular magnifying glass appears as 3D or flat. This value is valid only if bEllipse is FALSE. Possible values are:

 

Value

Meaning

 

TRUE

The rectangular magnifying glass appears with a 3D border.

 

FALSE

The rectangular magnifying glass appears with a flat border.

uPaintFlags

Flags that indicate how the zoomed image will be painted. These are the same as Flags for the LBitmapBase::SetDisplayMode function. You can pass 0 to use the current DisplayMode settings. Or, You can specify all the flags you wish to use. If uPaintFlags != 0, then This function will turn off all flags before setting the values you specify. For example, you can use DISPLAYMODE_BICUBIC to make the zoomed image look better.

pMask

Optional array of color values to mask out of the Magnified display.

uMaskCount

Number of colors in the pMask array.

uMagGlassFlags

Flags that control two behaviors of the magnifying glass:

 

 

1. Flags that indicate which colors in the zoomed image will be displayed and which colors will be masked. Possible values are:

 

Value

Meaning

 

MAGGLASS_MASK_NORMAL

[0x0000] Works in two ways:

 

 

1. When this flag is set without setting MAGGLASS_MASK_FROM_REGION flag, then only those colors present in the pMask parameter will be masked in the Magnifying Glass display area. All other colors will be displayed.

 

 

2. When this flag is set in combination with setting MAGGLASS_MASK_FROM_REGION flag, then the colors present in the pMask parameter will be ignored and only the bitmap region colors will be masked in the Magnifying Glass display area. All other colors will be displayed.

 

MAGGLASS_MASK_INVERT

[0x0001] Works in two ways:

 

 

1. When this flag is set without setting MAGGLASS_MASK_FROM_REGION flag, then only those colors present in the pMask parameter will be displayed in the Magnifying Glass display area. All other colors will be masked.

 

 

2. When this flag is set in combination with setting MAGGLASS_MASK_FROM_REGION flag, then the colors present in the pMask parameter will be ignored and only the bitmap region colors will be displayed in the Magnifying Glass display area. All other colors will be masked.

 

MAGGLASS_MASK_FROM_REGION

[0x0004] Works only if the Bitmap has a region, LEADTOOLS will get all colors from this region and either masks or displays these colors according to MAGGLASS_MASK_NORMAL and MAGGLASS_MASK_INVERT flags.

 

Note: This feature that is provided by this flag works ideally with rectangle regions since LEADTOOLS gets the bounding rectangle of the Bitmap region then gets all the colors of this rectangle.

 

2. Flags that enable or disable manually updating the magnifying glass:

 

Value

Meaning

 

MAGGLASS_MANUAL_UPDATE

[0x0002] When this flag is set, LEADTOOLS will not handle the mouse events in order to manipulate the Magnifying Glass.

 

3. Miscellaneous flags:

 

Value

Meaning

 

MAGGLASS_RIGHTMOUSE

[0x0008] When this flag is set, LEADTOOLS will display the Magnifying Glass when the user presses and holds the right mouse button instead of the left mouse button.

nCrosshair

Specifies the type of crosshair. Possible values are:

 

Value

Meaning

 

CROSSHAIR_NONE

[0] No Crosshair

 

CROSSHAIR_FINE

[1] The crosshair is one pixel wide and uses the color in clrPen

 

CROSSHAIR_INVERTPEN

[2] The crosshair is three pixels wide. The center pixel uses the color in clrPen. The outer pixels use the inverse of the color in clrPen.

 

CROSSHAIR_INVERTSCREEN

[3] The crosshair is three pixels wide. The center pixel uses the color in clrPen. The outer pixels use the inverse of the screen color.

 

bIgnoreRgn

Flag that indicates whether to magnify only the region in the source bitmap, or to ignore it. Possible values are:

 

Value

Meaning

 

TRUE

Ignore any existing regions within the source bitmap.

 

FALSE

Magnify only the region within the source bitmap. Data outside the region will be replaced with the color in clrBack.

bCenter

Flag that indicates how to center the magnified area. Possible values are:

 

Value

Meaning

 

TRUE

The zoomed rectangle is centered on the center of the pixel at the center of the magnifying glass.

 

FALSE

The zoomed rectangle is centered on the top, left corner of the pixel at the center of the magnifying glass.