Esempio n. 1
0
 public static RadialGradientBrush New(string name, Direct2DDevice device, RadialGradient radialGradient)
 {
     using (var d2dGradientStopCollection = new SharpDX.Direct2D1.GradientStopCollection(device,
                                                                                         radialGradient.GradientStops.Select(gs => (SharpDX.Direct2D1.GradientStop)gs).ToArray(),
                                                                                         (SharpDX.Direct2D1.ExtendMode)radialGradient.GradientStops.ExtendMode))
     {
         var rgbProperties = new RadialGradientBrushProperties
         {
             Center = radialGradient.Center,
             GradientOriginOffset = radialGradient.OriginOffset,
             RadiusX = radialGradient.RadiusX,
             RadiusY = radialGradient.RadiusY
         };
         var brushProperties = new BrushProperties()
         {
             Opacity = radialGradient.Opacity
         };
         var brush = new SharpDX.Direct2D1.RadialGradientBrush(device, rgbProperties, brushProperties, d2dGradientStopCollection);
         return(new RadialGradientBrush(name, device, radialGradient, brush));
     }
 }
Esempio n. 2
0
 private RadialGradientBrush(string name, Direct2DDevice device, RadialGradient radialGradient, SharpDX.Direct2D1.RadialGradientBrush brush)
     : base(name, device, radialGradient, brush)
 {
     resource      = brush;
     colorResource = radialGradient;
 }