diff --git a/Understanding-CUE.NET-brushes.md b/Understanding-CUE.NET-brushes.md index 5426f45..921c3a4 100644 --- a/Understanding-CUE.NET-brushes.md +++ b/Understanding-CUE.NET-brushes.md @@ -1,25 +1,51 @@ -In CUE.NET a brush is used to apply colors to a _KeyGroup_. -Usually the calculation of the color for a specific key is based on a [gradient](https://github.com/DarthAffe/CUE.NET/wiki/Understanding-CUE.NET-gradients) but there is no need to for this. +In CUE.NET a brush is used to apply colors to a [ledgroup](https://github.com/DarthAffe/CUE.NET/wiki/Understanding-CUE.NET-ledgroups). +Usually the calculation of the color for a specific key is based on a [gradient](https://github.com/DarthAffe/CUE.NET/wiki/Understanding-CUE.NET-gradients) 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 keys. +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 the default four gradients: +CUE.NET provides by default five (+1 deprecated) brushes: * [Solid-Color-Brush](https://github.com/DarthAffe/CUE.NET/wiki/Solid-Color-Brush) * [Linear-Gradient-Brush](https://github.com/DarthAffe/CUE.NET/wiki/Linear-Gradient-Brush) * [Radial-Gradient-Brush](https://github.com/DarthAffe/CUE.NET/wiki/Radial-Gradient-Brush) * [Random-Color-Brush](https://github.com/DarthAffe/CUE.NET/wiki/Random-Color-Brush) +* [Image-Brush](https://github.com/DarthAffe/CUE.NET/wiki/Image-Brush) +* Profile-Brush (deprecated - only works with CUE 1) Of course you can always implement [your own brush](https://github.com/DarthAffe/CUE.NET/wiki/Implementing-an-own-brush). ### Using brushes -Currently there are two ways of 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. -* Directly apply the brush to any _KeyGroup_ you like (including the keyboard itself). This can be done simply by setting the _Brush_-Property. ```C# IBrush brush = new SolidColorBrush(Color.White); -keygroup.Brush = brush; +myLedGroup.Brush = brush; ``` -* As part of an [effect](https://github.com/DarthAffe/CUE.NET/wiki/Understanding-CUE.NET-effects). \ No newline at end of file +> 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: +> ```C# +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](https://github.com/DarthAffe/CUE.NET/wiki/Color-Corrections) to modify the colors rendered by the brush. + \ No newline at end of file