Provides methods that creates brushes.
        /// <summary>
        /// When implemented in a derived class, returns an object that is set as the value of the target property for this markup extension.
        /// </summary>
        /// <param name="serviceProvider">
        /// Object that can provide services for the markup extension.
        /// </param>
        /// <returns>
        /// The object value to set on the property where the extension is applied.
        /// </returns>
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            var diffuse  = new SolidColorBrush(this.color);
            var specular = BrushHelper.CreateGrayBrush(this.SpecularIntensity);

            return(MaterialHelper.CreateMaterial(diffuse, null, specular, this.Opacity, this.SpecularPower));
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SlopeTexture"/> class.
 /// </summary>
 /// <param name="gradientSteps">
 /// The gradient steps.
 /// </param>
 public SlopeTexture(int gradientSteps)
 {
     if (gradientSteps > 0)
     {
         this.Brush = BrushHelper.CreateSteppedGradientBrush(GradientBrushes.BlueWhiteRed, gradientSteps);
     }
     else
     {
         this.Brush = GradientBrushes.BlueWhiteRed;
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SlopeDirectionTexture"/> class.
 /// </summary>
 /// <param name="gradientSteps">
 /// The gradient steps.
 /// </param>
 public SlopeDirectionTexture(int gradientSteps)
 {
     if (gradientSteps > 0)
     {
         this.Brush = BrushHelper.CreateSteppedGradientBrush(GradientBrushes.Hue, gradientSteps);
     }
     else
     {
         this.Brush = GradientBrushes.Hue;
     }
 }