Mana
Loading...
Searching...
No Matches
dye.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2007-2009 The Mana World Development Team
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana Client.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include <string>
25#include <vector>
26
31{
32 public:
38 DyePalette(const std::string &description);
39
44 void getColor(int intensity, int color[3]) const;
45
49 void getColor(double intensity, int color[3]) const;
50
51 private:
52 struct Color
53 {
54 unsigned char r;
55 unsigned char g;
56 unsigned char b;
57 };
58
59 std::vector<Color> mColors;
60};
61
65class Dye
66{
67 public:
74 Dye(const std::string &dye);
75
79 ~Dye();
80
84 void update(int color[3]) const;
85
89 static void instantiate(std::string &target,
90 const std::string &palettes);
91
92 private:
93
100};
Class for performing a linear interpolation between colors.
Definition dye.h:31
void getColor(int intensity, int color[3]) const
Gets a pixel color depending on its intensity.
Definition dye.cpp:88
std::vector< Color > mColors
Definition dye.h:59
Class for dispatching pixel-recoloring amongst several palettes.
Definition dye.h:66
void update(int color[3]) const
Modifies a pixel color.
Definition dye.cpp:230
static void instantiate(std::string &target, const std::string &palettes)
Fills the blank in a dye placeholder with some palette names.
Definition dye.cpp:252
DyePalette * mDyePalettes[7]
The order of the palettes, as well as their uppercase letter, is:
Definition dye.h:99
~Dye()
Destroys the associated palettes.
Definition dye.cpp:224
unsigned char g
Definition dye.h:55
unsigned char b
Definition dye.h:56
unsigned char r
Definition dye.h:54