Using the Magnifying Glass
LEADTOOLS provides a "magnifying glass" for the Main Control. This magnifying glass provides a means of "zooming in" on the image loaded into the Main Control To start the magnifying glass procedure, call the StartMagGlass method. This method lets you set the following:
size of the magnifying glass
shape of the magnifying glass
magnifying glass border (color, thickness, appearance)
magnification level
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, 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. |
In the second 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 OnMagGlassCursor event. The ShowMagGlass method will show or hide the Magnifying Glass while the 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 area. The OnMagGlassCursor 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:
whether the colors set in the MagGlassMask property are the only displayed colors or the only masked colors in the displayed image.
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:
To control the Contrast, Gamma and Intensity of the zoomed area, use the following:
MagGlassPaintContrast property
MagGlassPaintIntensity property
To use a custom shape for the magnifying glass, use the following:
When the magnifying glass is no longer needed, call the StopMagGlass method to stop the magnifying glass procedure.