예제 #1
0
        /// <summary>
        /// Initializes a LinearGradientBrush.
        /// </summary>
        /// <param name="startPoint"> The start point. </param>
        /// <param name="endPoint"> The end point. </param>
        /// <param name="color"> The color. </param>
        /// <returns> The product <see cref="IBrush"/>. </returns>
        public static IBrush LinearGradientBrush(Vector2 startPoint, Vector2 endPoint, Color color)
        {
            Vector2 center = startPoint;
            Vector2 yPoint = endPoint;

            return(new BrushBase
            {
                Type = BrushType.LinearGradient,

                Stops = GreyWhiteMeshHelpher.GetGradientStopArray(color),
                Extend = CanvasEdgeBehavior.Clamp,

                Center = center,
                YPoint = yPoint,
            });
        }
예제 #2
0
        /// <summary>
        /// Initializes a LinearGradientBrush.
        /// </summary>
        /// <param name="transformer"> The transformer. </param>
        /// <returns> The product <see cref="IBrush"/>. </returns>
        public static IBrush LinearGradientBrush(Transformer transformer)
        {
            Vector2 center = transformer.Center;
            Vector2 yPoint = transformer.CenterBottom;

            return(new BrushBase
            {
                Type = BrushType.LinearGradient,

                Stops = GreyWhiteMeshHelpher.GetGradientStopArray(),
                Extend = CanvasEdgeBehavior.Clamp,

                Center = center,
                YPoint = yPoint,
            });
        }
        private void ChangingStopsCore(Color color)
        {
            switch (this.Type)
            {
            case BrushType.Color:
                this.Stops = GreyWhiteMeshHelpher.GetGradientStopArray(this.Color);
                break;

            case BrushType.LinearGradient:
            case BrushType.RadialGradient:
            case BrushType.EllipticalGradient:
                break;

            default:
                this.Stops = GreyWhiteMeshHelpher.GetGradientStopArray(color);
                break;
            }
        }