mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2025-12-13 09:08:34 +00:00
Added some content
parent
ec111e5165
commit
1cf2a3a0f0
@ -1 +1,20 @@
|
||||
TODO
|
||||
Implementing an own brush is quite easy.
|
||||
All you need to do is implementing the _IBrush_-interface which looks like this:
|
||||
```C#
|
||||
public interface IBrush
|
||||
{
|
||||
float Brightness { get; set; }
|
||||
float Opacity { get; set; }
|
||||
Color GetColorAtPoint(RectangleF rectangle, PointF point);
|
||||
}
|
||||
```
|
||||
|
||||
> **Since the _Brightness_ and _Opacity_ is something generic you should always derive from the [_AbstractBrush_-](https://github.com/DarthAffe/CUE.NET/blob/master/Brushes/AbstractBrush.cs)Class.**
|
||||
> If you do this, you'll only have to implement the _GetColorAtPoint_-method.
|
||||
|
||||
In the _GetColorAtPoint_-method you'll have to calculate and return the color of one specific point (representing a key) inside a rectangle (representing the keyboard or keygroup). Both, the point and the rectangle are given as parameters.
|
||||
|
||||
> Before you return your calculated Color you should always call the _FinalizeColor_-method to apply the overall brightness and opacity.
|
||||
> If you don't derive from the _AbstractBrush_-Class you'll have to to take care about this by yourself.
|
||||
|
||||
If you need a reference on how the implementation might look, you can take the [_LinearGradientBrush_](https://github.com/DarthAffe/CUE.NET/blob/master/Brushes/LinearGradientBrush.cs), the [_RadialGradientBrush_](https://github.com/DarthAffe/CUE.NET/blob/master/Brushes/RadialGradientBrush.cs) or the [_SolidColorBrush_](https://github.com/DarthAffe/CUE.NET/blob/master/Brushes/SolidColorBrush.cs).
|
||||
Loading…
x
Reference in New Issue
Block a user