Color of a screen pixel: Difference between revisions

Content added Content deleted
m (→‎Using GTK3: Remove unused assignment)
Line 717: Line 717:


proc getPixelColor(x, y: int32): Color =
proc getPixelColor(x, y: int32): Color =
var pixbuf = newPixbuf(Colorspace.rgb, false, 8, 1, 1)
var pixbuf = pixbufGetFromWindow(getDefaultRootWindow(), x, y, 1, 1)
pixbuf = pixbufGetFromWindow(getDefaultRootWindow(), x, y, 1, 1)
result = cast[ptr Color](pixbuf.readPixels())[]
result = cast[ptr Color](pixbuf.readPixels())[]