private void drawOnePixelWithBrightness(int x, int y, double brightness) { int alpha = (int)(brightness * 255); if (alpha > 255) { alpha = 255; } if (alpha < 0) { alpha = 0; } Color color = Color.FromArgb(alpha, Color.Red); SetPixelFunc func = new SetPixelFunc(SetPixel); try { if (x >= 0 && y >= 0 && x < picBox_main.Width && y < picBox_main.Height) { picBox_main.Invoke(func, x, y, color); } } catch (InvalidOperationException) { return; } }
private void drawOnePixel(int x, int y) { SetPixelFunc func = new SetPixelFunc(SetPixel); try { if (x >= 0 && y >= 0 && x < picBox_main.Width && y < picBox_main.Height) { picBox_main.Invoke(func, x, y, Color.Red); } } catch (InvalidOperationException) { return; } }