示例#1
0
        public override bool Equals(object obj)
        {
            FloatingColor F = (FloatingColor)obj;

            return(Math.Abs(F.R - _R) < _E &&
                   Math.Abs(F.G - _G) < _E &&
                   Math.Abs(F.B - _B) < _E &&
                   Math.Abs(F.A - _A) < _E);
        }
示例#2
0
 public FloatingImage(float[,] Map, Channel Channel)
 {
     _Pixels = new FloatingColor[Map.GetLength(0), Map.GetLength(1)];
     for (int i = 0; i < Width; ++i)
     {
         for (int j = 0; j < Height; ++j)
         {
             _Pixels[i, j] = new FloatingColor(Map[i, j], Channel);
         }
     }
 }
示例#3
0
        public FloatingImage(Image Image)
        {
            _Pixels = new FloatingColor[Image.Size.X, Image.Size.Y];

            for (uint i = 0; i < Image.Size.Y; ++i)
            {
                for (uint j = 0; j < Image.Size.X; ++j)
                {
                    _Pixels[j, i] = new FloatingColor(Image.GetPixel(j, i));
                }
            }
        }
示例#4
0
        public FloatingImage Filter(BlendFilter Filter, FloatingImage Image)
        {
            int Width  = _Pixels.GetLength(0);
            int Height = _Pixels.GetLength(1);

            FloatingColor[,] NewPixels = new FloatingColor[Width, Height];

            for (int i = 0; i < Width; ++i)
            {
                for (int j = 0; j < Height; ++j)
                {
                    NewPixels[i, j] = Filter.Filter(this[i, j], Image[i, j]);
                }
            }

            return(new FloatingImage()
            {
                _Pixels = NewPixels
            });
        }
示例#5
0
        public FloatingImage Filter(Filter Filter)
        {
            int Width  = _Pixels.GetLength(0);
            int Height = _Pixels.GetLength(1);

            FloatingColor[,] NewPixels = new FloatingColor[Width, Height];

            for (int i = 0; i < Width; ++i)
            {
                for (int j = 0; j < Height; ++j)
                {
                    NewPixels[i, j] = Filter.Filter(i, j, this) * Filter.Factor + Filter.Bias;
                }
            }

            return(new FloatingImage()
            {
                _Pixels = NewPixels
            });
        }
示例#6
0
        public Brush(int Radius, Interpolator.InterpolatorFunction Interpolator, BlendFilter BlendMode, FloatingColor Color)
        {
            this.Radius = Radius;
            int Width = Radius * 2 + 1;

            this.Color     = Color;
            this.BlendMode = BlendMode;
            Matrix         = new float[Width, Width];
            for (int i = 0; i < Width; ++i)
            {
                for (int j = 0; j < Width; ++j)
                {
                    int    X    = i - Radius;
                    int    Y    = j - Radius;
                    double Dist = Math.Sqrt(X * X + Y * Y) / Radius;
                    if (Dist > 1)
                    {
                        Dist = 1;
                    }
                    Matrix[i, j] = (float)Interpolator(Dist);
                }
            }
        }
示例#7
0
        public FloatingImage GenerateImage(int Width, int Height)
        {
            FloatingImage F   = new FloatingImage(Width, Height);
            float         Min = float.MaxValue;
            float         Max = float.MinValue;

            for (int i = 0; i < Width; ++i)
            {
                for (int j = 0; j < Height; ++j)
                {
                    float G = (float)Generate(i, j);
                    F[i, j] = new FloatingColor(G);
                    if (G > Max)
                    {
                        Max = G;
                    }
                    if (G < Min)
                    {
                        Min = G;
                    }
                }
            }
            return(F);
        }
示例#8
0
 public Pixel(int X, int Y, FloatingColor Color)
 {
     _X     = X;
     _Y     = Y;
     _Color = Color;
 }
示例#9
0
 public FloatingColor(FloatingColor Copy)
     : this(Copy.R, Copy.G, Copy.B, Copy.A)
 {
 }