The Battle for Wesnoth  1.19.19+dev
Classes | Typedefs | Functions
color_range.hpp File Reference
#include "color.hpp"
#include <string>
#include <unordered_map>
#include <vector>
Include dependency graph for color_range.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  color_range
 A color range definition is made of four reference RGB colors, used for calculating conversions from a source/key palette. More...
 

Typedefs

using color_mapping = std::unordered_map< color_t, color_t >
 

Functions

std::vector< color_tgenerate_reference_palette (const color_range &cr)
 Creates a reference color palette from a color range. More...
 
color_mapping generate_color_mapping (const color_range &new_rgb, const std::vector< color_t > &old_rgb)
 Converts a source palette using the specified color_range object. More...
 

Typedef Documentation

◆ color_mapping

using color_mapping = std::unordered_map<color_t, color_t>

Definition at line 24 of file color_range.hpp.

Function Documentation

◆ generate_color_mapping()

color_mapping generate_color_mapping ( const color_range new_rgb,
const std::vector< color_t > &  old_rgb 
)

Converts a source palette using the specified color_range object.

This holds the main interface for range-based team coloring. The output is used with the recolor_image() method to do the actual recoloring.

Parameters
new_rgbSpecifies parameters for the conversion.
old_rgbSource palette.
Returns
A STL map of colors, with the keys being source palette elements, and the values are the result of applying the color range conversion on it.

Definition at line 91 of file color_range.cpp.

References i.

Referenced by BOOST_AUTO_TEST_CASE().

◆ generate_reference_palette()

std::vector<color_t> generate_reference_palette ( const color_range cr)

Creates a reference color palette from a color range.

Definition at line 104 of file color_range.cpp.

Referenced by game_config::add_color_info().