Click or drag to resize

IMcDisplayMapImageToZoomed Method

Convert image pixel coordinates into screen coordinates.

Namespace:  MediaCy.IQL.Display.Viewer
Assembly:  MediaCy.IQL.Display.Viewer (in MediaCy.IQL.Display.Viewer.dll) Version: 10.0.6912.0
Syntax
VB
Sub MapImageToZoomed ( 
	ByRef pvarFloatImageCoords As Object,
	<OutAttribute> ByRef pvarLongZoomedCoords As Object,
	Optional bClientRelative As Boolean = true,
	Optional eMapMode As mcViewZoomMappingMode = mcViewZoomMappingMode.mvzmmPixelNormal
)

Parameters

pvarFloatImageCoords
Type: SystemObject
VARIANT* : A SafeArray of floating point image coordinates.
pvarLongZoomedCoords
Type: SystemObject
VARIANT* : A SafeArray of resulting integer zoomed coordinates.
bClientRelative (Optional)
Type: SystemBoolean
BOOL : Optional, indicates whether the conversion should account for Pan and Scroll (the default). When TRUE, the zoomed coordinate (0,0) is the upper left corner pixel of the client window managed by the viewer. When FALSE, the zoomed coordinate (0,0) represents the actual upper left pixel of the image.
eMapMode (Optional)
Type: MediaCy.IQL.Display.ViewermcViewZoomMappingMode
mcViewZoomMappingMode : Optional. There are four types of pixel coordinate mappings available: mvzmmPixelNormal, mvzmmPixelUpperLeft, mvzmmPixelLowerRight, and mvzmmPixelCenter. These options allow for various overlay display capabilities. eMapMode mvzmmPixelNormal is for converting floating point image coordinates (which may be fractionally between image pixel centers) into the closest zoomed integral coordinate. The mvzmmPixelUpperLeft, mvzmmPixelLowerRight, and mvzmmPixelCenter eMapMode's are for determining the corners of a zoomed pixel; in these cases it is assumed that the floating point image pixel coordinates will not be a fractional value.
Remarks
The Viewer supports non-integral zoomed display of images via a form of pixel replication based on a classic technique called DDA. With this technique, not all zoomed image pixels are displayed using the exact same number of paint surface (i.e. the VGA client window or screen) pixels. All image pixel coordinates are in 32 bit signed floating point. All paint surface coordinates, referred to below as "Zoomed Coordinates", are 32 bit signed integers. As a general rule, the origin is the Upper Left corner of the image or paint surface. It is easiest to think of an image pixel as a tile. One can never have less than a tile, either in the image, or on the paint surface. When zooming, a single pixel tile is duplicated some number of times in both the X and Y direction. In the following illustration, image pixel 1 is duplicated 3 times in both the X and Y direction - a total of 9 Paint Surface tiles will contain the single image pixel value. Image Paint Surface ----- ------------- 1234 1112223333444 5678 1112223333444 9ABC 1112223333444 DEFG 5556667777888 5556667777888 5556667777888 999AAABBBBCCC 999AAABBBBCCC 999AAABBBBCCC 999AAABBBBCCC DDDEEEFFFFGGG DDDEEEFFFFGGG DDDEEEFFFFGGG Zoom == 3.3 Note that pixels 3, 7, B, and F are repeated four times, as well as row "9ABC". This allows the IMAGE to be zoomed 3.3 times. Clients, both the Overlay manager and application code, will need to convert between an image coordinate and the corresponding paint surface coordinate, without knowing the implementation details of the specific DDA implementation. To accomplish this, the viewer has exposed two methods: MapImageToZoomed() and MapZoomedToImage(). Important note -- The origin of each individual image pixel (a single tile) is its mathematical center. It's actual bounding rectangle is (-0.5,-0.5) and (0.499999, 0.499999). The center of each pixel is illustrated in the above example by highlighting the corresponding paint surface pixel. Each small square in the illustration below represents a single tile as it is represented on the paint surface (client window). The three large squares represent a single image pixel at three zoom factors. A Single Image Pixel at: 1x 2x 3x X XX XXX XX XXX XXX In the table below, the number pairs represent the corresponding paint surface coordinate within the illustration above. The coordinates are numbered from zero. NS means - not shown above. mvzmmPixelNormal mvzmmPixelCenter mvzmmPixelUpperLeft mvzmmPixelLowerRight 2x 3x 2x 3x 2x 3x 2x 3x 0.0 1, 1 1, 1 1, 1 1, 1 0, 0 0, 0 1, 1 2, 2 0.3 1, 1 2, 2 1, 1 1, 1 0, 0 0, 0 1, 1 2, 2 0.5 2, 2 (NS) 3, 3 (NS) 1, 1 1, 1 0, 0 0, 0 1, 1 2, 2 0.6 2, 2 (NS) 3, 3 (NS) 1, 1 1, 1 0, 0 0, 0 1, 1 2, 2 0.9 2, 2 (NS) 4, 4 (NS) 1, 1 1, 1 0, 0 0, 0 1, 1 2, 2 When the Magnification is 1.0, MapImageToZoomed() reduces to a simple floor() call - the fractional part is ignored. When the Magnification is 1.0 or less, the MapImageToZoomed() enumeration is ignored.
Note Note
When this method is called from within the AboutToPaint or the PostPaint methods of the _IMcViewEvents or _IMcBasicViewEvents event interfaces, then "zoomed coordinates" are interpreted as logical coordinates for the device context being drawn into (the lHDC argument in the notification calls). At all other times, "zoomed coordinates" are client coordinates (i.e., logical coordinates when the mapping mode is set to MM_TEXT).
See Also