Color of a screen pixel: Difference between revisions
Content deleted Content added
No edit summary |
|||
Line 423:
return new Robot().getPixelColor(x, y);
}</lang>
=={{header|Julia}}==
<lang julia>
# Windows GDI version
function getpixelcolors(x, y)
hdc = ccall((:GetDC, "user32.dll"), UInt32, (UInt32,), 0)
pxl = ccall((:GetPixel, "gdi32.dll"), UInt32, (UInt32, Cint, Cint), hdc, Cint(x), Cint(y))
return pxl & 0xff, (pxl >> 8) & 0xff, (pxl >> 16) & 0xff
end
const x = 120
const y = 100
cols = getpixelcolors(x, y)
println("At screen point (x=$x, y=$y) the colors are red: $(cols[1]), green: $(cols[2]), and blue: $(cols[3])")
</lang> {{output}} <pre>
At screen point (x=120, y=100) the colors are red: 1, green: 36, and blue: 86
</pre>
=={{header|Kotlin}}==
|