Color of a screen pixel: Difference between revisions
Content deleted Content added
→{{header|Java}}: Not incomplete, this function will get the color of an arbitrary pixel on the screen, that is all that's required |
|||
Line 46: | Line 46: | ||
=={{header|C sharp|C#}}== |
=={{header|C sharp|C#}}== |
||
<lang csharp>using System; |
<lang csharp>using System; |
||
using System.Drawing; |
using System.Drawing; |
||
using System.Windows.Forms; |
using System.Windows.Forms; |
||
class Program |
|||
Bitmap img = new Bitmap(1, 1); |
|||
{ |
|||
Graphics g = Graphics.FromImage(img); |
|||
static Color GetPixel(Point position) |
|||
⚫ | |||
{ |
|||
using (var bitmap = new Bitmap(1, 1)) |
|||
{ |
|||
using (var graphics = Graphics.FromImage(bitmap)) |
|||
{ |
|||
⚫ | |||
} |
|||
return bitmap.GetPixel(0, 0); |
|||
} |
|||
} |
|||
static void Main() |
|||
Color color = img.GetPixel(x, y);</lang> |
|||
{ |
|||
Console.WriteLine(GetPixel(Cursor.Position)); |
|||
} |
|||
}</lang> |
|||
Sample output: |
|||
<lang>Color [A=255, R=243, G=242, B=231]</lang> |
|||
=={{header|Clojure}}== |
=={{header|Clojure}}== |