Skip to content
This repository was archived by the owner on Aug 6, 2021. It is now read-only.

Understanding CUE.NET brushes

DarthAffe edited this page Nov 17, 2017 · 6 revisions

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:

Of course you can always implement your own brush.

Using brushes

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();

Configuring brushes

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.

Clone this wiki locally