コード例 #1
0
        public void AverageColorSolid()
        {
            var size = new Size {
                Height = 12, Width = 12
            };
            var color = Color.AliceBlue;

            var gst = new ProceduralFragment(size, color);

            Assert.AreEqual(color.R, gst.AverageColor().R);
        }
コード例 #2
0
        public void GeneratedBitmapSanity()
        {
            Color          misty_rose = ImageProcessor.Imaging.Colors.RgbaColor.FromColor(Color.MistyRose);
            Color          red        = ImageProcessor.Imaging.Colors.RgbaColor.FromColor(Color.Red);
            BitmapFragment fragment   = new ProceduralFragment(new Size {
                Width = 3, Height = 3
            }, misty_rose).ToBitmapFragment();

            var color_pre = fragment.GetPixel(2, 2);

            fragment.SetPixel(2, 2, red);
            var color_post = fragment.GetPixel(2, 2);

            Assert.AreNotEqual(color_pre, color_post);
            Assert.AreEqual(misty_rose, fragment.GetPixel(1, 1));
            Assert.AreEqual(red, fragment.GetPixel(2, 2));
        }
コード例 #3
0
        public ProceduralHSVTileSet(string packname, int twidth, int theight, float[] hues, float saturation, float luminosity)
        {
            this.packname   = packname;
            this.twidth     = twidth;
            this.theight    = theight;
            this.hues       = hues;
            this.saturation = saturation;
            this.luminosity = luminosity;


            this.tiles = new List <IFragment>();

            foreach (var hue in hues)
            {
                var color = ImageProcessor.Imaging.Colors.HslaColor.FromHslaColor(hue, saturation, luminosity);
                var tile  = new ProceduralFragment(new Size {
                    Height = theight, Width = twidth
                }, color);
                this.tiles.Add(tile);
            }
        }