mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-01-01 02:03:32 +00:00
Updated Brushes (markdown)
parent
6af169f9aa
commit
655ca96941
50
Brushes.md
50
Brushes.md
@ -6,10 +6,10 @@ For more info on how brushes are drawn, check out [WPF LinearGradientBrush](http
|
|||||||
## Overview
|
## Overview
|
||||||
* [GetColor](https://github.com/SpoinkyNL/Artemis/wiki/brushes#getcolor)
|
* [GetColor](https://github.com/SpoinkyNL/Artemis/wiki/brushes#getcolor)
|
||||||
* [GetRandomColor](https://github.com/SpoinkyNL/Artemis/wiki/brushes#getrandomcolor)
|
* [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)
|
* [GetSolidColorBrush](https://github.com/SpoinkyNL/Artemis/wiki/brushes#getsolidcolorbrush)
|
||||||
* [GetLinearGradientBrush](https://github.com/SpoinkyNL/Artemis/wiki/brushes#getlineargradientbrush)
|
* [GetLinearGradientBrush](https://github.com/SpoinkyNL/Artemis/wiki/brushes#getlineargradientbrush)
|
||||||
* [GetRadialGradientBrush](https://github.com/SpoinkyNL/Artemis/wiki/brushes#getradialgradientbrush)
|
* [GetRadialGradientBrush](https://github.com/SpoinkyNL/Artemis/wiki/brushes#getradialgradientbrush)
|
||||||
* [GetRelativeColor](https://github.com/SpoinkyNL/Artemis/wiki/Brushes#getrelativecolor)
|
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
### GetColor
|
### GetColor
|
||||||
@ -44,6 +44,32 @@ color GetRandomColor();
|
|||||||
```lua
|
```lua
|
||||||
local randomColor = Brushes.GetRandomColor();
|
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
|
||||||
|

|
||||||
|
|
||||||
---
|
---
|
||||||
### GetSolidColorBrush
|
### GetSolidColorBrush
|
||||||
Returns a brush with one color
|
Returns a brush with one color
|
||||||
@ -144,25 +170,3 @@ Drawing the first brush would look like this:
|
|||||||

|

|
||||||
Drawing the second brush would look like this:
|
Drawing the second brush would look like this:
|
||||||

|

|
||||||
|
|
||||||
---
|
|
||||||
### 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);
|
|
||||||
```
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user