コード例 #1
0
        public void ColorShouldBeSameAtStartOfAnimation()
        {
            RgbColor newColor = animation.GetColor(StartTime, StartTime);

            Assert.AreEqual(targetColor.ToString(), newColor.ToString());

            Assert.IsTrue(!animation.AnimationFinished);
        }
コード例 #2
0
        public void AfterAnimationHasFinishedBeyondTime()
        {
            RgbColor newColor = animation.GetColor(StartTime, StartTime.AddMilliseconds(animation.DurationBlink * 10));

            Assert.AreEqual(RgbColor.Black().ToString(), newColor.ToString());
            Assert.IsTrue(animation.AnimationFinished);
        }
コード例 #3
0
        public void TargetColorHalfWaySecondPulse()
        {
            animation.RepeatPulse = 2;
            RgbColor newColor = animation.GetColor(StartTime, StartTime.AddMilliseconds(animation.DurationPulse + animation.DurationPulse / 2));

            Assert.AreEqual(targetColor.ToString(), newColor.ToString());
        }
コード例 #4
0
        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());
        }
コード例 #5
0
        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);
        }
コード例 #6
0
ファイル: ToString.cs プロジェクト: chanan/Polished.net
        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());
        }
コード例 #7
0
        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());
        }
コード例 #8
0
ファイル: ToString.cs プロジェクト: chanan/Polished.net
        public void RgbToColorString2()
        {
            RgbColor rgb = new RgbColor {
                Red = 255, Green = 255, Blue = 255
            };

            Assert.AreEqual("#fff", rgb.ToString());
        }
コード例 #9
0
        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());
        }
コード例 #10
0
        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());
        }
コード例 #11
0
        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);
        }
コード例 #12
0
ファイル: ToString.cs プロジェクト: chanan/Polished.net
        public void RgbToColorString()
        {
            RgbColor rgb = new RgbColor {
                Red = 255, Green = 205, Blue = 100
            };

            Assert.AreEqual("#ffcd64", rgb.ToString());
        }
コード例 #13
0
        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());
            }
        }
コード例 #14
0
        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);
        }
コード例 #15
0
        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());
        }
コード例 #16
0
        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);
        }
コード例 #17
0
        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);
        }
コード例 #18
0
ファイル: ColorDialog.cs プロジェクト: AnthonySteele/Netsy
        /// <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();
        }
コード例 #19
0
        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);
        }
コード例 #20
0
    /// <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");
            }
        }
    }
コード例 #21
0
ファイル: Opacify.cs プロジェクト: chanan/Polished.net
        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());
        }
コード例 #22
0
ファイル: Opacify.cs プロジェクト: chanan/Polished.net
        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());
        }
コード例 #23
0
ファイル: Opacify.cs プロジェクト: chanan/Polished.net
        public void OpacifyNotBelow0()
        {
            RgbColor rgb = RgbColor.Parse("rgba(255, 0, 0, .2)").Opacify(-0.5);

            Assert.AreEqual("rgba(255,0,0,0)", rgb.ToString());
        }
コード例 #24
0
ファイル: Opacify.cs プロジェクト: chanan/Polished.net
        public void OpacifyHsl()
        {
            RgbColor rgb = RgbColor.Parse("hsl(0, 0%, 100%)").Opacify(0.2);

            Assert.AreEqual("#fff", rgb.ToString());
        }
コード例 #25
0
        public void Hex()
        {
            RgbColor rgb = RgbColor.Parse("#00f").Shade(0.25);

            Assert.AreEqual("#0000bf", rgb.ToString());
        }
コード例 #26
0
 protected internal static string GetName(RgbColor rgbColor)
 {
     return(rgbColor?.ToString());
 }
コード例 #27
0
        public void Hex4Bit()
        {
            RgbColor rgb = RgbColor.Parse("#0f08").Shade(0.25);

            Assert.AreEqual("rgba(0,132,0,0.8825000000000001)", rgb.ToString());
        }
コード例 #28
0
        public void Hex8Bit()
        {
            RgbColor rgb = RgbColor.Parse("#000fffcc").Shade(0.25);

            Assert.AreEqual("rgba(0,10,170,0.95)", rgb.ToString());
        }
コード例 #29
0
        public void ColorShouldBeSameInTheMiddleOfAnimation()
        {
            RgbColor newColor = animation.GetColor(StartTime, StartTime.AddMilliseconds(animation.DelaySetColor / 2));

            Assert.AreEqual(targetColor.ToString(), newColor.ToString());
        }
コード例 #30
0
ファイル: Opacify.cs プロジェクト: chanan/Polished.net
        public void OpacifyNotOver1()
        {
            RgbColor rgb = RgbColor.Parse("rgba(255, 0, 0, .8)").Opacify(0.5);

            Assert.AreEqual("#f00", rgb.ToString());
        }
コード例 #31
0
ファイル: Opacify.cs プロジェクト: chanan/Polished.net
        public void OpacifyFff()
        {
            RgbColor rgb = RgbColor.Parse("#fff").Opacify(0.1);

            Assert.AreEqual("#fff", rgb.ToString());
        }