protected override void OnPlaneScroll(ColorSelectionPlane plane) { double newsaturation = XYZ.ClipValue(plane.PositionX, 0.0, 1.0), newvalue = 1.0 - XYZ.ClipValue(plane.PositionY, 0.0, 1.0); if (newsaturation == _color.S && newvalue == _color.V) { return; } _color.S = newsaturation; _color.V = newvalue; RaiseColorChanged(); }
// interpolates alpha list private byte Interpolate(AlphaPoint[] list, int a, int b, double pos) { if (b < a) { return(0); } if (a == b) { return((byte)(list[a].Alpha * 255.0)); } //compute involving focus position return((byte)XYZ.ClipValue( (list[a].Alpha + FocusToBalance(list[a].Position, list[b].Position, list[b].Focus, pos) * (list[b].Alpha - list[a].Alpha)) * 255.0, 0.0, 255.0)); }
protected override void OnPlaneScroll(ColorSelectionPlane plane) { double newhue = XYZ.ClipValue(plane.PositionX, 0.0, 1.0), newsaturation = 1.0 - XYZ.ClipValue(plane.PositionY, 0.0, 1.0); if (newhue == _color.H && newsaturation == _color.S) { return; } _color.H = newhue; _color.S = newsaturation; UpdateFaderImage(); RaiseColorChanged(); }
public bool SetPosition(double value) { value = XYZ.ClipValue(value, 0.0, 1.0); if ((Control.ModifierKeys & Keys.Shift) != 0) { value = Math.Round(value * 8.0, 0) / 8.0; } if (value == _position) { return(false); } this.Invalidate(Rectangle.Inflate(GetScrollerRectangle(_position), 1, 1)); _position = value; this.Invalidate(Rectangle.Inflate(GetScrollerRectangle(_position), 1, 1)); this.Update(); return(true); }
public bool SetPosition(double posx, double posy) { posx = XYZ.ClipValue(posx, 0.0, 1.0); posy = XYZ.ClipValue(posy, 0.0, 1.0); if ((Control.ModifierKeys & Keys.Shift) != 0) { posx = Math.Round(posx * 8.0, 0) / 8.0; posy = Math.Round(posy * 8.0, 0) / 8.0; } if (posx == _x && posy == _y) { return(false); } Invalidate(Rectangle.Inflate(GetCursorBounds(_x, _y), 1, 1)); _x = posx; _y = posy; Invalidate(Rectangle.Inflate(GetCursorBounds(_x, _y), 1, 1)); this.Update(); return(true); }
/// <summary> /// Create a lighting value with the specified color and intensity /// </summary> /// <param name="color"></param> /// <param name="intensity">Percentage value in the range 0.0 -> 1.0 (from 0% to 100%).</param> public LightingValue(Color color, double intensity) { HSV.FromRGB(color, out _hue, out _saturation, out _value); _intensity = XYZ.ClipValue(intensity, 0, 1); }
public DiscreteValue(Color color, double intensity) { _color = color; _intensity = XYZ.ClipValue(intensity, 0, 1); }