Anonymous user
Color of a screen pixel: Difference between revisions
→{{header|Tcl}}: + Standard ML
(→{{header|Tcl}}: + Standard ML) |
|||
Line 990:
<lang Scala>def getColorAt(x: Int, y: Int): Color = new Robot().getPixelColor(x, y)</lang>
=={{header|Standard ML}}==
Works with PolyML
<lang Standard ML>open XWindows ;
val disp = XOpenDisplay "" ;
val im =
let
val pos = #4 (XQueryPointer (RootWindow disp)) ;
in
XGetImage (RootWindow disp) (MakeRect pos (AddPoint(pos,XPoint{x=1,y=1})) ) AllPlanes ZPixmap
end;
XGetPixel disp im (XPoint {x=0,y=0}) ;</lang>
result
val it = 6371827: int
=={{header|Tcl}}==
{{libheader|Tk}}
|