Functions

color_range.cpp File Reference

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

#include "color_range.hpp"
#include "game_config.hpp"
#include "map.hpp"
#include "serialization/string_utils.hpp"
#include "util.hpp"
#include <iomanip>
Include dependency graph for color_range.cpp:

Go to the source code of this file.

Functions

std::map< Uint32, Uint32 > recolor_range (const color_range &new_range, const std::vector< Uint32 > &old_rgb)
 Converts a source palette using the specified color_range object.
bool string2rgb (const std::string &s, std::vector< Uint32 > &result)
std::vector< Uint32 > palette (color_range cr)
 Creates a reference color palette from a color range.
std::string rgb2highlight (Uint32 rgb)
 Converts a color value to WML text markup syntax for highlighting.
std::string rgb2highlight_pango (Uint32 rgb)
 Converts a color value to WML text markup syntax for highlighting.

Detailed Description

Generate ranges of colors, and color palettes.

Used e.g. to color HP, XP.

Definition in file color_range.cpp.


Function Documentation

std::vector<Uint32> palette ( color_range  cr  ) 

Creates a reference color palette from a color range.

Definition at line 131 of file color_range.cpp.

References recolor_range().

Here is the call graph for this function:

std::map<Uint32, Uint32> recolor_range ( const color_range new_rgb,
const std::vector< Uint32 > &  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_rgb Specifies parameters for the conversion.
old_rgb Source 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 31 of file color_range.cpp.

References color_range::max(), color_range::mid(), and color_range::min().

Referenced by BOOST_AUTO_TEST_CASE(), and palette().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string rgb2highlight ( Uint32  rgb  ) 

Converts a color value to WML text markup syntax for highlighting.

For example, 0x00CC00CC becomes "<204,0,204>".

Definition at line 159 of file color_range.cpp.

References h.

Referenced by team::get_side_highlight().

Here is the caller graph for this function:

std::string rgb2highlight_pango ( Uint32  rgb  ) 

Converts a color value to WML text markup syntax for highlighting.

For example, 0x00CC00CC becomes "#CC00CC".

Definition at line 169 of file color_range.cpp.

References h.

Referenced by team::get_side_highlight_pango().

Here is the caller graph for this function:

bool string2rgb ( const std::string &  s,
std::vector< Uint32 > &  result 
)

Definition at line 92 of file color_range.cpp.

References lexical_cast(), and utils::split().

Referenced by team::team_info::read(), and terrain_label::read().

Here is the call graph for this function:

Here is the caller graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:03:42 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs