Reading a pixel

BlitzMax Forums/BlitzMax Beginners Area/Reading a pixel

Hi
@Xmicky: Why you dont use GrabPixmap direct?
My Solution:


Strict

Graphics 800,600,0




Repeat
   Cls

   SetColor 255,0,0
   Plot 60,60

   Local r,g,b
   ColorOnPosition(60,60,r,g,b)

   SetColor 255,255,255
   DrawText "RED: "+r, 10,10
   DrawText "GREEN: "+g,10,30
   DrawText "BLUE: "+b,10,50


   Flip
   FlushMem()
Until KeyHit(KEY_ESCAPE)


Function ColorOnPosition(x:Int, y:Int, r:Int Var, g:Int Var, b:Int Var)
   Local TempPixmap:TPixmap = GrabPixmap(x,y,1,1)
   Local TempPtr:Byte Ptr = TempPixmap.PixelPtr(0,0)
   r = TempPtr[2]
   g = TempPtr[1]
   b = TempPtr[0]
End Function

Mfg suco