Here are the examples of the csharp api class System.Drawing.Color.GetHue() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
55 Examples
0
1. Example
Project: Cyotek.Windows.Forms.ColorPicker
Source File: ColorComparer.cs
Source File: ColorComparer.cs
public static int Hue(Color x, Color y) { float v1; float v2; int result; v1 = x.GetHue(); v2 = y.GetHue(); if (v1 < v2) { result = -1; } else if (v1 > v2) { result = 1; } else { result = 0; } return result; }
0
2. Example
Project: DotSpatial
Source File: HueSlider.cs
Source File: HueSlider.cs
public void SetRange(Color startColor, Color endColor) { int hStart = (int)startColor.GetHue(); int hEnd = (int)endColor.GetHue(); _inverted = hStart > hEnd; LeftValue = hStart; RightValue = hEnd; }
0
3. Example
Project: logwizard
Source File: ColorTable.cs
Source File: ColorTable.cs
int CompareColorByHue(Color c1, Color c2) { float h1 = c1.GetHue(); float h2 = c2.GetHue(); if (h1 < h2) return -1; if (h1 > h2) return 1; return 0; }
0
4. Example
Project: LiveSplit
Source File: ExtMethodsSystemDrawingColor.cs
Source File: ExtMethodsSystemDrawingColor.cs
public static float GetHSVHue(this System.Drawing.Color color) { return color.GetHue() / 360.0f; }
0
5. Example
Project: Gorgon
Source File: ExtMethodsSystemDrawingColor.cs
Source File: ExtMethodsSystemDrawingColor.cs
public static float GetHSVHue(this System.Drawing.Color color) { return color.GetHue() / 360.0f; }
0
6. Example
Project: winforms
Source File: ExtMethodsColor.cs
Source File: ExtMethodsColor.cs
public static float GetHSVHue(this Color color) { return color.GetHue() / 360.0f; }
0
7. Example
Project: duality
Source File: ExtMethodsColor.cs
Source File: ExtMethodsColor.cs
public static float GetHSVHue(this Color color) { return color.GetHue() / 360.0f; }
0
8. Example
Project: Popcorn
Source File: HSBModel.cs
Source File: HSBModel.cs
public double HComponent(Color color) { System.Drawing.Color c = System.Drawing.Color.FromArgb(255, color.R, color.G, color.B); return c.GetHue(); }
0
9. Example
Project: naps2
Source File: ColorHelper.cs
Source File: ColorHelper.cs
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; }
0
10. Example
Project: naps2
Source File: ColorHelper.cs
Source File: ColorHelper.cs
public static void ColorToHSL(Color color, out double hue, out double saturation, out double brightness) { hue = color.GetHue(); saturation = color.GetSaturation(); brightness = color.GetBrightness(); }
0
11. Example
Project: DotSpatial
Source File: DashSlider.cs
Source File: DashSlider.cs
protected static LinearGradientBrush CreateGradientBrush(Color color, PointF topLeft, PointF bottomRight) { float b = color.GetBrightness(); b += .3F; if (b > 1F) b = 1F; Color light = SymbologyGlobal.ColorFromHsl(color.GetHue(), color.GetSaturation(), b); float d = color.GetBrightness(); d -= .3F; if (d < 0F) d = 0F; Color dark = SymbologyGlobal.ColorFromHsl(color.GetHue(), color.GetSaturation(), d); return new LinearGradientBrush(topLeft, bottomRight, light, dark); }
0
12. Example
Project: DotSpatial
Source File: SquareButton.cs
Source File: SquareButton.cs
protected static LinearGradientBrush CreateGradientBrush(Color color, PointF topLeft, PointF bottomRight) { float b = color.GetBrightness(); b += .3F; if (b > 1F) b = 1F; Color light = SymbologyGlobal.ColorFromHsl(color.GetHue(), color.GetSaturation(), b); float d = color.GetBrightness(); d -= .3F; if (d < 0F) d = 0F; Color dark = SymbologyGlobal.ColorFromHsl(color.GetHue(), color.GetSaturation(), d); return new LinearGradientBrush(topLeft, bottomRight, light, dark); }
0
13. Example
Project: DotSpatial
Source File: TabColorControl.cs
Source File: TabColorControl.cs
private void SetEndHsl() { _endHue = (int)_endColor.GetHue(); _endSat = _endColor.GetSaturation(); _endLight = _endColor.GetBrightness(); }
0
14. Example
Project: DotSpatial
Source File: TabColorControl.cs
Source File: TabColorControl.cs
private void SetStartHsl() { _startHue = (int)_startColor.GetHue(); _startSat = _startColor.GetSaturation(); _startLight = _startColor.GetBrightness(); }
0
15. Example
Project: BehaviorIsManaged
Source File: HSVColorConverter.cs
Source File: HSVColorConverter.cs
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; }
0
16. Example
Project: Alferd-Spritesheet-Unpacker
Source File: RGBHSLConverter.cs
Source File: RGBHSLConverter.cs
public static HSL RGB_to_HSL(Color c) { HSL hsl = new HSL(); hsl.H = c.GetHue() / 360.0; // we store hue as 0-1 as opposed to 0-360 hsl.L = c.GetBrightness(); hsl.S = c.GetSaturation(); return hsl; }
0
17. Example
Project: KeeThief
Source File: UIUtil.cs
Source File: UIUtil.cs
public static void ColorToHsv(Color clr, out float fHue, out float fSaturation, out float fValue) { int nMax = Math.Max(clr.R, Math.Max(clr.G, clr.B)); int nMin = Math.Min(clr.R, Math.Min(clr.G, clr.B)); fHue = clr.GetHue(); // In degrees fSaturation = ((nMax == 0) ? 0.0f : (1.0f - ((float)nMin / nMax))); fValue = (float)nMax / 255.0f; }
0
18. Example
Project: resharper-unity
Source File: ColorUtils.cs
Source File: ColorUtils.cs
public static void ColorToHSV(System.Drawing.Color color, out float hue, out float saturation, out float 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() / 360.0f; saturation = (float) (max == 0 ? 0 : 1d - 1d * min / max); value = (float) (max / 255d); }
0
19. Example
Project: LiveSplit
Source File: ColorExtensions.cs
Source File: ColorExtensions.cs
public static void ToHSV(this Color color, out double hue, out double saturation, out double value) { int max = Max(color.R, Max(color.G, color.B)); int min = Min(color.R, Min(color.G, color.B)); hue = color.GetHue(); saturation = (max == 0) ? 0 : 1d - (1d * min / max); value = max / 255d; }
0
20. Example
Project: gwen-nolegacy-opentk-renderer
Source File: Util.cs
Source File: Util.cs
public static HSV ToHSV(this Color color) { HSV hsv = new HSV(); int max = Math.Max(color.R, Math.Max(color.G, color.B)); int min = Math.Min(color.R, Math.Min(color.G, color.B)); hsv.h = color.GetHue(); hsv.s = (max == 0) ? 0 : 1f - (1f * min / max); hsv.v = max / 255f; return hsv; }
0
21. Example
Project: scada
Source File: FrmSelectColor.cs
Source File: FrmSelectColor.cs
int IComparer.Compare(Object x, Object y) { Color cx = (Color)x; Color cy = (Color)y; float hx = cx.GetHue(); float hy = cy.GetHue(); float sx = cx.GetSaturation(); float sy = cy.GetSaturation(); float bx = cx.GetBrightness(); float by = cy.GetBrightness(); if (hx < hy) return -1; else if (hx > hy) return 1; else { if (sx < sy) return -1; else if (sx > sy) return 1; else { if (bx < by) return -1; else if (bx > by) return 1; else return 0; } } }
0
22. Example
Project: scada
Source File: ColorEditor.cs
Source File: ColorEditor.cs
int IComparer<object>.Compare(object x, object y) { Color cx = (Color)x; Color cy = (Color)y; float hx = cx.GetHue(); float hy = cy.GetHue(); float sx = cx.GetSaturation(); float sy = cy.GetSaturation(); float bx = cx.GetBrightness(); float by = cy.GetBrightness(); if (hx < hy) return -1; else if (hx > hy) return 1; else { if (sx < sy) return -1; else if (sx > sy) return 1; else { if (bx < by) return -1; else if (bx > by) return 1; else return 0; } } }
0
23. Example
Project: Sardauscan
Source File: ColorExtension.cs
Source File: ColorExtension.cs
internal static ColorHSB FromRGB(Color c) { ColorHSB hsb = new ColorHSB(); hsb.Hue = c.GetHue() / 360.0; // we store hue as 0-1 as opposed to 0-360 hsb.Brightness = c.GetBrightness(); hsb.Saturation = c.GetSaturation(); return hsb; }
0
24. Example
Project: PixVoxelAssets
Source File: ForaysVoxels.cs
Source File: ForaysVoxels.cs
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; }
0
25. Example
Project: PixVoxelAssets
Source File: MiniOrthoVoxels.cs
Source File: MiniOrthoVoxels.cs
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; }
0
26. Example
Project: PixVoxelAssets
Source File: MiniSubVoxels.cs
Source File: MiniSubVoxels.cs
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; }
0
27. Example
Project: PixVoxelAssets
Source File: MiniVoxels.cs
Source File: MiniVoxels.cs
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; }
0
28. Example
Project: PixVoxelAssets
Source File: TinyOrthoVoxels.cs
Source File: TinyOrthoVoxels.cs
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; }
0
29. Example
Project: PixVoxelAssets
Source File: VoxelLogic.cs
Source File: VoxelLogic.cs
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; }
0
30. Example
Project: IsoVoxel
Source File: PaletteDraw.cs
Source File: PaletteDraw.cs
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; }
0
31. Example
Project: Cyotek.Windows.Forms.ColorPicker
Source File: AdobePhotoShopColorSwatchSerializer.cs
Source File: AdobePhotoShopColorSwatchSerializer.cs
protected virtual void WritePalette(Stream stream, ColorCollection palette, AdobePhotoshopColorSwatc/n ..... /n //View Source file for more details /n }
0
32. Example
Project: DotSpatial
Source File: ColorExt.cs
Source File: ColorExt.cs
public static Color Lighter(this Color self, float brightness) { float b = brightness + self.GetBrightness(); if (b < 0F) b = 0F; if (b > 1F) b = 1F; return Color.FromArgb(self.A, SymbologyGlobal.ColorFromHsl(self.GetHue(), self.GetSaturation(), b)); }
0
33. Example
Project: DotSpatial
Source File: ColorExt.cs
Source File: ColorExt.cs
public static Color Darker(this Color self, float brightness) { float b = self.GetBrightness() - brightness; if (b < 0F) b = 0F; if (b > 1F) b = 1F; return Color.FromArgb(self.A, SymbologyGlobal.ColorFromHsl(self.GetHue(), self.GetSaturation(), b)); }
0
34. Example
Project: DotSpatial
Source File: SymbologyGlobal.cs
Source File: SymbologyGlobal.cs
public static Brush HighlightBrush(Rectangle box, Color selectionHighlight) { float med = selectionHighlight.GetBrightness(); float bright = med + 0.05f; if (bright > 1f) bright = 1f; float dark = med - 0.05f; if (dark < 0f) dark = 0f; Color brtCol = ColorFromHsl(selectionHighlight.GetHue(), selectionHighlight.GetSaturation(), bright); Color drkCol = ColorFromHsl(selectionHighlight.GetHue(), selectionHighlight.GetSaturation(), dark); return new LinearGradientBrush(box, brtCol, drkCol, LinearGradientMode.Vertical); }
0
35. Example
Project: route-planner-csharp
Source File: LockedColorConverter.cs
Source File: LockedColorConverter.cs
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { SolidColorBrush result = new SolidColorBrush(); if (value != null) { try { Color inputColor = ((SolidColorBrush)value).Color; System.Drawing.Color color = System.Drawing.Color.FromArgb(inputColor.A, inputColor.R, inputColor.G, inputColor.B); Color lockedColor = ConvertHSVtoRGB(color.GetHue(), color.GetSaturation(), LOCKED_BRIGHTNESS_VALUE); result.Color = lockedColor; } catch { result.Color = Colors.Transparent; } } else result.Color = Colors.Transparent; return result; }
0
36. Example
Project: kwyjibo
Source File: ImageFilters.cs
Source File: ImageFilters.cs
public static HSBColor SampleHSBAverage(Bitmap bmp, int x, int y) { var samples = new Color[5]; // sample 5 pixels around x, y samples[0] = bmp.GetPixel(x, y); samples[1] = bmp.GetPixel(x - 2, y); samples[2] = bmp.GetPixel(x, y - 2); samples[3] = bmp.GetPixel(x + 2, y); samples[4] = bmp.GetPixel(x, y + 2); // take the average HSB var hue = samples[0].GetHue() + samples[1].GetHue() + samples[2].GetHue() + samples[3].GetHue() + samples[4].GetHue(); var sat = samples[0].GetSaturation() + samples[1].GetSaturation() + samples[2].GetSaturation() + samples[3].GetSaturation() + samples[4].GetSaturation(); var bri = samples[0].GetBrightness() + samples[1].GetBrightness() + samples[2].GetBrightness() + samples[3].GetBrightness() + samples[4].GetBrightness(); return new HSBColor { Hue = (decimal)hue / 5m, Saturation = (decimal)sat / 5m, Brightness = (decimal)bri / 5m }; }
0
37. Example
Project: finansu
Source File: Colors.cs
Source File: Colors.cs
private static object[] ColorToHSV(Color color, string flag) { int max = Math.Max(color.R, Math.Max(color.G, color.B)); int min = Math.Min(color.R, Math.Min(color.G, color.B)); double hue = color.GetHue(); double saturation = (max == 0) ? 0 : 1d - (1d * min / max); double value = max / 255d; switch (flag.ToLower()) { case "hue": case "h": return new object[] { hue }; case "saturation": case "sat": case "s": return new object[] { saturation }; case "value": case "val": case "v": case "brightness": case "b": return new object[] { value }; default: return new object[] { hue, saturation, value }; } }
0
38. Example
Project: route-planner-csharp
Source File: MapSymbolLockedColorConverter.cs
Source File: MapSymbolLockedColorConverter.cs
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) /n ..... /n //View Source file for more details /n }
0
39. Example
Project: route-planner-csharp
Source File: CustomSortComparers.cs
Source File: CustomSortComparers.cs
public int Compare(object x, object y) { Debug.Assert(x is Color); Debug.Assert(y is Color); float xBrightness = ((Color)x).GetBrightness(); float yBrightness = ((Color)y).GetBrightness(); int result = _CompareValues(xBrightness, yBrightness); // if brightness values are equals if (result == 0) { float xHue = ((Color)x).GetHue(); float yHue = ((Color)y).GetHue(); result = _CompareValues(xHue, yHue); // if hue values are equals if (result == 0) { float xSaturation = ((Color)x).GetSaturation(); float ySaturation = ((Color)y).GetSaturation(); return _CompareValues(xSaturation, ySaturation); } else return result; } else return result; }
0
40. Example
Project: VectorChimera
Source File: ColorPicker.cs
Source File: ColorPicker.cs
public void SetColor(Color color, bool both = true,string origin="slider") { if (both) { OldColor = SelectedColor = color; labelOldValue.Text = color.R.ToString("X") + color.G.ToString("X") + color.B.ToString("X"); } newColorBox.BackColor = oldColorBox.BackColor = OldColor; trackBarRed.Value = color.R; trackBarGreen.Value = color.G; trackBarBlue.Value = color.B; float cMax = Math.Max(Math.Max(color.R,color.G),color.B); float cMin = Math.Min(Math.Min(color.R, color.G), color.B); trackBarHue.Value = (int)(color.GetHue()*10); if (cMax - cMin == 0) trackBarSaturation.Value = 0; else trackBarSaturation.Value = (int)(((cMax-cMin)/cMax )* 1000); trackBarValue.Value = (int)(cMax); if (origin!="hex") textBoxHexa.Text = color.R.ToString("X") + color.G.ToString("X") + color.B.ToString("X"); UpdateRGBNewColor(); }
0
41. Example
Project: ATF
Source File: D2dDefaultTimelineRenderer.cs
Source File: D2dDefaultTimelineRenderer.cs
protected override void Draw(IInterval interval, RectangleF bounds, DrawMode drawMode, Context c) /n ..... /n //View Source file for more details /n }
0
42. Example
Project: ATF
Source File: DefaultTimelineRenderer.cs
Source File: DefaultTimelineRenderer.cs
protected override void Draw(IInterval interval, RectangleF bounds, DrawMode drawMode, Context c) /n ..... /n //View Source file for more details /n }
0
43. Example
Project: DotSpatial
Source File: PolarControl.cs
Source File: PolarControl.cs
protected override void OnBackColorChanged(EventArgs e) { base.OnBackColorChange/n ..... /n //View Source file for more details /n }
0
44. Example
Project: DotSpatial
Source File: PolarControl.cs
Source File: PolarControl.cs
private void DoBackColorChanged(EventArgs e) { base.OnBackColorChanged(e); /n ..... /n //View Source file for more details /n }
0
45. Example
Project: ATF
Source File: OverlayButton.cs
Source File: OverlayButton.cs
private Bitmap CreateNewBitmap(Bitmap src, float saturation, float brightness) { Bitmap result = (Bitmap)src.Clone(); for (int y = 0; y < src.Height; y++) { for (int x = 0; x < src.Width; x++) { Color srcColor = src.GetPixel(x, y); float s = MathUtil.Clamp(srcColor.GetSaturation() + saturation, 0.0f, 1.0f); float b = MathUtil.Clamp(srcColor.GetBrightness() + brightness, 0.0f, 1.0f); Color destColor = ColorUtil.FromAhsb(srcColor.A, srcColor.GetHue(), s, b); result.SetPixel(x, y, destColor); } } return result; }
0
46. Example
Project: MaxLifx
Source File: ScreenColourProcessor.cs
Source File: ScreenColourProcessor.cs
private void DoMainLoop(MaxLifxBulbController bulbController, ref int frames, DateTime start, /n ..... /n //View Source file for more details /n }
0
47. Example
Project: MapViewer
Source File: Effect.cs
Source File: Effect.cs
protected Color CalculateIntermediary(Color from, Color to, float fractionDone) { if (fractionDone >= 1.0f) return to; if (fractionDone <= 0.0f) return from; // There are a couple of different strategies we could use here: // - Calc intermediary individual RGB components - fastest // - Calc intermediary HSB components - nicest results, but slower //Color c = Color.FromArgb( // this.CalculateIntermediary(from.R, to.R, fractionDone), // this.CalculateIntermediary(from.G, to.G, fractionDone), // this.CalculateIntermediary(from.B, to.B, fractionDone) //); Color c = FromHSB( this.CalculateIntermediary(from.GetHue(), to.GetHue(), fractionDone), this.CalculateIntermediary(from.GetSaturation(), to.GetSaturation(), fractionDone), this.CalculateIntermediary(from.GetBrightness(), to.GetBrightness(), fractionDone) ); return Color.FromArgb(this.CalculateIntermediary(from.A, to.A, fractionDone), c); }
0
48. Example
Project: kwyjibo
Source File: ImageFilters.cs
Source File: ImageFilters.cs
public static unsafe void HSLFilter(Bitmap bmp, float h, float s, float l, float ht, float st, float lt) { BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb); byte* bmpPtrA = (byte*)(data.Scan0); int move = data.Stride - data.Width * 3; float hd, sd, ld; Color c; for (int i = 0; i < data.Height; i++) { for (int j = 0; j < data.Width; j++) { c = Color.FromArgb(bmpPtrA[2], bmpPtrA[1], bmpPtrA[0]); hd = Math.Abs(((((c.GetHue() - h) % 360) + 540) % 360) - 180); sd = Math.Abs(c.GetSaturation() - s); ld = Math.Abs(c.GetBrightness() - l); if (hd < 0 || hd > ht || sd > st || ld > lt) { bmpPtrA[0] = 0; bmpPtrA[1] = 0; bmpPtrA[2] = 0; } bmpPtrA += 3; } bmpPtrA += move; } bmp.UnlockBits(data); }
0
49. Example
Project: Chromatics
Source File: HueInterface.cs
Source File: HueInterface.cs
public async void HueUpdateStateBrightness(BulbModeTypes mode, Color col, int? brightness, int trans/n ..... /n //View Source file for more details /n }
0
50. Example
Project: GRBL-Plotter
Source File: svgPalette.cs
Source File: svgPalette.cs
public static int getToolNr(Color mycolor,int mode) { int i,start=1; Array.Sort<palette>(svgToolTable, (x, y) => x.toolnr.CompareTo(y.toolnr)); // sort by tool nr if (useException) start=0; // first element is exception for (i = start; i < svgToolIndex; i++) { if (mycolor == svgToolTable[i].clr) // direct hit { tmpIndex = i; return svgToolTable[i].toolnr; } else if (mode == 0) svgToolTable[i].diff = ColorDiff(mycolor, svgToolTable[i].clr); else if (mode == 1) svgToolTable[i].diff = getHueDistance(mycolor.GetHue(), svgToolTable[i].clr.GetHue()); else svgToolTable[i].diff = Math.Abs(ColorNum(svgToolTable[i].clr) - ColorNum(mycolor)) + getHueDistance(svgToolTable[i].clr.GetHue(), mycolor.GetHue()); } Array.Sort<palette>(svgToolTable, (x, y) => x.diff.CompareTo(y.diff)); // sort by color difference tmpIndex = 0; return svgToolTable[0].toolnr; ; // return tool nr of nearest color }