summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/rltiles/tool/tile_colour.h
diff options
context:
space:
mode:
authorEnne Walker <ennewalker@users.sourceforge.net>2009-12-23 23:32:52 -0500
committerEnne Walker <ennewalker@users.sourceforge.net>2009-12-24 00:15:48 -0500
commitbcc249f77c1459b75b7a4f96b018a15569e675b3 (patch)
tree72ad82e9ff51f45396c95933e3583437ab5489fb /crawl-ref/source/rltiles/tool/tile_colour.h
parent5b9916a319a570598c8cd54e916eb10dab0eb916 (diff)
downloadcrawl-ref-bcc249f77c1459b75b7a4f96b018a15569e675b3.tar.gz
crawl-ref-bcc249f77c1459b75b7a4f96b018a15569e675b3.zip
Basic support for tile recolouring.
Added %variation, %repeat, %desat, %lum, %hue, %pal, %resetcol commands to rltiles. Also, multiple enum synonyms can now be specified. Documentation on all rltiles commands is forthcoming. Sorry. Added coloured variations for a number of floor and wall tiles, removing duplicate source art where it made sense. The variations probably need some adjusting to look less like fruit salad. COLOUR in a vault specification will now automatically try to pick coloured variations of basic floor and rock wall tiles by default. It will also pick coloured variations of any tiles specified by FTILE/RTILE/TILE. I'll leave it as an exercise for due to generalize this to features and monsters. tile_dngn_coloured (and corresponding functions for other tile sheets) can be used to look up coloured variations for a given tile index.
Diffstat (limited to 'crawl-ref/source/rltiles/tool/tile_colour.h')
-rw-r--r--crawl-ref/source/rltiles/tool/tile_colour.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/crawl-ref/source/rltiles/tool/tile_colour.h b/crawl-ref/source/rltiles/tool/tile_colour.h
index 4c77162b9f..f660c84829 100644
--- a/crawl-ref/source/rltiles/tool/tile_colour.h
+++ b/crawl-ref/source/rltiles/tool/tile_colour.h
@@ -1,6 +1,30 @@
#ifndef TILE_COLOUR_H
#define TILE_COLOUR_H
+enum COLORS
+{
+ BLACK,
+ BLUE,
+ GREEN,
+ CYAN,
+ RED,
+ MAGENTA,
+ BROWN,
+ LIGHTGRAY,
+ LIGHTGREY = LIGHTGRAY,
+ DARKGRAY,
+ DARKGREY = DARKGRAY,
+ LIGHTBLUE,
+ LIGHTGREEN,
+ LIGHTCYAN,
+ LIGHTRED,
+ LIGHTMAGENTA,
+ YELLOW,
+ WHITE,
+ MAX_TERM_COLOUR,
+ MAX_COLOUR = MAX_TERM_COLOUR
+};
+
class tile_colour
{
public:
@@ -12,6 +36,31 @@ public:
bool operator!=(const tile_colour &rhs) const;
const tile_colour &operator=(const tile_colour &rhs);
+ unsigned char &operator[](int idx);
+ unsigned char operator[](int idx) const;
+
+ // Get the HSV/HSL hue, from 0..360.
+ int get_hue() const;
+ // Set the hue, from 0..360.
+ void set_hue(int h);
+ // Change the saturation to 0.
+ void desaturate();
+ // Change the luminance by lum_percent %.
+ void change_lum(int lum_percent);
+
+ int get_max_rgb() const;
+ int get_min_rgb() const;
+
+ // Set the color from HSV. hue is 0..360. min_rgb and max_rgb are 0..255.
+ void set_from_hue(int hue, int min_rgb, int max_rgb);
+
+ // Set the color from HSL. hue is 0..360. sat and lum are 0..1.
+ void set_from_hsl(int hue, float sat, float lum);
+ // Get the HSL saturation, from 0..1.
+ float get_sat() const;
+ // Get the HSL luminance, from 0..1.
+ float get_lum() const;
+
unsigned char r;
unsigned char g;
unsigned char b;