GetSpriteImageIntensity
IntensityLevel = GetSpriteImageIntensity(SpriteIndex, VertexIndex)
 
Parameters:

    SpriteIndex = The Sprite you wish to query
    VertexIndex = The Vertex your wish to query
Returns:

    IntensityLevel = The intensity level ranges betwen 0 and 255)
 

      The GetSpriteImageIntensity() function returns the current Intensity level at any corner of the sprite.



FACTS:


      * Intensity values range from 0 to 255. (255=No Fade, 0 Totally faded out)

      * Sprites vertex range from vertex 0 to 3. They are ordered 0= top left, 1 top right, 2 bottom right, 3 bottom left.

      * Note: Sprites are drawn using a convex polygons, changing the intensity values can cause some render errors. So some care is needed to get good result.

      * Also See SpriteImageIntensity & SpriteDrawMode





Mini Tutorial:


      This example creates an random image then applies this image to the screen full of sprites. Each sprites has it's UV coordinates stepped in and faded intensity values, so the sprites will show the various stages of texel zooming with a gouraud fade applied.


  
; set variable to hold the image width and height
  ImgWidth=130
  ImgHeight=130
  
; First we'll create FX image
  MyImage=NewFXImage(ImgWidth,Imgheight)
  
  
; tell pb to redirect all drawing operations
; to this image
  RenderToImage MyImage
  
; Fill it with boxes
  For lp=0 To ImgWidth/2
     BoxC lp,lp,ImgWidth-lp,ImgHeight-lp,true,RndRGB()
  Next lp
  
  
; Tell PB to re-direc all drawing back to the screen
  RenderToScreen
  
  
  MaxSprites=10
  
  pad=80
  y=pad
  x=(pad*2)
  
; Start a For next loop to create a collection of sprites
  For lp=0 To MaxSprites
   ; create a sprite and assign it MyImage
     Spr=NewSprite(X,y,MyImage)
     
   ; Center it's handle on this image
     CenterSpriteHandle spr
     
   ; Set this sprite to Draw Mode #2 (rotated) + Shaded
     SpriteDrawMode spr,2+128
     
     clip=lp*12
     
   ; set the Intensity at 4 corners of this sprite
     SpriteImageIntensity Spr,0,255-Clip
     SpriteImageIntensity Spr,1,200-Clip
     SpriteImageIntensity Spr,2,100-Clip
     SpriteImageIntensity Spr,3,200-Clip
     
     DrawSprite Spr
     
     
   ; Read the Sprites Vertex positions
     For Vertex=0 To 3
        Vx#=GetSpriteVertexX(Spr,Vertex)
        Vy#=GetSpriteVertexY(Spr,Vertex)
        I     =GetSpriteIMageIntensity(Spr,Vertex)
        
        CenterText vx#,vy#,Str$(i)
     Next vertex
     
     x=x+250
     If x=>(GetScreenWidth()-pad)
        X=(Pad*2)
        Y=y+200
     EndIf
  Next
  
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  


 
Related Info: GetSpriteImageRGB | GetSpriteImageU | GetSpriteImageV | SpriteDrawMode | SpriteImage | SpriteImageIntensity | SpriteImageRGB | SpriteImageUV :
 


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