public static HSVtoColor ( HSV hsv ) : Color | ||
hsv | HSV | The hsv. |
Результат | Color |
/// <summary> /// The get colors. /// </summary> /// <returns> /// </returns> private Color[] GetColors() { Color[] colors = new Color[colorTesselation]; for (int i = 0; i < colorTesselation; i++) { int hue = (i * 360) / colorTesselation; colors[i] = ColorHandler.HSVtoColor(new ColorHandler.HSV(hue, 100, 100)); } return(colors); }
/// <summary> /// The update box. /// </summary> public void updateBox() { colorBox.BackColor = ColorHandler.HSVtoColor(hsvColor); ColorHandler.RGB tempRGB = ColorHandler.HSVtoRGB(hsvColor); updatingColors = true; if (alphaText != null) { alphaText.Text = (this.color.Alpha / 255f).ToString(); } redText.Text = (tempRGB.Red / 255f).ToString(); greenText.Text = (tempRGB.Green / 255f).ToString(); blueText.Text = (tempRGB.Blue / 255f).ToString(); updatingColors = false; }
/// <summary> /// The draw bar. /// </summary> /// <param name="g"> /// The g. /// </param> /// <param name="width"> /// The width. /// </param> /// <param name="height"> /// The height. /// </param> private void DrawBar(Graphics g, int width, int height) { PointF[] points = new PointF[2]; for (int i = 0; i < points.Length; i++) { points[i].X = width / 2; points[i].Y = i * height; } ColorHandler.HSV col = new ColorHandler.HSV(hsvColor.Hue, hsvColor.Saturation, 100); using ( LinearGradientBrush lgb = new LinearGradientBrush( points[0], points[1], ColorHandler.HSVtoColor(col), Color.Black)) { g.FillRectangle(lgb, 0, 0, width, height); } }