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); }
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); } } }
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)); } } }
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 }); }
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 }); }
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); } } }
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); }
public Pixel(int X, int Y, FloatingColor Color) { _X = X; _Y = Y; _Color = Color; }
public FloatingColor(FloatingColor Copy) : this(Copy.R, Copy.G, Copy.B, Copy.A) { }