LinearGradientBrush in XAML Silverlight
Introduction
In
Silverlight, LinearGradientBrush paints area with a gradient. A linear gradient
defines a gradient along a line. The line’s end point is defined by the Start
and End points properties of the linear gradient. LinearGradientBrush paints
these stops along this line.
Working
on LinearGradientBrush by hand is very tedious job especially when we have many
colors. Here color picker will be very useful. Let’s talk how to work with
this.
To work
with color picker, select the third tab allows to visually editing gradient
brushes. The gradient brush editor fully based on GradientStop slider. Look at
below:
In above
image, we have used 5 stopper and each has different color gradient. Stopper
location is known as Offset point. Offset value always varies between 0 to 1.
Each stopper has offset value which locates the position on slider.
By using
marked point (red circle) we can reverse the gradient stopper. By using marked
point (blue circle) we can convert the brush in radial or linear form. If you
wish to change the gradient color of any point (stopper) then select the
stopper first and then pick the color.
We can
inset the new stopper in slider by just clicking on slider and even we can
delete the stopper by dragging the stopper icon.
If we
unhide the advanced properties of brushes then we will find some more stuffs.
Look at image below:
In above
image,
StartPoint
This gets
or sets the two dimensional coordinates for the start point of the linear
gradient.
EndPoint
This gets
or sets the two dimensional coordinates for the end point of the linear
gradient.
MappingMode
This gets
or sets the value that specifies whether the gradient brush positioning
coordinates are absolute or relative to the output area.
SpreadMethod
This gets
or sets the type of spread method that specifies how to drag a gradient that
starts of ends inside the bounds of the object to be painted.
Opacity
This is
very useful option by which we can get or set the opacity of the brush.
Above
icons are very useful, by which we can make transformation in brush. This will
create an interesting color output in our art.
Comments
Post a Comment