CImageView:GetZoom


The GetZoom method returns the image magnification, or "zoom" factor in the CImageView window.

Syntax

nZoom = CImageView:GetZoom()

where

    nZoom is an integer zoom number.

  

Mira displays images with the following zoom factors: 1/16, 1/8, 1/4, 1/2, 1, 2, 4, 8, and 16. This is encoded as the integer zoom numbers -16, -8, -4, -2, 1, 2, 4 , 8, and 16. The value ofnZoom must be one of these integer numbers.

Example

Suppose a CImageI is displayed in a CImageView objectV. The following script retrieves the zoom factor and redisplays the image at twice the current zoom.

 

nZoom = V:GetZoom()

-- retrieve the current zoom factor

if ( nZoom == -2 ) then

-- bump zoom=-2 up to zoom=1

  nZoom = 1

 

elseif ( nZoom < 0 ) then

-- for example: turn -4 into -2

  nZoom = nZoom / 2

 

else

 

  nZoom = nZoom * 2

-- for example: turn 2 into 4

end

 

V:SetZoom( nZoom )

-- redisplay with 2x the previous zoom.

Related Topics

SetZoom

CImageView class

CImage class