diff options
Diffstat (limited to 'tools/sprite_dumper/common.h')
| -rw-r--r-- | tools/sprite_dumper/common.h | 21 |
1 files changed, 21 insertions, 0 deletions
| diff --git a/tools/sprite_dumper/common.h b/tools/sprite_dumper/common.h index dca5de9..2aca4fa 100644 --- a/tools/sprite_dumper/common.h +++ b/tools/sprite_dumper/common.h | |||
| @@ -136,4 +136,25 @@ private: | |||
| 136 | std::vector<char> data_; | 136 | std::vector<char> data_; |
| 137 | }; | 137 | }; |
| 138 | 138 | ||
| 139 | class Palette { | ||
| 140 | public: | ||
| 141 | |||
| 142 | Palette() = default; | ||
| 143 | |||
| 144 | Palette(BufferView m3, const int addr) { | ||
| 145 | for (int i=0; i<16; i++) { | ||
| 146 | unsigned short ch = m3.ReadTwoBytes(addr + (i << 1)); | ||
| 147 | int r = (ch & 0x1F); | ||
| 148 | int g = ((ch >> 5) & 0x1F); | ||
| 149 | int b = ((ch >> 10) & 0x1F); | ||
| 150 | colors_.push_back(Magick::ColorRGB((r << 3)/256.0, (g << 3)/256.0, (b << 3)/256.0)); | ||
| 151 | } | ||
| 152 | } | ||
| 153 | |||
| 154 | const std::vector<Magick::Color>& Colors() const { return colors_; } | ||
| 155 | |||
| 156 | private: | ||
| 157 | std::vector<Magick::Color> colors_; | ||
| 158 | }; | ||
| 159 | |||
| 139 | #endif /* end of include guard: COMMON_H_04DD2B2A */ | 160 | #endif /* end of include guard: COMMON_H_04DD2B2A */ |
