示例#1
0
    public void FromColor()
    {
        var yellow = Colors.Yellow;
        var result = ARGBColor.FromColor(yellow);

        Assert.Equal(yellow.A, result.A);
        Assert.Equal(yellow.R, result.R);
        Assert.Equal(yellow.G, result.G);
        Assert.Equal(yellow.B, result.B);
    }
    public static SerializableStroke FromStroke(Stroke stroke)
    {
        if (stroke == null)
        {
            throw new ArgumentNullException(nameof(stroke));
        }
        var attr = new StrokeAttributes
        {
            Color          = ARGBColor.FromColor(stroke.DrawingAttributes.Color),
            Height         = stroke.DrawingAttributes.Height,
            Width          = stroke.DrawingAttributes.Width,
            IgnorePressure = stroke.DrawingAttributes.IgnorePressure,
            IsHighlighter  = stroke.DrawingAttributes.IsHighlighter,
            StylusTip      = stroke.DrawingAttributes.StylusTip
        };

        var points = stroke.StylusPoints.Select(point => point.ToPoint()).ToArray();

        return(new SerializableStroke(attr, points));
    }
 public ChangeBackgroundInstruction(Color background) : this(ARGBColor.FromColor(background))
 {
 }