The Battle for Wesnoth  1.15.1+dev
Functions
color_range.cpp File Reference

Generate ranges of colors, and color palettes. More...

#include "color_range.hpp"
#include "map/map.hpp"
#include <iomanip>
#include <unordered_set>
Include dependency graph for color_range.cpp:

Go to the source code of this file.

Functions

color_range_map recolor_range (const color_range &new_range, const std::vector< color_t > &old_rgb)
 Converts a source palette using the specified color_range object. More...
 
std::vector< color_tpalette (const color_range &cr)
 Creates a reference color palette from a color range. More...
 

Detailed Description

Generate ranges of colors, and color palettes.

Used e.g. to color HP, XP.

Definition in file color_range.cpp.

Function Documentation

◆ palette()

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

Creates a reference color palette from a color range.

Definition at line 83 of file color_range.cpp.

References i, and recolor_range().

Referenced by game_config::add_color_info().

◆ recolor_range()

color_range_map recolor_range ( 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 28 of file color_range.cpp.

References color_t::b, color_t::g, color_range::max(), color_range::mid(), color_range::min(), and color_t::r.

Referenced by BOOST_AUTO_TEST_CASE(), and palette().