From ab16b6b76d51e8a9b497c4aa4113e629046b44c8 Mon Sep 17 00:00:00 2001 From: DarthAffe Date: Sun, 29 Nov 2015 12:52:03 +0100 Subject: [PATCH] Added some content --- Radial-Gradient-Brush.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Radial-Gradient-Brush.md b/Radial-Gradient-Brush.md index 30404ce..b71fe9c 100644 --- a/Radial-Gradient-Brush.md +++ b/Radial-Gradient-Brush.md @@ -1 +1,25 @@ -TODO \ No newline at end of file +The _RadialGradientBrush_ is one of the default brushes provided by CUE.NET. +It's used to draw a gradient as a "circle" inside a rectangle. + +You are able to define the center-point of the circle and the gradient which should be drawn by either providing them as constructor-parameters or using the _Center_- and _Gradient_-Properties. +If you don't set a gradient the brush will return transparent for every key. +> The Center-Point is given as the percentage from the top left corner. +> new PointF(0f, 0f) will be top left, new PointF(0,5f, 0,5f) in the center and new PointF(1f, 1f) in the bottom right. + +If you want to create a background on your keyboard looking like this + + + +you could use this code +```C# +GradientStop[] gradientStops = +{ + new GradientStop(0f, Color.Cyan), + new GradientStop(1f, Color.Red) +}; +LinearGradient cyanToRedGradient = new LinearGradient(gradientStops); // Gradient from cyan to red +PointF center = new PointF(0.5f, 0.5f); // Center +RadialGradientBrush radialBrush = new RadialGradientBrush(center, cyanToRedGradient); +keyboard.Brush = radialBrush; +``` +> Note that the this code won't produce exactly what is seen in the image above, since the gradient in this image isn't fully linear. But this shouldn't matter for this example. \ No newline at end of file