mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2025-12-13 00:58:31 +00:00
Added some content
parent
71454bb4e7
commit
ab16b6b76d
@ -1 +1,25 @@
|
||||
TODO
|
||||
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
|
||||
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/c/c9/Radial-gradient.svg" width="128" height="128">
|
||||
|
||||
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.
|
||||
Loading…
x
Reference in New Issue
Block a user