-
Notifications
You must be signed in to change notification settings - Fork 18
Understanding CUE.NET brushes
In CUE.NET a brush is used to apply colors to a ledgroup.
Usually the calculation of the color for a specific key is based on a gradient but there is no need for this.
Typically a brush consists of some color information and a shape or something similar that defines how the brush colors LEDs.
The whole software-design of CUE.NET is built around brushes so you should use them for every coloring you do.
CUE.NET provides by default five (+1 deprecated) brushes:
- Solid-Color-Brush
- Linear-Gradient-Brush
- Radial-Gradient-Brush
- Random-Color-Brush
- Image-Brush
- Profile-Brush (deprecated - only works with CUE 1)
Of course you can always implement your own brush.
Using a brush is straight forward. Just take a LedGroup (remember that the device itself is a LedGroup too) and assign your brush to the Brush-Property.
IBrush brush = new SolidColorBrush(Color.White);
myLedGroup.Brush = brush;
In most cases it's recommended to use the device-brush as an background and work on a ledgroups only, even if you want to color the whole device. Otherwise using transparency might cause some sort of color-bleeding. Adding a rainbow over the whole keyboard could look like this:
CueSDK.KeyboardSDK.Brush = (SolidColorBrush) Color.Black;
ILedGroup rainbowLeds = new ListLedGroup(CueSDK.KeyboardSDK, CueSDK.KeyboardSDK);
rainbowLeds.Brush = new LinearGradientBrush(new RainbowGradient());
CueSDK.KeyboardSDK.Update();
Every brush offers a basic set of options to customize it's look.
-
BrushCalculationMode
There are two values for this: Relative (which is the default) and Absolute. They affect how the brush is render on the keyboard.
Relative will cause the whole brush to be rendered inside the smallest rectangle which contains all LEDs of the ledgroup this brush is assigned.
Absolute causes the brush to be rendered over the whole device but only colors the LEDs of by the ledgroup.
An example would be a ledgroup containing the left half of a keyboard. Applying a rainbow in Relative-mode will start with red on the left side and stop with red at the center of the keyboard. Using Absolute it will start on the left side with red too, but will stop with cyan at the center (only the left half of the rainbow is drawn). -
Brightness
This property affects the overall brightness of the brush in percent (0f-1f). -
Opacity
This property affects the overall opacity of the brush in percent (0f-1f). -
ColorCorrections
This property offers a list of Color-Corrections to modify the colors rendered by the brush.
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