Пример #1
0
color map_palette(const color& c, int palette)
{
    if(palette < 0 || palette >= palettes.size() || palettes[palette].mapping.empty()) {
        return c;
    }

    const std::map<uint32_t,uint32_t>& mapping = palettes[palette].mapping;
    std::map<uint32_t,uint32_t>::const_iterator i = mapping.find(c.value());
    if(i != mapping.end()) {
        return color(color::convert_pixel_byte_order(i->second));
    } else {
        return c;
    }
}
Пример #2
0
std::size_t color_hasher::hash(const color&v) {
    std::size_t seed(0);

    combine(seed, v.value());
    return seed;
}