CreateFxImage
CreateFxImage ImageIndex, Width, Height
 
Parameters:

    ImageIndex = The Index of the image that you wish to create.
    Width = The width of the image in pixels
    Height = The Height of the image in pixels
Returns: NONE
 

      CreateFxImage creates a blank FX image in memory ready for use. While FX images can be drawn and drawn onto like regular images, their primary use is for Real Time effects like rotation.

      You can think of an Image as a picture. You might use them to storing the individual frames of your game characters, game logos, maps enviroments, backdrops etc etc. You can also perform a host of drawing operations upon Images. including rotation, shading, texture mapping and many more using the various provided image commands.

      All media including images in PlayBASIC are stored and referred to via their media index. Valid indexes will range between 1 and the maximum number allowed of this particular media type (ie. images/sprites/shapes/maps etc - See GetImageQuantity() for the actual amount). So if you think about it, images are really just stored in a list, where the index we use refers to the particular image within the list.



FACTS:


     * CreateFxImage does not change PlayBASIC current graphics output. So if you want to redirect all drawing operations to a newly created image, you'll have to do this manually via RenderToImage.

     * CreateFxImage is an alternative to using the CreateImage with the optional format parameter. So we create FX images either way, but some people prefer not to use optional / format parameters with CreateImage in their code as they feel it's help with code readability.





Mini Tutorial:


      This example creates FX Image #1 in system memory. Next it renders some graphics to it, then it draws this image to the screen.


  
; Create FX image #1
  CreateFXImage 1,200,200
  
; Tell PB to Render all graphics to image #1
  RenderToImage 1
  
; Clear this image with some random colour
  Cls RndRGB()
  
; Draw some dots to this image
  For lp =0 To 1000
     DotC Rnd(200),Rnd(200),RndRGB()
  Next
  
; Tell PB to now render all graphics directly to the screen
  RenderToScreen
  
; Draw the image #1 to the screen at position 50x,100y
  DrawImage 1,50,100,0
  
; DRaw a rotated copy of this image to the scree
  DrawRotatedImage 1,400,200,45,1,1,-100,-100,false
  
; Display the Screen and wait for the user to press a key
; before ending
  Sync
  WaitKey
  
  




 
Related Info: CreateImage | DeleteImage | DrawImage | GetFreeImage | LoadImage | NewImage | PrepareFXimage | RenderToImage :
 


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