DrawAlphaImage
DrawAlphaImage ImageNumber, Xpos, Ypos, AlphaLevel#, SolidFlag
 
Parameters:

    ImageNumber = The identifier of this image
    Xpos = The X coordinate to draw the image at
    Ypos = The Y coordinate to draw the image at
    AlphaLevel# = The amount the image should be blended
    SolidFlag = This flag toggles if the image is rendered solid (no transparent parts) or not
Returns: NONE
 

      DrawAlphaImage renders an Alpha Blended image to the current surface. Generally the current output will be the screen, but you can also draw images directly to another image.

      Alpha Blending works like a cross fade between the foreground (the image) and the back ground.


AlphaLevel# Ranges (0.0 to 1.0)


0.00 = Blend is completely the background
0.25 = Blend is 75% background and 25% foreground
0.50 = Blend is 50% back and foreground
0.75 = Blend is 75% foreground and 25% background
1.00 = Blend is completely the foreground






      Note: We highly recommended you read the Images tutorials





FACTS:


      * DrawAlphaImage renders an image to current surface, except when the user either CaptureToScene or CaptureToWorld are activated. In either situation the render request will be added to the scene or world queues.

      * Alpha Blending in PlayBASIC is done via the computers cpu, rather than a graphics card. So it should be used sparingly. Moreover, it's slower blending to the screen than another image.

      * Note: The the best performance, your image should be previously prepared as an FX image using PrepareFxImage, LoadFxImage,NewFxImage




Mini Tutorial:


      This small example shows how to create an image, prepare the image for effects and then alpha blend it to the display.

  
  
; Create an Image of a Circle
  Size=120
  CreateImage 1,Size,Size
  RenderToImage 1
  Cls RndRGB()
  
; Prepare Image 1 so that it can be used in Real time
; effects like rotation and alpha
  PrepareFXImage 1
  
; redirect All drawing to the Screen.
  RenderToScreen
  
; Start a loop
  Do
     
   ; Clear the screen to black
     Cls RGB(60,40,30)
     
   ; Read the mouses position
     mx#=MouseX()
     my#=MouseY()
     
   ; Draw Message at the mouse position
     CenterText mx#+(size/2),my#+(size/2),"DrawAlphaImage"
     
   ; Alpha Blend our image over the top of the text message
     DrawAlphaImage 1,mx#,my#,SinNewValue(75,angle#,25)/100,1
     angle#=WrapAngle(angle#,5)
     
   ; Display the screen and loop until the users presses the ESC key.
     
     Sync
  Loop
  
  



 
Related Info: DrawImage | DrawRotatedImage | GridImage | Images | LoadFxImage | NewFxImage | PrepareFXImage | TileImage :
 


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