Using the Magnifying Glass

LEADTOOLS provides a "magnifying glass" for the LEADRasterView Control. This magnifying glass provides a means of "zooming in" on the image loaded into the LEADRasterView Control.

Use the "Magnifying Glass" if you want to:

image\sqrblit.gif control the painting options for the zoomed display.

image\sqrblit.gif set the contrast, gamma and intensity for the zoomed area.

Note that in the Document/Medical toolkits LEADTOOLS also provides a "Zoom View" that can be attached to a window handle.

Use the "Zoom View" if you want to:

image\sqrblit.gif display one or more zoomed views for a single displayed image

image\sqrblit.gif display an annotation in addition to the zoomed view

image\sqrblit.gif display callout lines

For more information about the Zoom View, refer to Using the Zoom View.

To start the magnifying glass procedure, call the StartMagGlass method. This method lets you set the following:

image\sqrblit.gif size of the magnifying glass

image\sqrblit.gif shape of the magnifying glass

image\sqrblit.gif magnifying glass border (color, thickness, appearance)

image\sqrblit.gif magnification level

image\sqrblit.gif section of the pixel on which to center the zoomed image

The user can check the HasMagGlass property to determine whether the control has a magnifying glass attached to it. As the magnifying glass is moved over an image, the zoomed - in view is also displayed.

A magnifying glass can be used in one of the following ways:

1.

Attach an ordinary magnifying glass to the control's window. To do this, set the EnableMagGlassEvent property to FALSE, do not set MAGGLASS_MANUAL_UPDATE in the MagGlassFlags property, and then call the StartMagGlass method. If you use the magnifying glass this way, there is no need to write any code to display the magnifying glass or to handle its movement across an image. All this is handled internally by LEADTOOLS.

2.

Attach a magnifying glass to the window's control and update the magnified image that is displayed using the MagGlassExt event. To do this, set the EnableMagGlassEvent property to TRUE before calling the StartMagGlass method. By setting the EnableMagGlassEvent property to TRUE, the MagGlassExt event will be fired each time the left mouse button is pressed, each time the left mouse button is released and each time the mouse is moved over the control while the left mouse button is pressed. Each time the MagGlassExt event is fired, you can get information about non-updated parts of the bitmap that need to be updated. This information can be obtained using the Pixel property. This needed information can then be passed to the UpdateMagGlass method to update the Magnifying Glass's zoomed display area. This enables the Magnifying Glass to paint the zoomed area more clearly. If the EnableMagGlassEvent property has been set to TRUE, the UpdateMagGlass method must be used to update the Magnifying Glass display area with the zoomed image. The MagGlassExt event works more efficiently when working with a Client/Server, available in the Multimedia/Internet toolkits, and using Internet methods to get the needed information. Using the magnifying glass this way, the user is involved with updating the displayed bitmap through the UpdateMagGlass method.

3.

In the third method, the user is responsible for manually updating the magnifying glass by handling the WM_LBUTTONDOWN, WM_LBUTTONDBLCLK, WM_LBUTTONUP, WM_MOUSEMOVE, WM_SETCURSOR and WM_KILLFOCUS messages instead of having them handled internally by LEADTOOLS. To do this, set MAGGLASS_MANUAL_UPDATE in the MagGlassFlags property. The magnifying glass can then be manipulated manually using the ShowMagGlass method, the SetMagGlassPos method, the UpdateMagGlassFromHandle method and the MagGlassCursor event. The ShowMagGlass method will show or hide the Magnifying Glass while SetMagGlassPos method will move the Magnifying Glass to a specified position. The UpdateMagFromHandle method can be used to update the bitmap that the Magnifying Glass displays in the zoomed display area. The MagGlassCursor event occurs repeatedly while the left mouse button is not pressed. This event lets the user set the Magnifying Glass cursor.

To set masks for certain colors to be masked from the zoomed - in display, LEADTOOLS provides the MagGlassMaskCount property and the MagGlassMask property. Setting the MagGlassMaskCount allocates the array of the MagGlassMask property. The MagGlassFlags property controls two behaviors of the Magnifying Glass:

1.

whether the colors set in the MagGlassMask property are the only displayed colors or the only masked colors in the displayed image.

2.

whether the Magnifying Glass will be manually updated.

LEADTOOLS provides two defined shapes for the Magnifying Glass: Rectangle and Ellipse. The UpdateMagGlassShape method lets you update the shape of the magnifying glass to one of the previously listed shapes, or to a custom shape.

To control the painting options for the zoomed display, use the following:

PanWinPaintPalette property

PanWinBitonalScaling property

PanWinPaintDither property

PanWinPaintScaling property

To control the Contrast, Gamma and Intensity of the zoomed area, use the following:

MagGlassPaintContrast property

MagGlassPaintGamma property

MagGlassPaintIntensity property

To use a custom shape for the magnifying glass, use the following:

PanWinPointer = 99 ' custom pointer
PanWinCursor = the custom cursor image

In addition to customizing the look of the magnifying glass itself, LEADTOOLS lets you customize the actual painting of the magnifying glass display area. For more information, refer to Customizing Magnifying Glass Painting.

When the magnifying glass is no longer needed, call the StopMagGlass method to stop the magnifying glass procedure.