SetPixelA() 공개 메소드

public SetPixelA ( int x, int y, byte value ) : void
x int
y int
value byte
리턴 void
예제 #1
0
파일: Bmp.cs 프로젝트: As-Tomas/PsHandler
        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);
        }
예제 #2
0
파일: Bmp.cs 프로젝트: As-Tomas/PsHandler
        public Bmp ___CutRectangle(Rectangle rect)
        {
            Bmp bmpCut = new Bmp(rect.Width, rect.Height);

            for (int y = rect.Y; y < rect.Height; y++)
            {
                for (int x = rect.X; x < rect.Width; x++)
                {
                    bmpCut.SetPixelA(x - rect.X, y - rect.Y, GetPixelA(x, y));
                }
            }

            return(bmpCut);
        }
예제 #3
0
        public Bmp ___CutRectangle(Rectangle rect)
        {
            Bmp bmpCut = new Bmp(rect.Width, rect.Height);

            for (int y = rect.Y; y < rect.Height; y++)
            {
                for (int x = rect.X; x < rect.Width; x++)
                {
                    bmpCut.SetPixelA(x - rect.X, y - rect.Y, GetPixelA(x, y));
                }
            }

            return bmpCut;
        }
예제 #4
0
        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;
        }