當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。