ImageGear Professional for Windows ActiveX
ImageRect, ClipRect, and DeviceRect

ImageRect

This rectangle defines the part of the image that is output to the device. It is expressed in image coordinates. By default, this option is set to the entire image. Use the IGPageDisplay Object.Layout Property.ImageRect Property to change this.

ClipRect

This rectangle identifies the destination device area affected by the display operations. It is expressed by device coordinates and is initially assigned the entire client area of the IGPageViewCtl Control. Use the IGPageDisplay Object.Layout Property.ClipRect Property to change this.

DeviceRect

The image does not have to necessarily fit exactly into the device rectangle. The position of the image inside the device rectangle may also be determined by other display options such as AspectMode, FitMode, and AlignMode. Use the IGPageDisplay Object.Layout Property.DeviceRect Propertyto change this.

DisplayedImageRect

Although this is not a display option you can set, it is an important concept. This rectangular area represents the image's size and location on the device and, therefore, it is expressed in device coordinates. It is NOT related to the ClipRect Property, which represents the visible part of the image. The DisplayedImageRect's value can be calculated and used but cannot be set directly.

This figure demonstrates the meaning of the rectangles listed above:

Thus, if the ImageRect is left at its default value (equal to the entire image), and the DeviceRect and ClipRect are left at their default values (equal to the size of the IGPageViewCtl Control), and if the FitMode is IG_DSPL_FIT_TO_DEVICE, then the result will be as follows:

If your application then made the DisplayRect 2x wider and 2x taller, but left the ClipRect set to the size of the IGPageViewCtl Control (this is the same as setting a 2x zoom), then the following would result:

On the other hand, if your application left the DisplayRect set to the size of the IGPageViewCtl Control, but made the ClipRect Property half as wide and half as tall, then the following would result:

Note that the settings for ImageRect Property, DeviceRect Property, ClipRect Property, Layout.FitMode Property, Layout.Alignment Property, Zoom, Scroll and Orientation can specify conflicting values. The resolution to this is a hierarchy, wherein some of these properties take precedence over others. We will further explain how ImageGear deals with the options when their meaning is not immediately clear.

The general display rendering algorithm consists of several steps. Within each step, ImageGear processes some options to introduce modifications to the resulting image. ImageRect is oriented according to OrientMode. ClipRect and DeviceRect are calculated according to their definitions above.

If FitMode Property is set to IG_DSPL_ACTUAL_SIZE, then DisplayedImageRect.width and DisplayImageRect.height are set to ImageRect Property width and ImageRect Property height respectively. Otherwise, DisplayedImageRect is computed using DeviceRect Property. According to ZoomMode, ZoomValueH and ZoomValueV, DisplayedImageRect.width and DisplayedImageRect.height are modified as follows:

 
Copy Code
If (ZoomMode and IG_DSPL_ZOOM_H_FIXED) <> 0 then
DisplayedImageRect.width = DisplayedImageRect.width*ZoomValueH
End If
and
If (ZoomMode and IG_DSPL_ZOOM_V_FIXED) <> 0 then
DisplayedImageRect.height =
DisplayedImageRect.height*ZoomValueV
End If
If AspectMode is set to IG_DSPL_ASPECT_FIXED, ZoomValueV is not
used, and the above procedure is changed in the following way:
If (ZoomMode and IG_DSPL_ZOOM_H_FIXED) <> 0 then
DisplayedImageRect.width = DisplayedImageRect.width*ZoomValueH
DisplayedImageRect.height =
DisplayedImageRect.height*ZoomValueH
End If

DisplayedImageRect.x and DisplayedImageRect.y are computed so that DisplayedImageRect is aligned as specified by AlignMode. The scrolling range is calculated so that DisplayedImageRect can be viewed within ClipRect. Then DisplayedImageRect.x and DisplayedImageRect.y are shifted according to the current scroll position.

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback