当前位置: 首页>>代码示例>>C#>>正文


C# Color.GetHue方法代码示例

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


在下文中一共展示了Color.GetHue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ColorToHsv

		public static void ColorToHsv(Color color, out double hue, out double saturation, out double value)
		{
			int max = Math.Max(color.R, Math.Max(color.G, color.B));
			int min = Math.Min(color.R, Math.Min(color.G, color.B));

			hue = color.GetHue();
			saturation = (max == 0) ? 0 : 1d - (1d * min / max);
			value = max / 255d;
		}
开发者ID:TomTer,项目名称:PoeHud,代码行数:9,代码来源:ColorUtils.cs

示例2: ColorToHSV

    public static void ColorToHSV(Color color, out float hue, out float saturation, out float value)
    {
        float max = Math.Max(color.r, Math.Max(color.g, color.b));
        float min = Math.Min(color.r, Math.Min(color.g, color.b));

        hue = color.GetHue();
        saturation = (max == 0) ? 0 : 1f - (1f * min / max);
        value = max;
    }
开发者ID:Collegiennes,项目名称:volkenessen,代码行数:9,代码来源:ColorHelper.cs

示例3: SimilarColors

 private static bool SimilarColors(Color colorOne, Color colorTwo)
 {
     if (Math.Abs(colorOne.GetHue()-colorTwo.GetHue()) <= 36)
     {
         //Console.WriteLine("Hue");
         return true;
     }
     if (Math.Abs(colorOne.GetBrightness()-colorTwo.GetBrightness()) <= .1)
     {
         //Console.WriteLine("Hue");
         return true;
     }
     if (Math.Abs(colorOne.GetSaturation()-colorTwo.GetSaturation()) <= .1)
     {
         //Console.WriteLine("Hue");
         return true;
     }
     return false;
 }
开发者ID:dicknarby,项目名称:HomeMonitor,代码行数:19,代码来源:ImageChecker.cs

示例4: UpdateHsb

        private void UpdateHsb(Color value) {
            Hue = (int)value.GetHue();

            var brightness = value.GetBrightness();
            Brightness = (int)(brightness * 100);

            var saturation = value.GetSaturation();
            Saturation = (int)(saturation * 100);

            UpdateThumbPosition();
        }
开发者ID:gro-ove,项目名称:actools,代码行数:11,代码来源:ColorPickerPanel.cs

示例5: HSLColor

 public HSLColor(Color color)
 {
     Hue = color.GetHue();
     Saturation = color.GetSaturation();
     Lightness = color.GetBrightness();
 }
开发者ID:Thraka,项目名称:SadConsoleEditor,代码行数:6,代码来源:HSLColor.cs

示例6: ClosestColorHsb

 /// <summary>
 /// Weighed distance using hue, saturation and brightness.
 /// </summary>
 /// <param name="colors"></param>
 /// <param name="target"></param>
 /// <returns></returns>
 public static int ClosestColorHsb(List<Color> colors, Color target)
 {
     float hue1 = target.GetHue();
     var num1 = ColorNum(target);
     var diffs = colors.Select(n => Math.Abs(ColorNum(n) - num1) +
                                    GetHueDistance(n.GetHue(), hue1));
     var diffMin = diffs.Min(x => x);
     return diffs.ToList().FindIndex(n => n == diffMin);
 }
开发者ID:dbremner,项目名称:ScreenToGif,代码行数:15,代码来源:ColorExtensions.cs

示例7: ClosestColorHue

        /// <summary>
        /// Closest match for hues only.
        /// </summary>
        /// <param name="colors"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static int ClosestColorHue(List<Color> colors, Color target)
        {
            var hue1 = target.GetHue();
            var diffs = colors.Select(n => GetHueDistance(n.GetHue(), hue1));
            var diffMin = diffs.Min(n => n);

            return diffs.ToList().FindIndex(n => n == diffMin);
        }
开发者ID:dbremner,项目名称:ScreenToGif,代码行数:14,代码来源:ColorExtensions.cs


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