; ReadPixel Example ; ----------------- Graphics 640,480,0,2 SetBuffer BackBuffer() ; A colourful photo to inspect logo=LoadImage("media/b3dlogo.jpg") While Not KeyDown(1) Cls DrawImage logo,120,140 ; ReadPixel returns the packed ARGB value of the pixel under the mouse argb=ReadPixel(MouseX(),MouseY()) ; Split the packed value into its colour components r=(argb Shr 16) And 255 g=(argb Shr 8) And 255 b=argb And 255 ; Show the colour we read as a swatch next to the pointer Color r,g,b Rect MouseX()+12,MouseY()+12,24,24,1 Color 255,255,255 Rect MouseX()+11,MouseY()+11,26,26,0 Text 0,0,"Move the mouse over the photo Esc: exit" Text 0,20,"ReadPixel("+MouseX()+","+MouseY()+") = "+argb+" -> RGB "+r+","+g+","+b Flip Wend End