internal override void Create()
        {
            if (NativeBrush != null)
            {
                NativeBrush.Dispose();
            }

            var stops = new GradientStop[m_gradientStops.Length];

            for (int s = 0; s < m_gradientStops.Length; s++)
            {
                stops[s].Color    = m_gradientStops[s].Color.ToColor4();
                stops[s].Position = m_gradientStops[s].Position;
            }

            var props = new RadialGradientBrushProperties
            {
                Center = m_center.ToSharpDX(),
                GradientOriginOffset = m_gradientOriginOffset.ToSharpDX(),
                RadiusX = m_radiusX,
                RadiusY = m_radiusY
            };

            using (var stopcol = new GradientStopCollection(Owner.D2dRenderTarget, stops, Gamma.StandardRgb, ExtendMode.Clamp))
            {
                NativeBrush = new RadialGradientBrush(Owner.D2dRenderTarget, props, stopcol);
            }
        }
示例#2
0
 /// <summary>
 /// Create or recreate native resource</summary>
 internal override void Create()
 {
     if (NativeBrush != null)
     {
         NativeBrush.Dispose();
     }
     NativeBrush = new SolidColorBrush(Owner.D2dRenderTarget, m_color.ToColor4());
 }
        internal override void Create()
        {
            if (NativeBrush != null)
            {
                NativeBrush.Dispose();
            }

            m_bitmap.Create();
            var props = new BitmapBrushProperties();

            props.InterpolationMode = BitmapInterpolationMode.Linear;
            NativeBrush             = new BitmapBrush(Owner.D2dRenderTarget, m_bitmap.NativeBitmap, props);

            ExtendModeX       = m_extendModeX;
            ExtendModeY       = m_extendModeY;
            InterpolationMode = D2dBitmapInterpolationMode.Linear;
            Location          = m_location;
            Bitmap            = m_bitmap;
        }
示例#4
0
        internal override void Create()
        {
            if (NativeBrush != null)
            {
                NativeBrush.Dispose();
            }
            var stops = new GradientStop[m_gradientStops.Length];

            for (int s = 0; s < m_gradientStops.Length; s++)
            {
                stops[s].Color    = m_gradientStops[s].Color.ToColor4();
                stops[s].Position = m_gradientStops[s].Position;
            }

            using (var stopcol = new GradientStopCollection(Owner.D2dRenderTarget, stops, (Gamma)m_gamma, (ExtendMode)m_extendMode))
            {
                var props = new LinearGradientBrushProperties
                {
                    StartPoint = m_start.ToSharpDX(),
                    EndPoint   = m_end.ToSharpDX()
                };
                NativeBrush = new LinearGradientBrush(Owner.D2dRenderTarget, props, stopcol);
            }
        }