Exemple #1
0
        //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ColorPool_Start >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        private void ColorPool_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }
            _lockarea = LockArea.InPool;

            if ((e.X <= (bm_temp_Size - 1)) && (e.X >= 0))
            {
                Poolpoint_Lock_on.X = e.X;
            }
            else if (e.X > (bm_temp_Size - 1))
            {
                Poolpoint_Lock_on.X = (int)(bm_temp_Size - 1);
            }
            else
            {
                Poolpoint_Lock_on.X = 0;
            }
            if ((e.Y <= (bm_temp_Size - 1)) && (e.Y >= 0))
            {
                Poolpoint_Lock_on.Y = e.Y;
            }
            else if (e.Y > (bm_temp_Size - 1))
            {
                Poolpoint_Lock_on.Y = (int)(bm_temp_Size - 1);
            }
            else
            {
                Poolpoint_Lock_on.Y = 0;    //更新lock座標
            }
            Draw_SV_Matrix();
            //=======================繪製結束=====================================================
            Color cr_temp = bm_temp.GetPixel(Poolpoint_Lock_on.X, Poolpoint_Lock_on.Y);

            _brush.Color = Color.FromArgb(_brush.Color.A, cr_temp.R, cr_temp.G, cr_temp.B);
            PenColorDisplay.BackColor = _brush.Color;

            Red.Value   = _brush.Color.R;
            Green.Value = _brush.Color.G;
            Blue.Value  = _brush.Color.B;

            R_val.Text = _brush.Color.R.ToString();
            G_val.Text = _brush.Color.G.ToString();
            B_val.Text = _brush.Color.B.ToString();

            ColorPool.Image = bm_temp;
        }
Exemple #2
0
        private void ColorRing_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }
            Color tempColor = _brush.Color;

            try { tempColor = ColorRingBgImageClone.GetPixel(e.X, e.Y); }
            catch {; }

            if (tempColor.A != 255)
            {
                return;
            }
            _lockarea = LockArea.InRing;

            if (!((e.X == 850) && (e.Y == 116)))
            {
                H = Math.Atan2((double)(116 - e.Y), (double)(e.X - 850));//求出色相的degree
                H = H / Math.PI * 180 - 90;
                if (H < 0)
                {
                    H = H + 360;
                }
            }
            Draw_SV_Matrix();
            //=======================繪製結束=====================================================
            Color cr_temp = bm_temp.GetPixel(Poolpoint_Lock_on.X, Poolpoint_Lock_on.Y);

            _brush.Color = Color.FromArgb(_brush.Color.A, cr_temp.R, cr_temp.G, cr_temp.B);
            PenColorDisplay.BackColor = _brush.Color;

            Red.Value   = _brush.Color.R;
            Green.Value = _brush.Color.G;
            Blue.Value  = _brush.Color.B;

            R_val.Text = _brush.Color.R.ToString();
            G_val.Text = _brush.Color.G.ToString();
            B_val.Text = _brush.Color.B.ToString();

            ColorRing.Invalidate();

            ColorPool.Image = bm_temp;
        }
Exemple #3
0
 private void HanaPanel_MouseUp(object sender, MouseEventArgs e)
 {
     _lockarea  = LockArea.None;
     DrawBuffer = false;
     if (_mode == Mode.Pencil)
     {
         using (Graphics Hbmp = Graphics.FromImage(HanaBitmap))
         {
             //畫線
             Hbmp.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
             if (_line.Count > 1)
             {
                 Hbmp.DrawLines(_brush, _line.ToArray());
             }
             else
             {
                 int _wd = (int)_brush.Width;
                 Hbmp.FillEllipse(new SolidBrush(_brush.Color), e.X - _wd / 2, e.Y - _wd / 2, _wd, _wd);
             }
         }
         _line.Clear();
     }
     else if (_mode == Mode.Eraser)
     {
         using (Graphics Hbmp = Graphics.FromImage(HanaBitmap))
         {
             //畫線
             Hbmp.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
             if (_line.Count > 1)
             {
                 Hbmp.DrawLines(_eraser, _line.ToArray());
             }
             else
             {
                 int _wd = (int)_eraser.Width;
                 Hbmp.FillEllipse(new SolidBrush(_eraser.Color), e.X - _wd / 2, e.Y - _wd / 2, _wd, _wd);
             }
         }
         _line.Clear();
     }
 }
Exemple #4
0
        private void HanaPanel_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }
            _lockarea = LockArea.InPanel;
            Hana.Focus();

            if (_mode == Mode.Pencil)
            {
                _line.Add(e.Location);
                HanaBuffer.Dispose();
                HanaBuffer = new Bitmap(HanaBitmap);
                using (Graphics Hbfr = Graphics.FromImage(HanaBuffer)) {
                    //畫點
                    Hbfr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                    int _wd = (int)_brush.Width;
                    Hbfr.FillEllipse(new SolidBrush(_brush.Color), e.X - _wd / 2, e.Y - _wd / 2, _wd, _wd);
                }
                DrawBuffer = true;
                Hana.Invalidate();
            }
            else if (_mode == Mode.Eraser)
            {
                _line.Add(e.Location);
                HanaBuffer.Dispose();
                HanaBuffer = new Bitmap(HanaBitmap);
                using (Graphics Hbfr = Graphics.FromImage(HanaBuffer)){
                    //畫點
                    Hbfr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                    int _wd = (int)_eraser.Width;
                    Hbfr.FillEllipse(new SolidBrush(_eraser.Color), e.X - _wd / 2, e.Y - _wd / 2, _wd, _wd);
                }
                DrawBuffer = true;
                Hana.Invalidate();
            }
        }
Exemple #5
0
 private void ColorRing_MouseUp(object sender, MouseEventArgs e)
 {
     _lockarea = LockArea.None;
 }