public void ColorShouldBeSameAtStartOfAnimation() { RgbColor newColor = animation.GetColor(StartTime, StartTime); Assert.AreEqual(targetColor.ToString(), newColor.ToString()); Assert.IsTrue(!animation.AnimationFinished); }
public void AfterAnimationHasFinishedBeyondTime() { RgbColor newColor = animation.GetColor(StartTime, StartTime.AddMilliseconds(animation.DurationBlink * 10)); Assert.AreEqual(RgbColor.Black().ToString(), newColor.ToString()); Assert.IsTrue(animation.AnimationFinished); }
public void TargetColorHalfWaySecondPulse() { animation.RepeatPulse = 2; RgbColor newColor = animation.GetColor(StartTime, StartTime.AddMilliseconds(animation.DurationPulse + animation.DurationPulse / 2)); Assert.AreEqual(targetColor.ToString(), newColor.ToString()); }
public void GreenToRed([Range(0, 255)] int time) { refColor = RgbColor.FromRgb(0, 255, 0); RgbColor newColor = animation.GetColor(StartTime, StartTime.AddMilliseconds(time), refColor); Assert.AreEqual(RgbColor.FromRgb(time, 255 - time, 0).ToString(), newColor.ToString()); }
public void BlackColorBeyondTimeAndFinished() { RgbColor newColor = animation.GetColor(StartTime, StartTime.AddMilliseconds(animation.DurationPulse * 10), RgbColor.Black()); Assert.AreEqual(RgbColor.Black().ToString(), newColor.ToString()); Assert.IsTrue(animation.AnimationFinished); }
public void RgbaToColorString() { RgbColor rgba = new RgbColor { Red = 255, Green = 205, Blue = 100, Alpha = 0.72d }; Assert.AreEqual("rgba(255,205,100,0.72)", rgba.ToString()); }
public void Mix4Bit() { RgbColor rgb = RgbColor.Parse("#FF00007F"); RgbColor rgb2 = RgbColor.Parse("#0f08"); RgbColor mix = rgb.Mix(rgb2, 0.5); Assert.AreEqual("rgba(123,131,0,0.515)", mix.ToString()); }
public void RgbToColorString2() { RgbColor rgb = new RgbColor { Red = 255, Green = 255, Blue = 255 }; Assert.AreEqual("#fff", rgb.ToString()); }
public void Mix2ColorsWith25() { RgbColor rgb = RgbColor.Parse("#f00"); RgbColor rgb2 = RgbColor.Parse("#00f"); RgbColor mix = rgb.Mix(rgb2, 0.25); Assert.AreEqual("#3f00bf", mix.ToString()); }
public void MixRgba() { RgbColor rgb = RgbColor.Parse("rgba(255, 0, 0, 0.5)"); RgbColor rgb2 = RgbColor.Parse("#00f"); RgbColor mix = rgb.Mix(rgb2, 0.5); Assert.AreEqual("rgba(63,0,191,0.75)", mix.ToString()); }
public void BlackAtTheEndSecondPulse() { animation.RepeatPulse = 2; RgbColor newColor = animation.GetColor(StartTime, StartTime.AddMilliseconds(animation.DurationPulse * 2)); Assert.AreEqual(RgbColor.Black().ToString(), newColor.ToString()); Assert.IsTrue(animation.AnimationFinished); }
public void RgbToColorString() { RgbColor rgb = new RgbColor { Red = 255, Green = 205, Blue = 100 }; Assert.AreEqual("#ffcd64", rgb.ToString()); }
public void ColorShouldBeSameDuringAnimation() { for (int i = 0; i < animation.DelaySetColor; i++) { RgbColor newColor = animation.GetColor(StartTime, StartTime.AddMilliseconds(i)); Assert.AreEqual(targetColor.ToString(), newColor.ToString()); } }
public void TurnOffHalfWayThrough() { for (int i = animation.DurationBlink / 2; i < animation.DurationBlink; i++) { RgbColor newColor = animation.GetColor(StartTime, StartTime.AddMilliseconds(i)); Assert.AreEqual(RgbColor.Black().ToString(), newColor.ToString()); } Assert.IsTrue(!animation.AnimationFinished); }
public void RedToBlue([Range(0, 255)] int time) { refColor = RgbColor.FromRgb(255, 0, 0); targetColor = RgbColor.FromRgb(0, 0, 255); animation.Color = targetColor; RgbColor newColor = animation.GetColor(StartTime, StartTime.AddMilliseconds(time), refColor); Assert.AreEqual(RgbColor.FromRgb(255 - time, 0, time).ToString(), newColor.ToString()); }
public void BlueToGreen([Range(0, 255)] int time) { refColor = RgbColor.FromRgb(0, 0, 255); targetColor = RgbColor.FromRgb(0, 255, 0); animation.Color = targetColor; RgbColor newColor = animation.GetColor(StartTime, StartTime.AddMilliseconds(time), refColor); Assert.AreEqual(RgbColor.FromRgb(0, time, 255 - time).ToString(), newColor.ToString()); Assert.IsTrue(!animation.AnimationFinished); }
public void TurnOnFirstHalf() { for (int i = 0; i < animation.DurationBlink / 2; i++) { RgbColor newColor = animation.GetColor(StartTime, StartTime.AddMilliseconds(i)); Assert.AreEqual(targetColor.ToString(), newColor.ToString()); } Assert.IsTrue(!animation.AnimationFinished); }
/// <summary> /// Convert a color to a string /// </summary> /// <param name="color">the windows forms color</param> /// <returns>the color in a string</returns> private static string ConvertColor(System.Drawing.Color color) { int i = color.ToArgb(); byte r = (byte)((i >> 16) & 255); byte g = (byte)((i >> 8) & 255); byte b = (byte)(i & 255); RgbColor rgbColor = new RgbColor(r, g, b); return rgbColor.ToString(); }
public void TurnOnSecondBlink() { animation.RepeatBlink = 2; for (int i = animation.DurationBlink; i < animation.DurationBlink * 2 - animation.DurationBlink / 2; i++) { RgbColor newColor = animation.GetColor(StartTime, StartTime.AddMilliseconds(i)); Assert.AreEqual(targetColor.ToString(), newColor.ToString()); } Assert.IsTrue(!animation.AnimationFinished); }
/// <summary> /// Tints using alpha channel /// </summary> private static void TintUsingAlpha(RgbColor color) { using (var bitmap = new Bitmap("../../../../_Input/Chicago.jpg")) { using (var result = new Aurigma.GraphicsMill.Bitmap(bitmap.Width, bitmap.Height, PixelFormat.Format24bppRgb, color)) { bitmap.ColorManagement.Convert(PixelFormat.Format8bppGrayscale); bitmap.Transforms.Invert(); result.Channels.SetAlpha(bitmap); result.Channels.RemoveAlpha(RgbColor.White); result.Save("../../../../_Output/TintUsingAlpha_" + color.ToString() + ".jpg"); } } }
public void OpacifyHsla() { RgbColor rgb = RgbColor.Parse("hsla(0, 0%, 100%, .3)").Opacify(0.5); Assert.AreEqual("rgba(255,255,255,0.8)", rgb.ToString()); }
public void OpacifyRgba01() { RgbColor rgb = RgbColor.Parse("rgba(101, 100, 205, 0.7)").Opacify(0.1); Assert.AreEqual("rgba(101,100,205,0.8)", rgb.ToString()); }
public void OpacifyNotBelow0() { RgbColor rgb = RgbColor.Parse("rgba(255, 0, 0, .2)").Opacify(-0.5); Assert.AreEqual("rgba(255,0,0,0)", rgb.ToString()); }
public void OpacifyHsl() { RgbColor rgb = RgbColor.Parse("hsl(0, 0%, 100%)").Opacify(0.2); Assert.AreEqual("#fff", rgb.ToString()); }
public void Hex() { RgbColor rgb = RgbColor.Parse("#00f").Shade(0.25); Assert.AreEqual("#0000bf", rgb.ToString()); }
protected internal static string GetName(RgbColor rgbColor) { return(rgbColor?.ToString()); }
public void Hex4Bit() { RgbColor rgb = RgbColor.Parse("#0f08").Shade(0.25); Assert.AreEqual("rgba(0,132,0,0.8825000000000001)", rgb.ToString()); }
public void Hex8Bit() { RgbColor rgb = RgbColor.Parse("#000fffcc").Shade(0.25); Assert.AreEqual("rgba(0,10,170,0.95)", rgb.ToString()); }
public void ColorShouldBeSameInTheMiddleOfAnimation() { RgbColor newColor = animation.GetColor(StartTime, StartTime.AddMilliseconds(animation.DelaySetColor / 2)); Assert.AreEqual(targetColor.ToString(), newColor.ToString()); }
public void OpacifyNotOver1() { RgbColor rgb = RgbColor.Parse("rgba(255, 0, 0, .8)").Opacify(0.5); Assert.AreEqual("#f00", rgb.ToString()); }
public void OpacifyFff() { RgbColor rgb = RgbColor.Parse("#fff").Opacify(0.1); Assert.AreEqual("#fff", rgb.ToString()); }