RequestColor(r,g,b)?
Or you could use a Canvas and read the pixel's colour [edit: I found my little error Local x !=ax for the color box loop)
SuperStrict
Local MyWindow:TGadget=CreateWindow("Canvas Example", 200,200,320,240)
Local MyCanvas:TGadget=CreateCanvas(10,10,16*16,140,MyWindow)
Local x:Int=0
Local y:Int = 0
Local r:Int , g:Int , b:Int
local ax:int
ActivateGadget MyCanvas
Local rr:Int=0
Repeat
WaitEvent()
Select EventID()
Case EVENT_WINDOWCLOSE
End
Case EVENT_MOUSEMOVE
x=EventX()
y=EventY()
RedrawGadget(MyCanvas)
Case EVENT_GADGETPAINT
SetGraphics CanvasGraphics (MyCanvas)
rr=0
For ax = 0 To ClientWidth(MyCanvas) / 16
SetColor rr , 0 , 0
rr:+16
DrawRect ax*15 , 0 , 15,ClientHeight(mycanvas)
Next
GetPixel(x,y,r,g,b)
Print "R G B "+r+" "+g+" "+b+" XY "+x+" "+y
Flip
End Select
Until False
Function GetPixel(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
|