Esempio n. 1
0
        public void ImplicitOperatorExtendedColors()
        {
            Color          c  = Color.FromArgb(unchecked ((int)0xFFA1A187));
            ExtendedColors ec = ExtendedColors.FromArgb(c.ToArgb());

            Assert.AreEqual(unchecked ((int)0xFFA1A187), ec.ToArgb());
        }
Esempio n. 2
0
        public void GetSaturationTest()
        {
            ExtendedColors ec = ExtendedColors.FromKnownColor(KnownExtendedColors.MareaBaja);
            Color          c  = Color.FromArgb(unchecked ((int)0xFF2E5464));

            Assert.AreEqual(Math.Round(c.GetSaturation(), MidpointRounding.AwayFromZero), Math.Round(ec.GetSaturation(), MidpointRounding.AwayFromZero));
        }
        public ExampleMenu(ComapactGraphicsV2.CompactGraphics graphics) : base(graphics)
        {
            Random rng = new Random();

            listItems = new List <StyledTextT>();
            for (int i = 0; i < 200; i++)
            {
                listItems.Add(new StyledTextT()
                {
                    content = new List <ColoredStringT>()
                    {
                        new ColoredStringT($"S{rng.Next()}")
                    }
                });
            }
            test = new Frame('#', new Rect(1, 9, 1, 9), ConsoleColor.White, ConsoleColor.Black, Widget.DrawPoint.Center);
            onPage.Add(test);
            r         = new Rect(20, 40, 40, 60);
            content   = new Life(80, 60, 100, 50);
            pallet    = new ExtendedColors();
            pixelGrid = new PixelGrid(r);
            testGrid  = new PixelGrid(new Rect(10, 50, 30, 70));
            //onPage.Add(testGrid);
            onPage.Add(pixelGrid);


            onPage.Add(new ListBox(listItems, new Rect(20, 120, 10, 20), true));
            //onPage.Add(new ListBox(new List<Textbox>(), new Rect(10,40,5,40)));
            //onPage.Add(new Frame('%', r));
            //onPage.Add(new Button(r, "This is some text"));
        }
Esempio n. 4
0
        public void ImplicitOperatorColors()
        {
            Color          c  = Color.FromArgb(unchecked ((int)0xFF996244));
            ExtendedColors ec = c;

            Assert.AreEqual(unchecked ((int)0xFF996244), ec.ToArgb());
        }
Esempio n. 5
0
        public void IsEmptyTest()
        {
            ExtendedColors ec = new ExtendedColors();

            Assert.AreEqual(true, ec.IsEmpty);

            ExtendedColors ec2 = ExtendedColors.FromArgb(unchecked ((int)0xFF795484));

            Assert.AreEqual(false, ec2.IsEmpty);
        }
Esempio n. 6
0
        public void IsNamedColorTest()
        {
            ExtendedColors ec = ExtendedColors.FromName("VodoYellow");

            Assert.AreEqual(true, ec.IsNamedColor);

            ExtendedColors ec2 = ExtendedColors.FromArgb(unchecked ((int)0xFF795482));

            Assert.AreEqual(false, ec2.IsNamedColor);
        }
Esempio n. 7
0
        public void IsKnownColorTest()
        {
            ExtendedColors ec = ExtendedColors.FromName("MareaBaja");

            Assert.AreEqual(true, ec.IsKnownColor);

            ExtendedColors ec2 = ExtendedColors.FromArgb(unchecked ((int)0xFF795482));

            Assert.AreEqual(false, ec2.IsKnownColor);
        }
Esempio n. 8
0
        public void EqualsTest()
        {
            ExtendedColors ec  = ExtendedColors.MareaBaja;
            ExtendedColors ecc = ExtendedColors.MareaBaja;

            Assert.AreEqual(true, ec.Equals(ecc));

            ExtendedColors ecc2 = ExtendedColors.MarchWind;

            Assert.AreEqual(false, ec.Equals(ecc2));
        }
Esempio n. 9
0
        public void NotEqualTest()
        {
            ExtendedColors ec  = ExtendedColors.MareaBaja;
            ExtendedColors ecc = ExtendedColors.MarchWind;

            Assert.AreNotEqual(ecc, ec);

            ExtendedColors ec2  = ExtendedColors.MareaBaja;
            ExtendedColors ecc2 = ExtendedColors.MareaBaja;

            Assert.AreEqual(false, ecc2 != ec2);
        }
Esempio n. 10
0
        private void AddColors()
        {
            string[] sitems = new string[] { "", "" };
            int      count  = 0;

            foreach (KnownExtendedColors ec in EnumUtil.GetValues <KnownExtendedColors>())
            {
                sitems[1] = ec.ToString();
                ListViewItem lv = new ListViewItem(sitems);
                lv.SubItems[0].BackColor = ExtendedColors.FromKnownColor(ec);

                lvColorLst.Items.Add(lv);
                lvColorLst.Items[count].UseItemStyleForSubItems = false;
                count++;
            }
        }
Esempio n. 11
0
        private void DropdownControl2_DrawTextArea(object sender, DrawTextAreaEventArgs e)
        {
            Rectangle bounds   = e.TextArea;
            Rectangle scolor   = new Rectangle(bounds.X, bounds.Y, 12, bounds.Height);
            Rectangle textArea = new Rectangle(bounds.X + 12, bounds.Y, bounds.Width - 12, bounds.Height);

            using (SolidBrush sb = new SolidBrush(SystemColors.HighlightText))
            {
                e.Graphics.FillRectangle(sb, e.TextArea);
            }

            using (SolidBrush sb = new SolidBrush(ExtendedColors.FromName(ColorName)))
            {
                e.Graphics.FillRectangle(sb, scolor);
            }

            TextRenderer.DrawText(e.Graphics, ColorName, this.Font, textArea, Color.Black, TextFormatFlags.EndEllipsis);
        }
Esempio n. 12
0
        static void Main(string[] args)
        {
            int[]           rgb = new int[] { 255, 0, 0 };
            CompactGraphics graphics;

            if (args.Length == 2)
            {
                graphics = new CompactGraphics(int.Parse(args[0]), int.Parse(args[1]));
            }
            else
            {
                graphics = new CompactGraphics(500, 200);
            }
            //CompactGraphics.Graphics.SetColor(ConsoleColor.White, 244, 106, 7);
            ExampleMenu    menu         = new ExampleMenu(graphics);
            ExtendedColors customPallet = new ExtendedColors();
            Input          I            = new Input();

            customPallet.SetColor("Sea Green", Color.FromArgb(46, 139, 87), ConsoleColor.Green);
            //graphics.FrameCap = 120;
            //Contunually draw frames
            while (true)
            {
                rgb = stepRainbow(rgb);
                //graphics.AddToPallet(Color.FromArgb(rgb[0], rgb[1], rgb[2]));
                ExtendedColors.SetColor(ConsoleColor.White, Color.FromArgb(rgb[0], rgb[1], rgb[2]));
                //update the UI
                menu.StepFrame(I);
                graphics.Draw($"{graphics.Fps} fps", ConsoleColor.White, 0, 0);
                graphics.Draw($"{graphics.TimeToDraw} drawTime", customPallet.GetColor("Sea Green"), 0, 1);
                graphics.Draw($"{graphics.TimeToFrame} ttf", ConsoleColor.White, 0, 2);
                //graphics.Draw($"{rgb[0]}, {rgb[1]}, {rgb[2]}", ConsoleColor.Red, 0, 6);
                //now that all drawing is done, push the frame to the buffer.
                graphics.pushFrame();
                //Console.WriteLine("\u001b[31mHello World!\u001b[0m");
            }
        }
Esempio n. 13
0
        public void ToStringTest()
        {
            ExtendedColors ec = ExtendedColors.FromKnownColor(KnownExtendedColors.MareaBaja);

            Assert.AreEqual("ExtendedColors [MareaBaja]", ec.ToString());
        }
Esempio n. 14
0
        public void RedTest()
        {
            ExtendedColors ec = ExtendedColors.FromName("MareaBaja");

            Assert.AreEqual(46, ec.R);
        }
Esempio n. 15
0
        public void NameTest()
        {
            ExtendedColors ec = ExtendedColors.FromName("MareaBaja");

            Assert.AreEqual("MareaBaja", ec.Name);
        }
Esempio n. 16
0
        public void BLUTest()
        {
            ExtendedColors ec = ExtendedColors.FromName("MareaBaja");

            Assert.AreEqual(100, ec.B);
        }
Esempio n. 17
0
        public void GRNTest()
        {
            ExtendedColors ec = ExtendedColors.FromName("MareaBaja");

            Assert.AreEqual(84, ec.G);
        }
Esempio n. 18
0
        public void ALPATest()
        {
            ExtendedColors ec = ExtendedColors.FromName("MareaBaja");

            Assert.AreEqual(255, ec.A);
        }
Esempio n. 19
0
        public void ToArgbTest()
        {
            ExtendedColors ec = ExtendedColors.FromKnownColor(KnownExtendedColors.MareaBaja);

            Assert.AreEqual(unchecked ((int)0xFF2E5464), ec.ToArgb());
        }
Esempio n. 20
0
        public void ToKnownColorTest()
        {
            ExtendedColors ec = ExtendedColors.FromKnownColor(KnownExtendedColors.MareaBaja);

            Assert.AreEqual(unchecked (KnownExtendedColors.MareaBaja), ec.ToKnownColor());
        }
Esempio n. 21
0
        public void FromArgbDTest()
        {
            ExtendedColors ec = ExtendedColors.FromArgb(90, ExtendedColors.MareaBaja);

            Assert.AreEqual(unchecked ((int)0x5A2E5464), ec.ToArgb());
        }
Esempio n. 22
0
        public void FromArgbCTest()
        {
            ExtendedColors ec = ExtendedColors.FromArgb(255, 46, 84, 100);

            Assert.AreEqual(unchecked ((int)0xFF2E5464), ec.ToArgb());
        }