예제 #1
0
 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());
     }
 }
예제 #2
0
 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());
     }
 }
예제 #3
0
 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());
     }
 }
예제 #4
0
 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());
     }
 }
예제 #5
0
 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());
     }
 }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }
예제 #8
0
 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());
         }
     }
 }
예제 #9
0
 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());
         }
     }
 }
예제 #10
0
 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;
         }
     }
 }
예제 #11
0
        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);
        }
예제 #12
0
        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);
        }
예제 #13
0
        /// <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();
        }
예제 #14
0
        public ColorPicker()
        {
            InitializeComponent();

            color = FloatingColor.Rgb(0, 0, 0);
        }