MAGGLASSOPTIONS

typedef struct tag_MagGlassOptions
{
   L_UINT uStructSize;
   L_INT nWidth;
   L_INT nHeight;
   L_INT nZoom;
   L_COLORREF clrPen;
   L_HCURSOR hMagCursor;
   L_COLORREF clrBack;
   L_BOOL bEllipse;
   L_INT nBorderSize;
   L_BOOL b3D;
   L_UINT uPaintFlags;
   L_COLORREF * pMask;
   L_UINT uMaskCount;
   L_UINT uMagGlassFlags;
   L_INT nCrosshair;
   L_BOOL bIgnoreRgn;
   L_BOOL bCenter;
} MAGGLASSOPTIONS, *pMAGGLASSOPTIONS;

The MAGGLASSOPTIONS structure provides magnifying glass paint options information for the L_SetMagGlassPaintOptions function.

Member

Description

uStructSize

Size of this structure in bytes, for versioning. 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. (i.e. 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 L_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 the behavior 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 the manual update of 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. It becomes the user’s responsibility to control the Magnifying Glass by using the L_ShowMagGlass and L_SetMagGlassPos functions.

 

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.