IMcViewMapImageToZoomed 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
SyntaxSub 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
An array of Single X,Y pairs of image coordinates. - pvarLongZoomedCoords
- Type: SystemObject
An array into which the resulting X,Y Long zoomed
coordinates is returned. - bClientRelative (Optional)
- Type: SystemBoolean
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: Normal, UpperLeft, LowerRight, and Center.
These options allow for various overlay display capabilities.
Special values indicate that the pvarFloatImageCoords X,Y values are
magnification limits or maximum Pan,Scroll values when there is no
ImageToDisplay.
RemarksThe 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.
Normal Center UpperLeft LowerRight
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 ZoomFactor is 1.0, MapImageToZoomed() reduces to a simple floor()
call - the fractional part is ignored.
When the ZoomFactor is 1.0 or less, the MapImageToZoomed() enumeration is ignored.
This method may also be used to set limits on the allowed magnifcation (if the
eMapMode argument is mvzmmSetWheelMagnificationLimits) and the maximum Pan,Scroll values
when there is no ImageToDisplay.
See Also