ScaleImage
ScaleImage ImageNumber, ScaleX, ScaleY, [Mode=1]
 
Parameters:

    ImageNumber = The Index of the image that you wish to scale
    ScaleX = Either The X Scalar or the New image Width
    ScaleY = Either The Y Scalar or the New image height
    [Mode=1] = The Scale mode to use (0= ScaleX/Y are scalers, 1= absolute sizes (default))
Returns: NONE
 

     ScaleImage allows you to scale an image in two ways. Either via a applying a Scalar to the images current size, or via assigning it an absolute size for this image.



Scale Mode Values

      Mode 0 = (Scaler Mode) Makes ScaleImage use the SCALE X & Y parameters as multipliers of the images current width & height. (ie. NewWidth=OldWidth * ScaleX, NewHeight=OldHeight*ScaleY)

      MODE 1 = (Absolute Mode) Makes ScaleImage use the SCALE X & Y parameters as the images new size.


      Mode 2 = (Scaler Mode With Bilinear Filtering) Makes ScaleImage use the SCALE X & Y parameters as multipliers of the images current width & height. The scaling uses bi-linear filtering to help smooth out the re-sized image.


      MODE 3 = (Absolute Mode With Bilinear Filtering) Makes ScaleImage use the SCALE X & Y parameters as the images new size. The scaling uses bi-linear filtering to help smooth out the re-sized image.




FACTS:


      * WARNING Be VERY careful when choosing your scaling mode. If you accidentally choose scalar mode (mode 0), and apply some large scalar values, you'll most likely make your computer run out of memory ! Possibly even crash it. So BE VERY CAREFUL !

      * ScaleImage changes the physical dimensions of the image. Therefore, once you've scaled an image you can't restore to it's original state. We recommend using TextureQuad, DrawRotatedImage or Sprites for real time (none destructive) scaling

* ScaleImage only supports images up to 4096x by 4096y pixels.



 
Example Source: Download This Example
; Clear the Screen to a dark blue colour
  Cls RGB(30,50,150)
  
; Load the Ship image into image slot #1
  LoadFxImage ProgramDir$()+"Help/Commands/Media/ship.bmp",1
  
  
; DRaw the original Image
  Text 100,100,"Original Image"
  DrawImage 1,100,120,false
  
  
; Make some copies of the original image
  CopyImage 12
  CopyImage 13
  
; Scale Image 2, up 4 times it's original size
  ScaleImage 2,4,4,0  ; (use Scaler mode)
  
  Text 100,200,"Scaled image (no filter)"
  DrawImage 2,100,220,false
  
  
  
; Scale Image 3, up 4 times it's original
; size with Filter
  ScaleImage 3,4,4,2  ; (Scaler With Filtering mode )
  Text 500,200,"Scaled image With filter"
  DrawImage 3,500,220,false
  
  
  
  Sync
  WaitKey
  
  
  
  
 
Related Info: FadeImage | LightImage | MirrorImage | RenderPhongImage | RGBmaskImage | ScrollImage | TextureQuad :
 


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