GetImageViewPortX2
Xpos = GetImageViewPortX2(ImageIndex)
 
Parameters:

    ImageIndex = The Image you wish to query
Returns:

    Xpos = The coordinate of the images viewport
 

      GetImageViewPortX2 reads the X coordinate (bottom right) of the images viewport.




FACTS:


     * By default an images viewport will be set to 0,0 - ImageWidth,ImageHeight

      * See ImageViewport for more information on image viewports

     * GetImageViewPortX2 can also be used to query the screens current viewport settings by using the image number of zero. See ScreenViewport for more information on screen viewports





Mini Tutorial:


      Create an image, change it's viewport, and show the effects of the change.

  
  
; First Create an image, colour it blue and draw a red circle on it..
  size = 200
  CreateImage 1,Size,Size
  RenderToImage 1
  
; Clear the Image to the bluey colour
  Cls RGB(0,100,255)
  
; Set the Images Viewport (clipping area) so that it's  50 pixels inside it's size
  ImageViewPort 1,50,50,Size-50,size-50
  
; Clear the image (clipped to the view port) to a green colour
  Cls RGB(0,200,0)
  
; Draw a bunch of circles to this image..
  For lp =0 To 100
     CircleC Rnd(Size),Rnd(Size),Rnd(10),1,RndRGB()
  Next
  
; redirect all drawing to the Screen
  RenderToScreen
  
  
;  Draw this image as a solid image.
  DrawImage 1,100,100,0
  
; Display the Pixel coordinates of the images Viewport
  Print "Images ViewPort X1:"+Str$(GetImageViewPortX1(1))
  Print "Images ViewPort Y1:"+Str$(GetImageViewPortY1(1))
  Print "Images ViewPort X2:"+Str$(GetImageViewPortX2(1))
  Print "Images ViewPort Y2:"+Str$(GetImageViewPortY2(1))
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  
  


This example would output.

  
  Images ViewPort X1: 50
  Images ViewPort Y1: 50
  Images ViewPort X2: 150
  Images ViewPort Y2: 150
  

 
Related Info: GetImageViewPortX1 | GetImageViewPortY1 | GetImageViewPortY2 | ImageViewPort :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com