GetSpriteImageRGB
VertexColour = GetSpriteImageRGB(SpriteIndex, VertexIndex)
 
Parameters:

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

    VertexColour = The RGB colour value of this vertex
 

      The GetSpriteImageRGB() return the RGB colour value level at any of the sprites corner vertex.



FACTS:


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

      * The RGB colours values only take effect when sprite is set to "Gouraud RGB" drawmode. See 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 coords stepped in and have random RGB values applied, so the sprites will shown the various stages of texel zooming with a gouraud RGB applied to them also.


  
; set variable to hold the image width and height
  ImgWidth=150
  ImgHeight=150
  
; 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-direct 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 this sprites image handles
     CenterSpriteHandle spr
     
   ; Set this sprite to Draw Mode #2 (rotated) + Shaded
     SpriteDrawMode spr,2+256
     
     clip=lp*10
     
   ; set the 4 UV corners of this sprite
     SpriteImageUV Spr,0,Clip,Clip
     SpriteImageRGB Spr,0,RndRGB()
     
     SpriteImageUV Spr,1,ImgWidth-Clip,Clip
     SpriteImageRGB Spr,1,RndRGB()
     
     SpriteImageUV Spr,2,ImgWidth-Clip,ImgHeight-Clip
     SpriteImageRGB Spr,2,RndRGB()
     
     SpriteImageUV Spr,3,clip,ImgHeight-Clip
     SpriteImageRGB Spr,3,RndRGB()
     
     DrawSprite Spr
     
   ; Read the Sprites Vertex positions
     For Vertex=0 To 3
        Vx#=GetSpriteVertexX(Spr,Vertex)
        Vy#=GetSpriteVertexY(Spr,Vertex)
        Col=GetSpriteImageRGB(Spr,Vertex)
        r=RgbR(col)
        g=RgbG(col)
        b=RgbB(col)
        
        s$=Digits$(r,3)+","
        s$=s$+Digits$(g,3)+","+Digits$(b,3)+""
        CenterText vx#,vy#,s$
     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: GetSpriteImageU | GetSpriteImageV | SpriteDrawMode | SpriteImageIntensity | SpriteImageRGB | SpriteImageUV :
 


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