示例#1
0
     public FloatingColor Filter(FloatingColor Base, FloatingColor Blend)
     {
         if (Blend.Luminosity() > .5)
         {
             return new FloatingColor()
                    {
                        R = Math.Max(Base.R, Blend.R),
                        G = Math.Max(Base.G, Blend.G),
                        B = Math.Max(Base.B, Blend.B),
                        A = Base.A
                    }
         }
         ;
         else
         {
             return new FloatingColor()
                    {
                        R = Math.Min(Base.R, Blend.R),
                        G = Math.Min(Base.G, Blend.G),
                        B = Math.Min(Base.B, Blend.B),
                        A = Base.A
                    }
         };
     }
 }
        Color MakeBackdropColor(Color BaseColor)
        {
            var f = new FloatingColor(BaseColor).MakeHSL();

            f.B = Math.Min(.2f, Math.Max(0, f.B - .2f));
            f.G = Math.Min(.2f, Math.Max(0, f.G - .2f));
            return(f.MakeRGB().ConvertToColor());
        }
示例#3
0
 public FloatingColor Filter(FloatingColor Base, FloatingColor Blend)
 {
     return(new FloatingColor()
     {
         R = Math.Abs(Base.R - Blend.R),
         G = Math.Abs(Base.G - Blend.G),
         B = Math.Abs(Base.B - Blend.B),
         A = Base.A
     });
 }
示例#4
0
文件: Darken.cs 项目: jascou/ROTNS
 public FloatingColor Filter(FloatingColor Base, FloatingColor Blend)
 {
     return(new FloatingColor()
     {
         R = Math.Min(Base.R, Blend.R),
         G = Math.Min(Base.G, Blend.G),
         B = Math.Min(Base.B, Blend.B),
         A = Base.A
     });
 }
示例#5
0
 public FloatingColor Filter(FloatingColor Base, FloatingColor Blend)
 {
     if (Blend.Luminosity() > .5)
     {
         return(1 - (1 - Blend) * (1.5f - Base));
     }
     else
     {
         return(Blend * (Base + .5f));
     }
 }
示例#6
0
 public FloatingColor Filter(FloatingColor Base, FloatingColor Blend)
 {
     if (Blend.Luminosity() > .5)
     {
         return(1 - (1 - Blend) * (-2 * Base));
     }
     else
     {
         return(Blend / (1 - 2 * Base));
     }
 }
示例#7
0
 public FloatingColor Filter(FloatingColor Base, FloatingColor Blend)
 {
     if (Blend.Luminosity() > .5)
     {
         return(1 + 2 * Blend * (1 - Base));
     }
     else
     {
         return(2 * Base * Blend);
     }
 }
示例#8
0
        public FloatingColor Evaluate(float Value)
        {
            FloatingColor R = new FloatingColor()
            {
                R = X.Evaluate(Value),
                G = Y.Evaluate(Value),
                B = Z.Evaluate(Value),
                A = W.Evaluate(Value)
            };

            return((_HSL) ? R.MakeRGB() : R);
        }
示例#9
0
文件: Edge.cs 项目: jascou/ROTNS
        public FloatingColor Filter(int X, int Y, FloatingImage Image)
        {
            FloatingColor x = ((Image[X + 1, Y + 1] - Image[X - 1, Y + 1]) + 2 * (Image[X + 1, Y] - Image[X - 1, Y]) + (Image[X + 1, Y - 1] - Image[X - 1, Y - 1]));
            FloatingColor y = ((Image[X - 1, Y - 1] - Image[X - 1, Y + 1]) + 2 * (Image[X, Y - 1] - Image[X, Y + 1]) + (Image[X + 1, Y - 1] - Image[X + 1, Y + 1]));

            x *= x;
            y *= y;

            return(new FloatingColor(
                       (float)Math.Sqrt(x.R + y.R),
                       (float)Math.Sqrt(x.G + y.G),
                       (float)Math.Sqrt(x.B + y.B)));
        }
示例#10
0
        public FloatingColor Filter(int X, int Y, FloatingImage Image)
        {
            int           Width = Radius * 2 + 1;
            FloatingColor R     = new FloatingColor(0, 0, 0);

            for (int i = 0; i < Width; ++i)
            {
                for (int j = 0; j < Width; ++j)
                {
                    int x = i - Radius;
                    int y = j - Radius;
                    R = R + Matrix[i, j] * Image[X + x, Y + y];
                }
            }

            return(R);
        }
示例#11
0
        public void Filter(FloatingImage Image, FloatingImage Field)
        {
            for (int i = 0; i < Field.Width; ++i)
            {
                for (int j = 0; j < Field.Height; ++j)
                {
                    Field[i, j] = new FloatingColor(0, 0, 0, 1f);
                }
            }
            Random Random = new Random();

            for (int i = 0; i < _Actors; ++i)
            {
                int X = Random.Next(0, Image.Width);
                int Y = Random.Next(0, Image.Height);
                HandleActor(X, Y, Image, Field);
            }
        }
示例#12
0
 public FloatingColor Filter(FloatingColor Base, FloatingColor Blend)
 {
     return(Base / Blend);
 }
示例#13
0
文件: Hue.cs 项目: jascou/ROTNS
        public FloatingColor Filter(int X, int Y, FloatingImage Image)
        {
            FloatingColor F = Image[X, Y].MakeHSL();

            return(new FloatingColor(F.R, 1, .5f).MakeRGB());
        }
示例#14
0
文件: Colorize.cs 项目: jascou/ROTNS
 public Colorize(FloatingColor Color)
 {
     this.Color = Color;
 }
示例#15
0
 public FloatingColor Filter(FloatingColor Base, FloatingColor Blend)
 {
     return(1 - Blend / (1 - Base));
 }
示例#16
0
 public FloatingColor Filter(FloatingColor Base, FloatingColor Blend)
 {
     return(.5f - 2 * (Base - .5f) * (Blend - .5f));
 }
示例#17
0
 public FloatingColor Evaluate(FloatingColor C)
 {
     return(Evaluate(C.Luminosity()));
 }
示例#18
0
        public UnitConfigurationView(
            UnitConfiguration UnitConfiguration, Faction Faction, UnitConfigurationRenderer Renderer, float Scale)
        {
            this.Scale = Scale;
            Color[] colors = UnitConfiguration.UnitClass == UnitClass.BLOCK ||
                             UnitConfiguration.UnitClass == UnitClass.MINEFIELD
                                                                                          ? new Color[] { Color.White } : Faction.Colors;
            if (!UnitConfiguration.IsVehicle)
            {
                colors = colors.ToArray();
                for (int i = 0; i < colors.Length; ++i)
                {
                    var f = new FloatingColor(colors[i]);
                    f         = f.MakeHSL();
                    f.B       = Math.Min(1, f.B + .1f);
                    colors[i] = f.MakeRGB().ConvertToColor();
                }
            }

            _Vertices = new Vertex[colors.Length * 4];
            float barHeight            = 1f / colors.Length;
            var   backgroundRenderInfo = Renderer.GetRenderInfo(null);

            _BackgroundTexture = backgroundRenderInfo.Item1;
            var v = backgroundRenderInfo.Item2;

            for (int i = 0; i < colors.Length; ++i)
            {
                float yT = v[0].Y + ((float)i / colors.Length) * (v[0].Y + v[2].Y);
                float yB = v[0].Y + ((float)(i + 1) / colors.Length) * (v[0].Y + v[2].Y);
                _Vertices[i * 4] =
                    new Vertex(new Vector2f(-.5f, i * barHeight - .5f), colors[i], new Vector2f(v[0].X, yT));
                _Vertices[i * 4 + 1] =
                    new Vertex(new Vector2f(.5f, i * barHeight - .5f), colors[i], new Vector2f(v[2].X, yT));
                _Vertices[i * 4 + 2] =
                    new Vertex(new Vector2f(.5f, (i + 1) * barHeight - .5f), colors[i], new Vector2f(v[2].X, yB));
                _Vertices[i * 4 + 3] =
                    new Vertex(new Vector2f(-.5f, (i + 1) * barHeight - .5f), colors[i], new Vector2f(v[0].X, yB));
            }

            var renderInfo = Renderer.GetRenderInfo(UnitConfiguration);

            _Texture       = renderInfo.Item1;
            _ImageVertices = new Vertex[4];
            Color c = Renderer.RenderDetails[UnitConfiguration.UniqueKey].OverrideColor;

            if (c.R == 0 && c.G == 0 && c.B == 0)
            {
                c = colors.ArgMax(i => new FloatingColor(i).Luminosity());
            }

            var tl = new Vector2f(-.5f, -.5f);
            var tr = new Vector2f(.5f, -.5f);
            var br = new Vector2f(.5f, .5f);
            var bl = new Vector2f(-.5f, .5f);

            _ImageVertices[0] = new Vertex(tl, c, renderInfo.Item2[0]);
            _ImageVertices[1] = new Vertex(tr, c, renderInfo.Item2[1]);
            _ImageVertices[2] = new Vertex(br, c, renderInfo.Item2[2]);
            _ImageVertices[3] = new Vertex(bl, c, renderInfo.Item2[3]);

            _Bounds = new Rectangle(new Vector2f(-.5f, -.5f) * Scale, new Vector2f(1, 1) * Scale);
        }
示例#19
0
 public FloatingColor Filter(FloatingColor Base, FloatingColor Blend)
 {
     return(Blend + 2 * Base - 1);
 }
示例#20
0
        public FloatingColor Filter(int X, int Y, FloatingImage Image)
        {
            FloatingColor C = (Image[X, Y + 1] + Image[X + 1, Y]) - (Image[X - 1, Y] + Image[X, Y - 1]);

            return(C);
        }