NewImage
ImageIndex = NewImage(Width, Height, [Format =1])
 
Parameters:

    Width = The width of the Image in pixels
    Height = The Height of the Image in pixels
    [Format =1] = Optional Image Format Parameter (1=Video, 2=fX, 8= AFX)
Returns:

    ImageIndex = The Index of the newly created Image
 

     The NewImage() function creates a blank Image in memory and returns this new images index for you. When images are created, they're filled in with a black colour (Rgb(0,0,0)).


Image Format Parameter:

      PlayBASIC has various types of Image formats, each one suited for different uses.

           1 = Video - Image is created in Video Memory
           2 = FX - System Memory Image
           8 = AFX - System Memory Image With Alpha Channel


      To learn more about images we recommend you read the CreateImage as well as the Images and Sprites tutorials




FACTS:


      * Video + FX Images created via NewImage are depth compatibile with the current screen display mode. So if the program is running on a 16bit screen mode, then the Image will also be 16bit. You can manually create FX images of any depth using CreateFxIMageEx, but not Video images. AFX formatted images are 32bit regardless.

      * NewImage 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.




Mini Tutorial:


This example creates a new Image in memory, renders some graphics to it, then it draws this Image to the screen.


  
; Create a new Image
  MyImage=NewImage(200,200)
  
; Tell PB to Render all graphics to this Image
  RenderToImage MyImage
  
; 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 to the screen at position 100x,100y
  DrawImage MyImage,100,100,0
  
; Display the Screen and wait for the user to press a key
; before ending
  Sync
  WaitKey
  




 
Related Info: CreateFxImage | CreateFxImageEx | CreateImage | DeleteImage | DrawImage | GetFreeImage | LoadAFxImage | LoadFxImage | LoadImage | LoadNewImage | NewFxImage | PrepareAFXimage | PrepareFXimage | RenderToImage :
 


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