Color of a screen pixel: Difference between revisions

From Rosetta Code
Content added Content deleted
(Added BASIC)
m (→‎{{header|BASIC}}: Doesn't need a function)
Line 14: Line 14:


In a graphics mode (for instance, <tt>SCREEN 13</tt> or <tt>SCREEN 12</tt>)
In a graphics mode (for instance, <tt>SCREEN 13</tt> or <tt>SCREEN 12</tt>)
<lang qbasic>function getColor(x!, y!)
<lang qbasic>color = point(x, y)</lang>
getColor = point(x, y)
end function</lang>

Revision as of 21:17, 27 May 2009

Task
Color of a screen pixel
You are encouraged to solve this task according to the task description, using any language you may know.

Get color information from an arbitrary pixel on the screen, such as the current location of the mouse cursor

AutoHotkey

<lang AutoHotkey> loop, 200 { MouseGetPos, MouseX, MouseY PixelGetColor, color, %MouseX%, %MouseY% TrayTip, color, color at the current cursor is %color%. sleep, 500 } </lang>

BASIC

Works with: QuickBasic version 4.5

In a graphics mode (for instance, SCREEN 13 or SCREEN 12) <lang qbasic>color = point(x, y)</lang>