• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Core.Color类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Corale.Colore.Core.Color的典型用法代码示例。如果您正苦于以下问题:C# Color类的具体用法?C# Color怎么用?C# Color使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Color类属于Corale.Colore.Core命名空间,在下文中一共展示了Color类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Custom

        /// <summary>
        /// Initializes a new instance of the <see cref="Custom" /> struct with
        /// a default color for each LED.
        /// </summary>
        /// <param name="color">The color to set each LED to initially.</param>
        public Custom(Color color)
        {
            Colors = new Color[Constants.MaxLeds];

            for (var i = 0; i < Colors.Length; i++)
                Colors[i] = color;
        }
开发者ID:danpierce1,项目名称:Colore,代码行数:12,代码来源:Custom.cs


示例2: Breathing

 /// <summary>
 /// Initializes a new instance of the <see cref="Breathing" /> struct.
 /// </summary>
 /// <param name="led">The LED on which to apply the effect.</param>
 /// <param name="type">The type of breathing effect to create.</param>
 /// <param name="first">The initial <see cref="Color" /> to use.</param>
 /// <param name="second">The second color.</param>
 public Breathing(Led led, BreathingType type, Color first, Color second)
 {
     Led = led;
     Type = type;
     First = first;
     Second = second;
 }
开发者ID:blackworx,项目名称:Colore,代码行数:14,代码来源:Breathing.cs


示例3: Reactive

 /// <summary>
 /// Initializes a new instance of the <see cref="Reactive" /> struct.
 /// </summary>
 /// <param name="duration">Effect duration.</param>
 /// <param name="color">Effect color.</param>
 /// <param name="parameter">Additional effect parameter.</param>
 public Reactive(Duration duration, Color color, int parameter = 0)
 {
     Duration = duration;
     Color = color;
     Parameter = parameter;
     Size = Marshal.SizeOf(typeof(Reactive));
 }
开发者ID:WolfspiritM,项目名称:Colore,代码行数:13,代码来源:Reactive.cs


示例4: Breathing

 /// <summary>
 /// Initializes a new instance of the <see cref="Breathing" /> struct.
 /// </summary>
 /// <param name="type">The type of breathing effect to create.</param>
 /// <param name="first">Primary effect color.</param>
 /// <param name="second">Secondary effect color.</param>
 /// <param name="parameter">Additional effect parameter to set.</param>
 public Breathing(BreathingType type, Color first, Color second, int parameter = 0)
 {
     Type = type;
     First = first;
     Second = second;
     Parameter = parameter;
     Size = Marshal.SizeOf(typeof(Breathing));
 }
开发者ID:WolfspiritM,项目名称:Colore,代码行数:15,代码来源:Breathing.cs


示例5: AnimatedKey

 public AnimatedKey(Key key, Color color)
 {
     this.razerKey = key;
     this.color = color;
     this.red = color.R;
     this.green = color.G;
     this.blue = color.B;
     this.alpha = color.A;
 }
开发者ID:Palid,项目名称:Simon-Says,代码行数:9,代码来源:AnimatedKey.cs


示例6: ShouldConstructFromSystemColor

        public void ShouldConstructFromSystemColor()
        {
            var source = System.Drawing.Color.FromArgb(5, 10, 15);
            var coloreColor = new Color(source);

            Assert.AreEqual(source.R, coloreColor.R);
            Assert.AreEqual(source.G, coloreColor.G);
            Assert.AreEqual(source.B, coloreColor.B);
        }
开发者ID:DeadlyEmbrace,项目名称:Colore,代码行数:9,代码来源:ColorTests.cs


示例7: ShouldConstructFromRgb

        public void ShouldConstructFromRgb()
        {
            var expected = new Color(0x123456);
            var actual = Color.FromRgb(0x563412);

            Assert.AreEqual(expected.Value, actual.Value);
            Assert.AreEqual(expected.R, actual.R);
            Assert.AreEqual(expected.G, actual.G);
            Assert.AreEqual(expected.B, actual.B);
        }
开发者ID:WolfspiritM,项目名称:Colore,代码行数:10,代码来源:ColorTests.cs


示例8: ShouldConvertRgbBytesCorrectly

 public void ShouldConvertRgbBytesCorrectly()
 {
     const uint V = 0x00FFFFFF;
     const byte R = 255;
     const byte G = 255;
     const byte B = 255;
     var c = new Color(R, G, B);
     Assert.AreEqual(c.Value, V);
     Assert.AreEqual(c.R, R);
     Assert.AreEqual(c.G, G);
     Assert.AreEqual(c.B, B);
 }
开发者ID:DeadlyEmbrace,项目名称:Colore,代码行数:12,代码来源:ColorTests.cs


示例9: ShouldConvertRgbDoublesCorrectly

 public void ShouldConvertRgbDoublesCorrectly()
 {
     const uint V = 0x00FFFFFF;
     const double R = 1.0;
     const double G = 1.0;
     const double B = 1.0;
     const byte Expected = 255;
     var c = new Color(R, G, B);
     Assert.AreEqual(c.Value, V);
     Assert.AreEqual(c.R, Expected);
     Assert.AreEqual(c.G, Expected);
     Assert.AreEqual(c.B, Expected);
 }
开发者ID:danm-de,项目名称:DrunkenOctoNinja,代码行数:13,代码来源:ColorTests.cs


示例10: getNewColor

        private Color getNewColor(Color color)
        {
            var magicNumber = 255;
            var darkenedColor = darkenColor((int)red, (int)green, (int)blue);
            red = darkenedColor[0];
            green = darkenedColor[1];
            blue = darkenedColor[2];
            //temporarily not touching alpha, as it doesn't work at all.
            //Yet.
            alpha = color.A;

            return new Color(red / magicNumber, green / magicNumber, blue / magicNumber, alpha);
        }
开发者ID:Palid,项目名称:Simon-Says,代码行数:13,代码来源:AnimatedKey.cs


示例11: ShouldConvertRgbBytesCorrectly

 public void ShouldConvertRgbBytesCorrectly()
 {
     const uint V = 0x8056F5C8;
     const byte R = 200;
     const byte G = 245;
     const byte B = 86;
     const byte A = 128;
     var c = new Color(R, G, B, A);
     Assert.AreEqual(c.Value, V);
     Assert.AreEqual(c.R, R);
     Assert.AreEqual(c.G, G);
     Assert.AreEqual(c.B, B);
     Assert.AreEqual(c.A, A);
 }
开发者ID:blackworx,项目名称:Colore,代码行数:14,代码来源:ColorTests.cs


示例12: ShouldConvertRgbDoublesCorrectly

 public void ShouldConvertRgbDoublesCorrectly()
 {
     const uint V = 0x7F3D89CC;
     const double R = 0.8;
     const double G = 0.54;
     const double B = 0.24;
     const double A = 0.5;
     const byte ExpectedR = (byte)(R * 255);
     const byte ExpectedG = (byte)(G * 255);
     const byte ExpectedB = (byte)(B * 255);
     const byte ExpectedA = (byte)(A * 255);
     var c = new Color(R, G, B, A);
     Assert.AreEqual(c.Value, V);
     Assert.AreEqual(c.R, ExpectedR);
     Assert.AreEqual(c.G, ExpectedG);
     Assert.AreEqual(c.B, ExpectedB);
     Assert.AreEqual(c.A, ExpectedA);
 }
开发者ID:blackworx,项目名称:Colore,代码行数:18,代码来源:ColorTests.cs


示例13: Breathing

 /// <summary>
 /// Initializes a new instance of the <see cref="Breathing" /> struct using
 /// the <see cref="BreathingType.Two" /> breathing type.
 /// </summary>
 /// <param name="first">Initial color.</param>
 /// <param name="second">Second color.</param>
 public Breathing(Color first, Color second)
     : this(BreathingType.Two, first, second)
 {
 }
开发者ID:DeadlyEmbrace,项目名称:Colore,代码行数:10,代码来源:Breathing.cs


示例14: Breathing

 /// <summary>
 /// Initializes a new instance of the <see cref="Breathing" /> struct.
 /// </summary>
 /// <param name="color">The color to set.</param>
 public Breathing(Color color)
 {
     Color = color;
 }
开发者ID:blackworx,项目名称:Colore,代码行数:8,代码来源:Breathing.cs


示例15: Static

 /// <summary>
 /// Initializes a new instance of the <see cref="Static" /> struct.
 /// </summary>
 /// <param name="color">Color to set.</param>
 public Static(Color color)
 {
     Color = color;
 }
开发者ID:blackworx,项目名称:Colore,代码行数:8,代码来源:Static.cs


示例16: ShouldNotEqualNull

 public void ShouldNotEqualNull()
 {
     var c = new Color(255, 255, 255);
     Assert.AreNotEqual(c, null);
     Assert.False(c == null);
     Assert.True(c != null);
     Assert.False(c.Equals(null));
 }
开发者ID:DeadlyEmbrace,项目名称:Colore,代码行数:8,代码来源:ColorTests.cs


示例17: SetAll

 /// <summary>
 /// Sets the color of all components on this device.
 /// </summary>
 /// <param name="color">Color to set.</param>
 public override void SetAll(Color color)
 {
     SetGuid(NativeWrapper.CreateKeypadEffect(new Static(color)));
 }
开发者ID:danpierce1,项目名称:Colore,代码行数:8,代码来源:Keypad.cs


示例18: ShouldNotEqualArbitraryObject

 public void ShouldNotEqualArbitraryObject()
 {
     var c = new Color(0);
     var o = new object();
     Assert.AreNotEqual(c, o);
     Assert.False(c == o);
     Assert.True(c != o);
 }
开发者ID:DeadlyEmbrace,项目名称:Colore,代码行数:8,代码来源:ColorTests.cs


示例19: ShouldNotEqualDifferentColor

 public void ShouldNotEqualDifferentColor()
 {
     var a = new Color(0);
     var b = new Color(1);
     Assert.AreNotEqual(a, b);
     Assert.False(a == b);
     Assert.True(a != b);
 }
开发者ID:DeadlyEmbrace,项目名称:Colore,代码行数:8,代码来源:ColorTests.cs


示例20: UintShouldNotEqualDifferentColor

 public void UintShouldNotEqualDifferentColor()
 {
     const uint A = 0x00FF00FF;
     var b = new Color(0x00FFFFFF);
     Assert.AreNotEqual(A, b);
     Assert.False(A == b);
     Assert.True(A != b);
 }
开发者ID:DeadlyEmbrace,项目名称:Colore,代码行数:8,代码来源:ColorTests.cs



注:本文中的Corale.Colore.Core.Color类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Core.Packet类代码示例发布时间:2022-05-24
下一篇:
C# Cookbook.CookDBDataContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap