public void ImplicitOperatorExtendedColors() { Color c = Color.FromArgb(unchecked ((int)0xFFA1A187)); ExtendedColors ec = ExtendedColors.FromArgb(c.ToArgb()); Assert.AreEqual(unchecked ((int)0xFFA1A187), ec.ToArgb()); }
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")); }
public void ImplicitOperatorColors() { Color c = Color.FromArgb(unchecked ((int)0xFF996244)); ExtendedColors ec = c; Assert.AreEqual(unchecked ((int)0xFF996244), ec.ToArgb()); }
public void IsEmptyTest() { ExtendedColors ec = new ExtendedColors(); Assert.AreEqual(true, ec.IsEmpty); ExtendedColors ec2 = ExtendedColors.FromArgb(unchecked ((int)0xFF795484)); Assert.AreEqual(false, ec2.IsEmpty); }
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); }
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); }
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)); }
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); }
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++; } }
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); }
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"); } }
public void ToStringTest() { ExtendedColors ec = ExtendedColors.FromKnownColor(KnownExtendedColors.MareaBaja); Assert.AreEqual("ExtendedColors [MareaBaja]", ec.ToString()); }
public void RedTest() { ExtendedColors ec = ExtendedColors.FromName("MareaBaja"); Assert.AreEqual(46, ec.R); }
public void NameTest() { ExtendedColors ec = ExtendedColors.FromName("MareaBaja"); Assert.AreEqual("MareaBaja", ec.Name); }
public void BLUTest() { ExtendedColors ec = ExtendedColors.FromName("MareaBaja"); Assert.AreEqual(100, ec.B); }
public void GRNTest() { ExtendedColors ec = ExtendedColors.FromName("MareaBaja"); Assert.AreEqual(84, ec.G); }
public void ALPATest() { ExtendedColors ec = ExtendedColors.FromName("MareaBaja"); Assert.AreEqual(255, ec.A); }
public void ToArgbTest() { ExtendedColors ec = ExtendedColors.FromKnownColor(KnownExtendedColors.MareaBaja); Assert.AreEqual(unchecked ((int)0xFF2E5464), ec.ToArgb()); }
public void ToKnownColorTest() { ExtendedColors ec = ExtendedColors.FromKnownColor(KnownExtendedColors.MareaBaja); Assert.AreEqual(unchecked (KnownExtendedColors.MareaBaja), ec.ToKnownColor()); }
public void FromArgbDTest() { ExtendedColors ec = ExtendedColors.FromArgb(90, ExtendedColors.MareaBaja); Assert.AreEqual(unchecked ((int)0x5A2E5464), ec.ToArgb()); }
public void FromArgbCTest() { ExtendedColors ec = ExtendedColors.FromArgb(255, 46, 84, 100); Assert.AreEqual(unchecked ((int)0xFF2E5464), ec.ToArgb()); }