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-09-12 14:16:31 +02:00
parent 3a248b86f1
commit ea5b78a015

@ -16,8 +16,8 @@ For more info on how brushes are drawn, check out [WPF LinearGradientBrush](http
Creates a color using the given variables.
#### Syntax:
```lua
color GetColor(string hexCode);
color GetColor(int a, int r, int g, int b);
color GetColor(string hexCode)
color GetColor(int a, int r, int g, int b)
```
##### Required arguments
- **hexCode:** A hex color notation, such as ```#0066ff```
@ -30,26 +30,26 @@ color GetColor(int a, int r, int g, int b);
#### Example:
```lua
local blueColor = Brushes.GetColor("#0066ff");
local redColor = Brushes.GetColor(255, 255, 0, 0);
local blueColor = Brushes.GetColor("#0066ff")
local redColor = Brushes.GetColor(255, 255, 0, 0)
```
---
### GetRandomColor
Returns a pseudo-random color within the RGB spectrum.
#### Syntax:
```lua
color GetRandomColor();
color GetRandomColor()
```
#### Example:
```lua
local randomColor = Brushes.GetRandomColor();
local randomColor = Brushes.GetRandomColor()
```
---
### GetRelativeColor
Returns the color at the given position in a gradient, relative to the gradient's start.
#### Syntax:
```lua
color GetRelativeColor(table gradientColors, double position);
color GetRelativeColor(table gradientColors, double position)
```
##### Required arguments
- **gradientColors:** A table using colors as keys and doubles as offsets
@ -58,12 +58,12 @@ color GetRelativeColor(table gradientColors, double position);
#### 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
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);
local orange = Brushes.GetRelativeColor(colors, 0.5)
```
#### Result:
@ -75,7 +75,7 @@ The function will look at the color in the middle, at 0.5 and it is orange
Returns a brush with one color
#### Syntax:
```lua
brush GetSolidColorBrush(color brushColor);
brush GetSolidColorBrush(color brushColor)
```
##### Required arguments
- **color:** The color the brush will be
@ -83,9 +83,9 @@ brush GetSolidColorBrush(color brushColor);
#### Example:
```lua
-- Create a red color
local redColor = Brushes.GetColor(255, 255, 0, 0);
local redColor = Brushes.GetColor(255, 255, 0, 0)
-- Create the brush using the newly created color
local redBrush = Brushes.GetSolidColorBrush(redColor);
local redBrush = Brushes.GetSolidColorBrush(redColor)
```
#### Result:
Drawing the first brush would look like this:
@ -96,7 +96,7 @@ Drawing the first brush would look like this:
Returns a brush with a linear gradient
#### Syntax:
```lua
brush GetLinearGradientBrush(table gradientColors, [double startX, double startY, double endX, double endY]);
brush GetLinearGradientBrush(table gradientColors, [double startX, double startY, double endX, double endY])
```
##### Required arguments
- **gradientColors:** A table using colors as keys and doubles as offsets
@ -111,19 +111,19 @@ brush GetLinearGradientBrush(table gradientColors, [double startX, double startY
#### 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, 0, 255)] = 0.16; -- purple
colors[Brushes.GetColor(255, 0, 0, 255)] = 0.33; -- blue
colors[Brushes.GetColor(255, 0, 255, 255)] = 0.5; -- cyan
colors[Brushes.GetColor(255, 0, 255, 0)] = 0.66; -- green
colors[Brushes.GetColor(255, 255, 255, 0)] = 0.83; -- yellow
colors[Brushes.GetColor(255, 255, 0, 0)] = 1; -- red
local colors = {}
colors[Brushes.GetColor(255, 255, 0, 0)] = 0 -- red
colors[Brushes.GetColor(255, 255, 0, 255)] = 0.16 -- purple
colors[Brushes.GetColor(255, 0, 0, 255)] = 0.33 -- blue
colors[Brushes.GetColor(255, 0, 255, 255)] = 0.5 -- cyan
colors[Brushes.GetColor(255, 0, 255, 0)] = 0.66 -- green
colors[Brushes.GetColor(255, 255, 255, 0)] = 0.83 -- yellow
colors[Brushes.GetColor(255, 255, 0, 0)] = 1 -- red
-- Create the brush using the newly created color
local rainbowBrush = Brushes.GetLinearGradientBrush(colors);
local rainbowBrush = Brushes.GetLinearGradientBrush(colors)
-- Create another brush using the optional arguments
local horizontalBrush = Brushes.GetLinearGradientBrush(colors, 0, 0.5, 1, 0.5);
local horizontalBrush = Brushes.GetLinearGradientBrush(colors, 0, 0.5, 1, 0.5)
```
#### Result:
Drawing the first brush would look like this:
@ -136,7 +136,7 @@ Drawing the second brush would look like this:
Returns a brush with a radial gradient
#### Syntax:
```lua
brush GetRadialGradientBrush(table gradientColors, [double centerX, double centerY, double originX, double originY]);
brush GetRadialGradientBrush(table gradientColors, [double centerX, double centerY, double originX, double originY])
```
##### Required arguments
- **gradientColors:** A table using colors as keys and doubles as offsets
@ -151,19 +151,19 @@ brush GetRadialGradientBrush(table gradientColors, [double centerX, double cente
#### 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, 0, 255)] = 0.16; -- purple
colors[Brushes.GetColor(255, 0, 0, 255)] = 0.33; -- blue
colors[Brushes.GetColor(255, 0, 255, 255)] = 0.5; -- cyan
colors[Brushes.GetColor(255, 0, 255, 0)] = 0.66; -- green
colors[Brushes.GetColor(255, 255, 255, 0)] = 0.83; -- yellow
colors[Brushes.GetColor(255, 255, 0, 0)] = 1; -- red
local colors = {}
colors[Brushes.GetColor(255, 255, 0, 0)] = 0 -- red
colors[Brushes.GetColor(255, 255, 0, 255)] = 0.16 -- purple
colors[Brushes.GetColor(255, 0, 0, 255)] = 0.33 -- blue
colors[Brushes.GetColor(255, 0, 255, 255)] = 0.5 -- cyan
colors[Brushes.GetColor(255, 0, 255, 0)] = 0.66 -- green
colors[Brushes.GetColor(255, 255, 255, 0)] = 0.83 -- yellow
colors[Brushes.GetColor(255, 255, 0, 0)] = 1 -- red
-- Create the brush using the newly created color
local circle = Brushes.GetRadialGradientBrush(colors);
local circle = Brushes.GetRadialGradientBrush(colors)
-- Create another brush putting the origin in the top left (0,0) resulting in a spotlight
local spotlight = Brushes.GetRadialGradientBrush(colors, 0.5, 0.5, 0, 0);
local spotlight = Brushes.GetRadialGradientBrush(colors, 0.5, 0.5, 0, 0)
```
#### Result:
Drawing the first brush would look like this: