-
Notifications
You must be signed in to change notification settings - Fork 18
Radial Gradient Brush
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 LED.
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.The radius of the drawn circle is the biggest distance from the center to the farthest point of the rectangle this brush is rendered to.
If you want to create a background on your keyboard looking like this
you could use this code
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.
Please drop me a message if you find mistakes or inadequate descriptions in one of the pages here!
-
Introduction
1.1. What is CUE.NET?
1.2. What can I do with CUE.NET?
1.3. Projects using CUE.NET -
Getting started
2.1. Adding CUE.NET to a project
2.2. Initializing CUE.NET
2.3. Perform basic lighting
2.4. Understanding CUE.NET ledgroups -
Gradients
3.1. Understanding CUE.NET gradients
3.2. Linear Gradient
3.3. Rainbow Gradient
3.4. Implementing an own gradient -
Brushes
4.1. Understanding CUE.NET brushes
4.2. Color-Corrections
4.3. Solid-Color Brush
4.4. Linear-Gradient Brush
4.5. Radial-Gradient Brush
4.6. Random-Color Brush
4.7. Image-Brush
4.8. Implementing an own brush -
Effects
5.1. Understanding CUE.NET effects
5.2. Flash Effect
5.3. Move-Gradient Effect
5.4. Implementing an own effect -
Tutorials