/// <summary> /// Creates a D2dLinearGradientBrush that contains the specified gradient stops, /// extend mode, and gamma interpolation. It has no transform and has a base opacity of 1.0.</summary> /// <param name="pt1">A System.Drawing.PointF structure that represents the starting point of the linear gradient</param> /// <param name="pt2">A System.Drawing.PointF structure that represents the endpoint of the linear gradient</param> /// <param name="gradientStops">An array of D2dGradientStop structures that describe the colors in the brush's gradient /// and their locations along the gradient line</param> /// <param name="extendMode">The behavior of the gradient outside the [0,1] normalized range</param> /// <param name="gamma">The space in which color interpolation between the gradient stops is performed</param> /// <returns>A new instance of D2dLinearGradientBrush</returns> public static D2dLinearGradientBrush CreateLinearGradientBrush( PointF pt1, PointF pt2, D2dGradientStop[] gradientStops, D2dExtendMode extendMode, D2dGamma gamma) { return(s_gfx.CreateLinearGradientBrush(pt1, pt2, gradientStops, extendMode, gamma)); }
internal D2dLinearGradientBrush(D2dGraphics owner, PointF pt1, PointF pt2, D2dGradientStop[] gradientStops, D2dExtendMode extendMode, D2dGamma gamma) : base(owner) { m_start = pt1; m_end = pt2; m_gradientStops = new D2dGradientStop[gradientStops.Length]; Array.Copy(gradientStops, m_gradientStops, m_gradientStops.Length); m_gamma = gamma; m_extendMode = extendMode; Create();//to-do: it's dangerous to call a virtual method in a constructor; derived class may not be properly initialized! }
/// <summary> /// Creates a D2dLinearGradientBrush that contains the specified gradient stops, /// extend mode, and gamma interpolation. has no transform, and has a base opacity of 1.0.</summary> /// <param name="pt1">A System.Drawing.PointF structure that represents the starting point of the /// linear gradient</param> /// <param name="pt2">A System.Drawing.PointF structure that represents the endpoint of the linear gradient</param> /// <param name="gradientStops">An array of D2dGradientStop structures that describe the colors in the brush's gradient /// and their locations along the gradient line</param> /// <param name="extendMode">The behavior of the gradient outside the [0,1] normalized range</param> /// <param name="gamma">The space in which color interpolation between the gradient stops is performed</param> /// <returns>A new instance of D2dLinearGradientBrush</returns> public D2dLinearGradientBrush CreateLinearGradientBrush( PointF pt1, PointF pt2, D2dGradientStop[] gradientStops, D2dExtendMode extendMode, D2dGamma gamma) { return new D2dLinearGradientBrush(this, pt1, pt2, gradientStops, extendMode, gamma); }