public SetPixelG ( int x, int y, byte value ) : void | ||
x | int | |
y | int | |
value | byte | |
리턴 | void |
public Bmp ToHighContrastClone() { double h, s, l; Bmp bmpHighContrast = new Bmp(Width, Height); for (int y = 0; y < Height; y++) { for (int x = 0; x < Width; x++) { if (GetPixelA(x, y) < byte.MaxValue / 2) { bmpHighContrast.SetPixelA(x, y, 0); bmpHighContrast.SetPixelR(x, y, 0); bmpHighContrast.SetPixelG(x, y, 0); bmpHighContrast.SetPixelB(x, y, 0); } else { RgbToHsl(GetPixelR(x, y), GetPixelG(x, y), GetPixelB(x, y), out h, out s, out l); if (l < 0.5) { bmpHighContrast.SetPixelA(x, y, 255); bmpHighContrast.SetPixelR(x, y, 0); bmpHighContrast.SetPixelG(x, y, 0); bmpHighContrast.SetPixelB(x, y, 0); } else { bmpHighContrast.SetPixelA(x, y, 255); bmpHighContrast.SetPixelR(x, y, 255); bmpHighContrast.SetPixelG(x, y, 255); bmpHighContrast.SetPixelB(x, y, 255); } } } } return(bmpHighContrast); }
public Bmp ToHighContrastClone() { double h, s, l; Bmp bmpHighContrast = new Bmp(Width, Height); for (int y = 0; y < Height; y++) { for (int x = 0; x < Width; x++) { if (GetPixelA(x, y) < byte.MaxValue / 2) { bmpHighContrast.SetPixelA(x, y, 0); bmpHighContrast.SetPixelR(x, y, 0); bmpHighContrast.SetPixelG(x, y, 0); bmpHighContrast.SetPixelB(x, y, 0); } else { RgbToHsl(GetPixelR(x, y), GetPixelG(x, y), GetPixelB(x, y), out h, out s, out l); if (l < 0.5) { bmpHighContrast.SetPixelA(x, y, 255); bmpHighContrast.SetPixelR(x, y, 0); bmpHighContrast.SetPixelG(x, y, 0); bmpHighContrast.SetPixelB(x, y, 0); } else { bmpHighContrast.SetPixelA(x, y, 255); bmpHighContrast.SetPixelR(x, y, 255); bmpHighContrast.SetPixelG(x, y, 255); bmpHighContrast.SetPixelB(x, y, 255); } } } } return bmpHighContrast; }