コード例 #1
0
        public override IBrush GetBrush(byte alpha)
        {
            if (_canvasLinearGradientBrush == null)
            {
                var startPoint = new Vector((float)_x0, (float)_y0);
                var endPoint   = new Vector((float)_x1, (float)_y1);

                startPoint = LocalMatrix.Transform(startPoint);
                endPoint   = LocalMatrix.Transform(endPoint);

                _canvasLinearGradientBrush = new ImmutableLinearGradientBrush(_canvasGradientStopCollection,
                                                                              alpha / 255f,
                                                                              startPoint: new RelativePoint(startPoint.X, startPoint.Y, RelativeUnit.Relative),
                                                                              endPoint: new RelativePoint(endPoint.X, endPoint.Y, RelativeUnit.Relative));
            }

            return(_canvasLinearGradientBrush);
        }
コード例 #2
0
 public void Dispose()
 {
     _canvasLinearGradientBrush = null;
 }