// void Released(object sender, ManipulationDeltaRoutedEventArgs e) // { // if (e.IsInertial) e.Complete(); // // setColor(Color.FromArgb(CA.Value, CR.Value, CG.Value, CB.Value)); // // setColor(Color.FromArgb(255, CR.Value, CG.Value, CB.Value)); // } // public SolidColorBrush BrushDef // { // get { return ColorDef.Background as SolidColorBrush; } // set { ColorDef.Background = value; setColor(value.Color); } // } // public SolidColorBrush BrushSel // { // get { return ColorSel.Background as SolidColorBrush; } // set { ColorSel.Background = value; } // } public void set(LayerPaint.Color c, float h, float s, float b) { // BrushSel.Color = c; // //CA.Value = c.A; // CR.Value = c.R; // CG.Value = c.G; // CB.Value = c.B; int cr = (r - (int)SlideSel.Width) / 2; //修改角度 var vp = LayerPaint.Vec2.forAngle(90 - h, cr); //SlideSel.Margin = new Thickness(vp.X, vp.Y, 0, 0); SlideSel.SetValue(Canvas.LeftProperty, (vp.X) + cr); SlideSel.SetValue(Canvas.TopProperty, (vp.Y) + cr); //修改坐标 PickSel.SetValue(Canvas.LeftProperty, (s) * W - f); PickSel.SetValue(Canvas.TopProperty, (1 - b) * W - f); angle = (int)h; (PickSel.Fill as SolidColorBrush).Color = c; /* * g.Color = c; * g.fillRect(0, 0, 10, 10); * g.Invalidate(); */ drawPick(); }
public void setColor(LayerPaint.Color c) { set(c, c.H, c.S, c.V); }