ManaPlus
dye.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2007-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2019 The ManaPlus Developers
6  * Copyright (C) 2019-2021 Andrei Karas
7  *
8  * This file is part of The ManaPlus Client.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef RESOURCES_DYE_DYE_H
25 #define RESOURCES_DYE_DYE_H
26 
27 #include <string>
28 
29 #include "localconsts.h"
30 
31 class DyePalette;
32 
33 const int dyePalateSize = 9;
34 const int sPaleteIndex = 7;
35 const int aPaleteIndex = 8;
36 
40 class Dye final
41 {
42  public:
49  explicit Dye(const std::string &restrict dye);
50 
52 
53 
56  ~Dye();
57 
61  static void instantiate(std::string &restrict target,
62  const std::string &restrict palettes);
63 
68  { return mDyePalettes[sPaleteIndex]; }
69 
74  { return mDyePalettes[aPaleteIndex]; }
75 
80 
81  void normalDye(uint32_t *restrict pixels,
82  const int bufSize) const restrict2;
83 
84  void normalOGLDye(uint32_t *restrict pixels,
85  const int bufSize) const restrict2;
86 
87  private:
94 };
95 
96 #endif // RESOURCES_DYE_DYE_H
Definition: dye.h:41
const DyePalette * getSPalete() const
Definition: dye.h:67
Dye(const std::string &dye)
Definition: dye.cpp:43
static void instantiate(std::string &target, const std::string &palettes)
Definition: dye.cpp:97
const DyePalette * getAPalete() const
Definition: dye.h:73
void normalDye(uint32_t *pixels, const int bufSize) const
Definition: dye.cpp:158
void normalOGLDye(uint32_t *pixels, const int bufSize) const
Definition: dye.cpp:224
DyePalette * mDyePalettes[dyePalateSize]
Definition: dye.h:93
int getType() const
Definition: dye.cpp:149
~Dye()
Definition: dye.cpp:91
const int aPaleteIndex
Definition: dye.h:35
const int sPaleteIndex
Definition: dye.h:34
const int dyePalateSize
Definition: dye.h:33
#define restrict
Definition: localconsts.h:165
#define restrict2
Definition: localconsts.h:166
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define noexcept2
Definition: localconsts.h:50
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53