void MakeValue() { for (int y = 0; y < 256; y++) { FloatingColor c = FloatingColor.Hsv(color.H, color.S, 1.0 - y / 255.0); SetPixel(y, c.ToColor()); } }
void MakeHud() { for (int y = 0; y < 256; y++) { FloatingColor c = FloatingColor.Hsv(Math.Round((1.0 - y / 255.0) * 360.0), 1.0, 1.0); SetPixel(y, c.ToColor()); } }
void MakeSat() { for (int y = 0; y < 256; y++) { FloatingColor c = FloatingColor.Hsv(color.H, 1.0 - y / 255.0, color.V); SetPixel(y, c.ToColor()); } }
void MakeBlue() { for (int y = 0; y < 256; y++) { FloatingColor c = FloatingColor.Rgb(color.R, color.G, 1.0 - y / 255.0); SetPixel(y, c.ToColor()); } }
void MakeGreen() { for (int y = 0; y < 256; y++) { FloatingColor c = FloatingColor.Rgb(color.R, 1.0 - y / 255.0, color.B); SetPixel(y, c.ToColor()); } }
public static FloatingColor Rgb(double r, double g, double b) { FloatingColor color = new FloatingColor(); color.r = Math.Max(0.0, Math.Min(1.0, r)); color.g = Math.Max(0.0, Math.Min(1.0, g)); color.b = Math.Max(0.0, Math.Min(1.0, b)); color.rgb = true; return(color); }
public static FloatingColor Hsv(double h, double s, double v) { FloatingColor color = new FloatingColor(); color.h = Math.Max(0.0, Math.Min(360.0, h)); color.s = Math.Max(0.0, Math.Min(1.0, s)); color.v = Math.Max(0.0, Math.Min(1.0, v)); color.hsv = true; return(color); }
void MakeValue() { for (int y = 0; y < 256; y++) { for (int x = 0; x < 256; x++) { FloatingColor c = FloatingColor.Hsv(Math.Floor(x / 255.0 * 360.0), 1.0 - y / 255.0, color.V); image.SetPixel(x, y, c.ToColor()); } } }
void MakeHud() { for (int y = 0; y < 256; y++) { for (int x = 0; x < 256; x++) { FloatingColor c = FloatingColor.Hsv(color.H, x / 255.0, 1.0 - y / 255.0); image.SetPixel(x, y, c.ToColor()); } } }
void TxtHex_TextChanged(object sender, EventArgs e) { if (TxtHex.Focused) { FloatingColor color = FloatingColor.FromString(TxtHex.Text); if (color != null) { this.color.R = color.R; this.color.G = color.G; this.color.B = color.B; } } }
public FloatingColor Clone() { FloatingColor color = new FloatingColor(); color.r = r; color.g = g; color.b = b; color.h = h; color.s = s; color.v = v; color.rgb = rgb; color.hsv = hsv; return(color); }
public ColorPickerPane() { InitializeComponent(); image = new ImageContext(256, 256); borderPen = new Pen(System.Drawing.Color.FromArgb(113, 122, 138)); type = RenderType.Hud; color = null; xValue = 0; yValue = 0; timer = new Timer(); timer.Interval = 40; timer.Tick += new EventHandler(timer_Tick); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void colorPicker_Pressed(object sender, HandledEventArgs e) { ColorPicker cp = new ColorPicker(); FloatingColor color = FloatingColor.FromString(Clipboard.GetText(TextDataFormat.Text)); if (color != null) { cp.Color = color.ToColor(); } else { Random r = new Random(); cp.Color = Color.FromArgb(r.Next(0, 255), r.Next(0, 255), r.Next(0, 255)); } cp.Show(); cp.Focus(); }
public ColorPicker() { InitializeComponent(); color = FloatingColor.Rgb(0, 0, 0); }