1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2026-01-01 18:23:32 +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. Creates a color using the given variables.
#### Syntax: #### Syntax:
```lua ```lua
color GetColor(string hexCode); color GetColor(string hexCode)
color GetColor(int a, int r, int g, int b); color GetColor(int a, int r, int g, int b)
``` ```
##### Required arguments ##### Required arguments
- **hexCode:** A hex color notation, such as ```#0066ff``` - **hexCode:** A hex color notation, such as ```#0066ff```
@ -30,26 +30,26 @@ color GetColor(int a, int r, int g, int b);
#### Example: #### Example:
```lua ```lua
local blueColor = Brushes.GetColor("#0066ff"); local blueColor = Brushes.GetColor("#0066ff")
local redColor = Brushes.GetColor(255, 255, 0, 0); local redColor = Brushes.GetColor(255, 255, 0, 0)
``` ```
--- ---
### GetRandomColor ### GetRandomColor
Returns a pseudo-random color within the RGB spectrum. Returns a pseudo-random color within the RGB spectrum.
#### Syntax: #### Syntax:
```lua ```lua
color GetRandomColor(); color GetRandomColor()
``` ```
#### Example: #### Example:
```lua ```lua
local randomColor = Brushes.GetRandomColor(); local randomColor = Brushes.GetRandomColor()
``` ```
--- ---
### GetRelativeColor ### GetRelativeColor
Returns the color at the given position in a gradient, relative to the gradient's start. Returns the color at the given position in a gradient, relative to the gradient's start.
#### Syntax: #### Syntax:
```lua ```lua
color GetRelativeColor(table gradientColors, double position); color GetRelativeColor(table gradientColors, double position)
``` ```
##### Required arguments ##### Required arguments
- **gradientColors:** A table using colors as keys and doubles as offsets - **gradientColors:** A table using colors as keys and doubles as offsets
@ -58,12 +58,12 @@ color GetRelativeColor(table gradientColors, double position);
#### Example: #### Example:
```lua ```lua
-- Create a table and add keys to it (the color) and values (the offset). -- Create a table and add keys to it (the color) and values (the offset).
local colors = {}; local colors = {}
colors[Brushes.GetColor(255, 255, 0, 0)] = 0; -- red colors[Brushes.GetColor(255, 255, 0, 0)] = 0 -- red
colors[Brushes.GetColor(255, 255, 255, 0)] = 1; -- yellow colors[Brushes.GetColor(255, 255, 255, 0)] = 1 -- yellow
-- Get the color that is in the middle of the gradient, between red and 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: #### 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 Returns a brush with one color
#### Syntax: #### Syntax:
```lua ```lua
brush GetSolidColorBrush(color brushColor); brush GetSolidColorBrush(color brushColor)
``` ```
##### Required arguments ##### Required arguments
- **color:** The color the brush will be - **color:** The color the brush will be
@ -83,9 +83,9 @@ brush GetSolidColorBrush(color brushColor);
#### Example: #### Example:
```lua ```lua
-- Create a red color -- 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 -- Create the brush using the newly created color
local redBrush = Brushes.GetSolidColorBrush(redColor); local redBrush = Brushes.GetSolidColorBrush(redColor)
``` ```
#### Result: #### Result:
Drawing the first brush would look like this: 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 Returns a brush with a linear gradient
#### Syntax: #### Syntax:
```lua ```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 ##### Required arguments
- **gradientColors:** A table using colors as keys and doubles as offsets - **gradientColors:** A table using colors as keys and doubles as offsets
@ -111,19 +111,19 @@ brush GetLinearGradientBrush(table gradientColors, [double startX, double startY
#### Example: #### Example:
```lua ```lua
-- Create a table and add keys to it (the color) and values (the offset). -- Create a table and add keys to it (the color) and values (the offset).
local colors = {}; local colors = {}
colors[Brushes.GetColor(255, 255, 0, 0)] = 0; -- red colors[Brushes.GetColor(255, 255, 0, 0)] = 0 -- red
colors[Brushes.GetColor(255, 255, 0, 255)] = 0.16; -- purple 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, 0, 255)] = 0.33 -- blue
colors[Brushes.GetColor(255, 0, 255, 255)] = 0.5; -- cyan colors[Brushes.GetColor(255, 0, 255, 255)] = 0.5 -- cyan
colors[Brushes.GetColor(255, 0, 255, 0)] = 0.66; -- green 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, 255, 0)] = 0.83 -- yellow
colors[Brushes.GetColor(255, 255, 0, 0)] = 1; -- red colors[Brushes.GetColor(255, 255, 0, 0)] = 1 -- red
-- Create the brush using the newly created color -- 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 -- 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: #### Result:
Drawing the first brush would look like this: 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 Returns a brush with a radial gradient
#### Syntax: #### Syntax:
```lua ```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 ##### Required arguments
- **gradientColors:** A table using colors as keys and doubles as offsets - **gradientColors:** A table using colors as keys and doubles as offsets
@ -151,19 +151,19 @@ brush GetRadialGradientBrush(table gradientColors, [double centerX, double cente
#### Example: #### Example:
```lua ```lua
-- Create a table and add keys to it (the color) and values (the offset). -- Create a table and add keys to it (the color) and values (the offset).
local colors = {}; local colors = {}
colors[Brushes.GetColor(255, 255, 0, 0)] = 0; -- red colors[Brushes.GetColor(255, 255, 0, 0)] = 0 -- red
colors[Brushes.GetColor(255, 255, 0, 255)] = 0.16; -- purple 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, 0, 255)] = 0.33 -- blue
colors[Brushes.GetColor(255, 0, 255, 255)] = 0.5; -- cyan colors[Brushes.GetColor(255, 0, 255, 255)] = 0.5 -- cyan
colors[Brushes.GetColor(255, 0, 255, 0)] = 0.66; -- green 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, 255, 0)] = 0.83 -- yellow
colors[Brushes.GetColor(255, 255, 0, 0)] = 1; -- red colors[Brushes.GetColor(255, 255, 0, 0)] = 1 -- red
-- Create the brush using the newly created color -- 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 -- 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: #### Result:
Drawing the first brush would look like this: Drawing the first brush would look like this: