MAGGLASSDATA

typedef struct _tagMAGGLASSDATA
{
   L_INT nWidth;
   L_INT nHeight;
   L_INT nZoom;
   COLORREF clrPen;
   COLORREF clrBack;
   L_BOOL bEllipse;
   L_INT nBorderSize;
   L_BOOL b3D;
   HCURSOR hCursor;
   L_UINT32 uPaintFlags;
   COLORREF pMask;
   L_UINT uMaskCount;
   L_INT nCrosshair;
   L_BOOL bIgnoreRgn;
   L_BOOL bCenter;
} MAGGLASSDATA, * pMAGGLASSDATA;

The MAGGLASSDATA structure specifies options for the magnifying glass.

The following functions make use of this structure:

LBitmapWindow::GetMagGlassOptions

LBitmapWindow::SetMagGlassOptions

Member

Description

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 for the border of the magnifying glass.This is ignored when bEllipse = FALSE and b3D = TRUE.

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.

 

hCursor

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

uPaintFlags

Flags that indicate how the zoomed image will be painted. These are the same as Flags for the LBitmapWindow::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.

nCrosshair

Value that indicates the type of crosshair to use. Possible values are:

 

 

Value

Meaning

 

CROSSHAIR_NONE

[0] No crosshair in the magnifying glass.

 

CROSSHAIR_FINE

[1] The crosshair is one pixel wide and is the color of clrPen.

 

CROSSHAIR_INVERTPEN

[2] The crosshair is three pixels wide. The center pixel is the color of clrPen and the outer pixels are the inverse of clrPen.

 

CROSSHAIR_INVERTSCREEN

[3] The crosshair is three pixels wide. The center pixel is the color of clrPen and the outer pixels are 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.

Comments

To use the magnifying glass, call the LBitmapWindow::GetMagGlassOptions function to get the current magnifying glass options. Next call the LBitmapWindow::SetMagGlassOptions function to set any new magnifying glass options to be used. Then call LBitmapWindow::SetToolType to set the tool type to TOOL_MAGGLASS.

The appearance of the magnifying glass depends on the values of bEllipse, clrPen, b3D and nBorderSize. This can be seen in the table below:

 

bEllipse

b3D

nBorderSize

clrPen

Result

TRUE

ignored

valid

valid

An elliptical magnifying glass of border size nBorderSize and border color clrPen.

FALSE

FALSE

valid

valid

A rectangular magnifying glass with a flat border of width nBorderSize and border color clrPen.

FALSE

TRUE

ignored

ignored

A rectangular magnifying glass with a 3D border having a set width and color.