1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Updated Brushes (markdown)

Robert Beekman 2017-01-01 13:36:32 +01:00
parent 6af169f9aa
commit 655ca96941

@ -6,10 +6,10 @@ For more info on how brushes are drawn, check out [WPF LinearGradientBrush](http
## Overview
* [GetColor](https://github.com/SpoinkyNL/Artemis/wiki/brushes#getcolor)
* [GetRandomColor](https://github.com/SpoinkyNL/Artemis/wiki/brushes#getrandomcolor)
* [GetRelativeColor](https://github.com/SpoinkyNL/Artemis/wiki/Brushes#getrelativecolor)
* [GetSolidColorBrush](https://github.com/SpoinkyNL/Artemis/wiki/brushes#getsolidcolorbrush)
* [GetLinearGradientBrush](https://github.com/SpoinkyNL/Artemis/wiki/brushes#getlineargradientbrush)
* [GetRadialGradientBrush](https://github.com/SpoinkyNL/Artemis/wiki/brushes#getradialgradientbrush)
* [GetRelativeColor](https://github.com/SpoinkyNL/Artemis/wiki/Brushes#getrelativecolor)
## Functions
### GetColor
@ -44,6 +44,32 @@ color GetRandomColor();
```lua
local randomColor = Brushes.GetRandomColor();
```
---
### GetRelativeColor
Returns the color at the given position in a gradient.
#### Syntax:
```lua
color GetRelativeColor(table gradientColors, double position);
```
##### Required arguments
- **gradientColors:** A table using colors as keys and doubles as offsets
- **position:** A position between 0 and 1.
#### Example:
```lua
-- Create a table and add keys to it (the color) and values (the offset).
local colors = {};
colors[Brushes.GetColor(255, 255, 0, 0)] = 0; -- red
colors[Brushes.GetColor(255, 255, 255, 0)] = 1; -- yellow
-- Get the color that is in the middle of the gradient, between red and yellow
local orange = Brushes.GetRelativeColor(colors, 0.5);
```
#### Result:
The function will look at the color in the middle, at 0.5 and it is orange
![Imgur](http://i.imgur.com/GbDIAQb.png)
---
### GetSolidColorBrush
Returns a brush with one color
@ -143,26 +169,4 @@ local spotlight = Brushes.GetRadialGradientBrush(colors, 0.5, 0.5, 0, 0);
Drawing the first brush would look like this:
![RadialGradientBrush](http://i.imgur.com/GXkooQt.png "RadialGradientBrush")
Drawing the second brush would look like this:
![RadialGradientBrush](http://i.imgur.com/PpMjgnq.png "RadialGradientBrush")
---
### GetRelativeColor
Returns the color at the given position in a gradient.
#### Syntax:
```lua
color GetRelativeColor(table gradientColors, double position);
```
##### Required arguments
- **gradientColors:** A table using colors as keys and doubles as offsets
- **position:** A position between 0 and 1.
#### Example:
```lua
-- Create a table and add keys to it (the color) and values (the offset).
local colors = {};
colors[Brushes.GetColor(255, 255, 0, 0)] = 0; -- red
colors[Brushes.GetColor(255, 255, 255, 0)] = 1; -- yellow
-- Get the color that is in the middle of the gradient, between red and yellow
local orange = Brushes.GetRelativeColor(colors, 0.5);
```
![RadialGradientBrush](http://i.imgur.com/PpMjgnq.png "RadialGradientBrush")