CopyRect
CopyRect SrcSurface, SrcX1, SrcY1, SrcX2, SrcY2, DestSurface, DestX, DestT
 
Parameters:

    SrcSurface = The Source Surface (image or Screen) to copy from
    SrcX1 = The source region X (Top left) coordinate
    SrcY1 = The source region Y (Top left) coordinate
    SrcX2 = The source region X (Bottom Right) coordinate
    SrcY2 = The source region Y (Bottom Right) coordinate
    DestSurface = The Destination Surface (image or Screen) to copy to
    DestX = The destination region X (Top left) coordinate
    DestT = The destination region Y (Top left) coordinate
Returns: NONE
 

      CopyRect copies a rectangular section of pixels from one graphics surface to another. This command can be used to copy between various surface combinations ie. screen->screen, Image->Screen, Screen->Image or Image->Image.



      Surfaces

           0 = Screen
           1 or above = Image




FACTS:


      * CopyRect source and destination will be clipped to the destination surfaces viewport.

      * CopyRect treat an image index of zero as the screen. So CopyRect 0,10,10,20,20,1,100,100 is copying from the screen to image #1

      * If you want to copy a section of an image and resize it, see TextureQuad command.




Mini Tutorial:




  
  
  
  
; get the screen size
  sw=GetScreenWidth()
  sh=GetScreenHeight()
  
  
; Create a variable called size an assign this variable the value 256.
  Size=256
; Create a image using the Ball and size variables
  CreateImage 1,Size,Size
  
; get the image size
  iw=GetImageWidth(1)
  ih=GetImageHeight(1)
  
  
; Render a phong map styled shading to the image
  RenderPhongImage 1,iw/2,ih/2,$ff7fff,200,2.0
  
  
  scale#=1
  scaledir#=0.01
  Do
     Cls RGB(0,0,0)
     
   ; Copy a vertical strip of pixels from the image #1
   ; to Image #0 (the screen)
     For lp =0 To iw-1
        destY#=lp*Scale#
        CopyStripV  1,lp,0,ih,0,10+destY#,50
     Next
     
     
   ; Copy a horizontal strip of pixels from the image #1
   ; to Image #0 (the screen)
     For lp =0 To ih-1
        destY#=lp*Scale#
        CopyStripH 1,lp,0,iw,0,10,50+desty#
     Next
     
     
     Scale#=Scale#+ScaleDir#
     
     If Scale#>3 Then ScaleDir#=ScaleDir#*-1
     If Scale#<1 Then ScaleDir#=ScaleDir#*-1
     
     
     x=10
     y=50
   ; Copy section of he Screen (0) to the screen
     CopyRect 0,x,y,x+iw,y+ih,0,(sw/2),(sh/2)
     
     
     Sync
  Loop
  
  




 
Related Info: CopyImage | CopyStripH | CopyStripV | GetImage | TextureQuad :
 


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