From 3610908f19ce4b64bc96a385cc78b1c6d1a2fcc5 Mon Sep 17 00:00:00 2001 From: Robert Beekman Date: Sun, 1 Jan 2017 13:31:33 +0100 Subject: [PATCH] Updated Brushes (markdown) --- Brushes.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Brushes.md b/Brushes.md index 1d85f0e..7e9c03b 100644 --- a/Brushes.md +++ b/Brushes.md @@ -142,4 +142,26 @@ 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") \ No newline at end of file +![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); +```