diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-07-16 18:18:22 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-07-16 18:18:22 +0300 |
commit | 07e401fb2335d2372a93f37317f144449f7e872b (patch) | |
tree | be531ab11e3f57705d1167f1f8d693906208b87a /src/resources/dye.h | |
parent | 7cd117790755de302be9f750b95b5bd18a5636bd (diff) | |
download | manaverse-07e401fb2335d2372a93f37317f144449f7e872b.tar.gz manaverse-07e401fb2335d2372a93f37317f144449f7e872b.tar.bz2 manaverse-07e401fb2335d2372a93f37317f144449f7e872b.tar.xz manaverse-07e401fb2335d2372a93f37317f144449f7e872b.zip |
Add new dye type A.
Same as type S for colors + alpha channel.
Example:
equipment/feet/boots.png|A:#3c3c3cff,40332d40,4d4d4dff,5e4a3d40
here colors in format RRGGBBAA.
Diffstat (limited to 'src/resources/dye.h')
-rw-r--r-- | src/resources/dye.h | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/src/resources/dye.h b/src/resources/dye.h index 7fe4869ef..7e5ba6c99 100644 --- a/src/resources/dye.h +++ b/src/resources/dye.h @@ -28,7 +28,9 @@ #include <SDL_stdinc.h> -const int dyePalateSize = 8; +const int dyePalateSize = 9; +const int sPaleteIndex = 7; +const int aPaleteIndex = 8; /** * Class for performing a linear interpolation between colors. @@ -42,13 +44,7 @@ class DyePalette * The string is either a file name or a sequence of hexadecimal RGB * values separated by ',' and starting with '#'. */ - DyePalette(const std::string &pallete); - -/* - void addFirstColor(const int color[3]); - - void addLastColor(const int color[3]); -*/ + DyePalette(const std::string &pallete, int8_t blockSize); /** * Gets a pixel color depending on its intensity. First color is @@ -61,15 +57,31 @@ class DyePalette */ void getColor(double intensity, int color[3]) const; - void replaceColor(uint8_t *color) const; + /** + * replace colors for SDL for S dye. + */ + void replaceSColor(uint8_t *color) const; + + /** + * replace colors for SDL for S dye. + */ + void replaceAColor(uint8_t *color) const; + + /** + * replace colors for OpenGL for S dye. + */ + void replaceSOGLColor(uint8_t *color) const; - void replaceOGLColor(uint8_t *color) const; + /** + * replace colors for OpenGL for A dye. + */ + void replaceAOGLColor(uint8_t *color) const; int hexDecode(char c); private: struct Color - { unsigned char value[3]; }; + { unsigned char value[4]; }; std::vector<Color> mColors; }; @@ -106,16 +118,21 @@ class Dye const std::string &palettes); /** - * Check if dye is special dye (S) + * Return special dye palete (S) + */ + DyePalette *getSPalete() const + { return mDyePalettes[sPaleteIndex]; } + + /** + * Return special dye palete (A) */ - bool isSpecialDye() const - { return mDyePalettes[dyePalateSize - 1]; } + DyePalette *getAPalete() const + { return mDyePalettes[aPaleteIndex]; } /** - * Return special dye palete (S) + * Return dye type for S - 1, for A - 2, 0 for other */ - DyePalette *getSPalete() const - { return mDyePalettes[dyePalateSize - 1]; } + int getType() const; private: |