How can I change the color of a pixel with coordinates x and y in the image?
How can I change the color of a pixel with only the coordinates (x, y) of the image I have? (only 1 pixel).
private static bool boyalganmi(int x, int y)
{
//ushbu nuqtalar 2480x3508 o'lchamdagi list uchun
(int, int)[] nuqta = new[] { (x, y), (x, y - 18), (x + 13, y - 13), (x + 18, y),
(x + 13, y + 13), (x, y + 18), (x - 13, y + 13), (x - 18, y), (x - 13, y - 13) };
int oq = 0, qora = 0, boshqa = 0;
foreach ((int, int) nuqtaItem in nuqta)
{
var imageXY = Image.GetPixel(nuqtaItem.Item1%2480, nuqtaItem.Item2%3508);
if (imageXY.R > 225 && imageXY.G > 225 && imageXY.B > 225)
{
oq++;
Color green = Color.FromArgb(255, 0, 128, 0);
Image.SetPixel(nuqtaItem.Item1, nuqtaItem.Item2, Color.Green);
}
else if (imageXY.R < 10 && imageXY.G < 10 && imageXY.B < 10)
{
qora++;
Color red = Color.FromArgb(255, 225, 0, 0);
Image.SetPixel(nuqtaItem.Item1, nuqtaItem.Item2, Color.Red);
}
else { boshqa++; MessageBox.Show($"RGB({imageXY.R},{imageXY.G},{imageXY.B})"); }
}
//MessageBox.Show($"oq={oq}, qora={qora}, boshqa={boshqa}");
return oq > qora;
}