Porytiles
Loading...
Searching...
No Matches
color_set_builder.cpp
Go to the documentation of this file.
2
3#include <map>
4
8
9namespace porytiles2 {
10
11// ColorSet
12// ColorSetBuilder::build(const NormalizedPal<Rgba32> &pal, const std::map<Rgba32, unsigned int> &color_index_map) const
13// {
14// /*
15// * Set a ColorSet based on a given palette. Each bit in the ColorSet represents if the color at the given index
16// in
17// * the supplied color map was present in the palette. E.g., suppose the color map has 12 unique colors. The
18// supplied
19// * palette has two colors in it, which correspond to index 2 and index 11. The ColorSet bitset would be:
20// * 0010 0000 0001
21// */
22// ColorSet color_set{};
23// for (const auto &color : pal.colors()) {
24// if (!color_index_map.contains(color)) {
25// panic(format_->format("color_index_map did not contain requested color: {}", FormatParam{color}));
26// }
27// color_set.set(color_index_map.at(color));
28// }
29// return color_set;
30// }
31
32} // namespace porytiles2