Exemplo n.º 1
0
        public void SetPixelChecked(int X, int Y, FastColor Clr)
        {
            if (X < 0 || X >= Width || Y < 0 || Y >= Height)
            {
                return;
            }

            SetPixel(X, Y, Clr);
        }
Exemplo n.º 2
0
 public static bool IsAlpha(FastColor C)
 {
     return(C.R == 0 && C.G == 0 && C.B == 0 && C.A == 0);
 }
Exemplo n.º 3
0
        public FastBitmap Extend()
        {
            FastBitmap NewBitmap = new FastBitmap(Width, Height);

            for (int Y = 0; Y < Height; Y++)
            {
                for (int X = 0; X < Width; X++)
                {
                    FastColor Cur;

                    if (FastColor.IsAlpha(Cur = GetPixel(X, Y)))
                    {
                        FastColor CopyClr;

                        // Top row
                        if (!FastColor.IsAlpha(CopyClr = GetPixelChecked(X - 1, Y + 1)))
                        {
                            NewBitmap.SetPixel(X, Y, CopyClr);
                            continue;
                        }
                        if (!FastColor.IsAlpha(CopyClr = GetPixelChecked(X, Y + 1)))
                        {
                            NewBitmap.SetPixel(X, Y, CopyClr);
                            continue;
                        }
                        if (!FastColor.IsAlpha(CopyClr = GetPixelChecked(X + 1, Y + 1)))
                        {
                            NewBitmap.SetPixel(X, Y, CopyClr);
                            continue;
                        }

                        // Cur row
                        if (!FastColor.IsAlpha(CopyClr = GetPixelChecked(X - 1, Y)))
                        {
                            NewBitmap.SetPixel(X, Y, CopyClr);
                            continue;
                        }
                        if (!FastColor.IsAlpha(CopyClr = GetPixelChecked(X + 1, Y)))
                        {
                            NewBitmap.SetPixel(X, Y, CopyClr);
                            continue;
                        }

                        // Bottom row
                        if (!FastColor.IsAlpha(CopyClr = GetPixelChecked(X - 1, Y - 1)))
                        {
                            NewBitmap.SetPixel(X, Y, CopyClr);
                            continue;
                        }
                        if (!FastColor.IsAlpha(CopyClr = GetPixelChecked(X, Y - 1)))
                        {
                            NewBitmap.SetPixel(X, Y, CopyClr);
                            continue;
                        }
                        if (!FastColor.IsAlpha(CopyClr = GetPixelChecked(X + 1, Y - 1)))
                        {
                            NewBitmap.SetPixel(X, Y, CopyClr);
                            continue;
                        }
                    }
                    else
                    {
                        NewBitmap.SetPixel(X, Y, Cur);
                    }
                }
            }

            return(NewBitmap);
        }
Exemplo n.º 4
0
 public void SetPixel(int X, int Y, FastColor Clr)
 {
     Scan0[Y * Stride + X] = Clr;
 }