mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Updated Brushes (markdown)
parent
97e54d006a
commit
ab8c87143b
77
Brushes.md
77
Brushes.md
@ -1,24 +1,31 @@
|
||||
The Brushes variable lets you create colors and apply them to different kinds of brushes.
|
||||
For more info on how brushes are drawn, check out [WPF LinearGradientBrush](http://www.c-sharpcorner.com/uploadfile/mahesh/wpf-radialgradientbrush/) and [WPF RadialGradientBrush](http://www.c-sharpcorner.com/uploadfile/mahesh/wpf-lineargradientbrush/) or have a look at the LUA examples.
|
||||
For more info on how brushes are drawn, check out [WPF LinearGradientBrush](http://www.c-sharpcorner.com/uploadfile/mahesh/wpf-lineargradientbrush/) and [WPF RadialGradientBrush](http://www.c-sharpcorner.com/uploadfile/mahesh/wpf-radialgradientbrush/) or have a look at the LUA examples.
|
||||
|
||||
**Note:** To actually draw the brushes, see the [Drawing](https://github.com/SpoinkyNL/Artemis/wiki/Drawing) section.
|
||||
|
||||
## Properties
|
||||
## Functions
|
||||
### GetColor
|
||||
Creates a color using the given variables.
|
||||
You may either provide a hex notation: ```#0066ff``` or an ARGB notation: ```255, 255, 0, 0```
|
||||
Creates a color using the given variables.
|
||||
#### Syntax:
|
||||
```lua
|
||||
color GetColor(string hexCode);
|
||||
color GetColor(int a, int r, int g, int b);
|
||||
```
|
||||
##### Required arguments
|
||||
- **hexCode:** A hex color notation, such as ```#0066ff```
|
||||
|
||||
##### Alternative arguments
|
||||
- **a:** A byte alpha value (0-255)
|
||||
- **r:** A byte red value (0-255)
|
||||
- **g:** A byte green value (0-255)
|
||||
- **b:** A byte blue value (0-255)
|
||||
|
||||
#### Example:
|
||||
```lua
|
||||
local blueColor = Brushes.GetColor("#0066ff");
|
||||
local redColor = Brushes.GetColor(255, 255, 0, 0);
|
||||
```
|
||||
|
||||
---
|
||||
### GetRandomColor
|
||||
Returns a psuedo-random color within the RGB spectrum.
|
||||
#### Syntax:
|
||||
@ -29,12 +36,16 @@ color GetRandomColor();
|
||||
```lua
|
||||
local randomColor = Brushes.GetRandomColor();
|
||||
```
|
||||
### GetSolidColorBrush()
|
||||
---
|
||||
### GetSolidColorBrush
|
||||
Returns a brush with one color
|
||||
#### Syntax:
|
||||
```lua
|
||||
brush GetSolidColorBrush(color brushColor);
|
||||
```
|
||||
##### Required arguments
|
||||
- **color:** The color the brush will be
|
||||
|
||||
#### Example:
|
||||
```lua
|
||||
-- Create a red color
|
||||
@ -45,8 +56,8 @@ local redBrush = Brushes.GetSolidColorBrush(redColor);
|
||||
#### Result:
|
||||
Drawing the first brush would look like this:
|
||||

|
||||
|
||||
### GetLinearGradientBrush()
|
||||
---
|
||||
### GetLinearGradientBrush
|
||||
Returns a brush with a linear gradient
|
||||
#### Syntax:
|
||||
```lua
|
||||
@ -57,10 +68,11 @@ brush GetSolidColorBrush(table gradientColors, [double startX, double startY, do
|
||||
|
||||
##### Optional arguments
|
||||
**Note:** The arguments between [brackets] are optional and you can leave them out.
|
||||
- **startX:** The X value of the start position of the gradient
|
||||
- **startY:** The Y value of the start position of the gradient
|
||||
- **endX:** The X value of the end position of the gradient
|
||||
- **endY:** The Y value of the end position of the gradient
|
||||
- **startX:** The relative X value of the start position of the gradient
|
||||
- **startY:** The relative Y value of the start position of the gradient
|
||||
- **endX:** The relative X value of the end position of the gradient
|
||||
- **endY:** The relative Y value of the end position of the gradient
|
||||
|
||||
#### Example:
|
||||
```lua
|
||||
-- Create a table and add keys to it (the color) and values (the offset).
|
||||
@ -82,4 +94,43 @@ local horizontalBrush = Brushes.GetLinearGradientBrush(colors, 0, 0.5, 1, 0.5);
|
||||
Drawing the first brush would look like this:
|
||||

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

|
||||

|
||||
---
|
||||
### GetRadialGradientBrush
|
||||
Returns a brush with a radial gradient
|
||||
#### Syntax:
|
||||
```lua
|
||||
brush GetSolidColorBrush(table gradientColors, [double centerX, double centerY, double originX, double originY]);
|
||||
```
|
||||
##### Required arguments
|
||||
- **gradientColors:** A table using colors as keys and doubles as offsets
|
||||
|
||||
##### Optional arguments
|
||||
**Note:** The arguments between [brackets] are optional and you can leave them out.
|
||||
- **centerX:** The relative X value of the center position of the gradient
|
||||
- **centerY:** The relative Y value of the center position of the gradient
|
||||
- **originX:** The relative X value of the origin position of the gradient
|
||||
- **originY:** The relative Y value of the origin position of the gradient
|
||||
|
||||
#### 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
|
||||
|
||||
-- Create the brush using the newly created color
|
||||
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);
|
||||
```
|
||||
#### Result:
|
||||
Drawing the first brush would look like this:
|
||||

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

|
||||
Loading…
x
Reference in New Issue
Block a user