The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Functions
color_range.hpp File Reference
#include "global.hpp"
#include <map>
#include <string>
#include <vector>
#include <SDL_types.h>
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...
 

Functions

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. More...
 
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. More...
 
std::string rgb2highlight (Uint32 rgb)
 Converts a color value to WML text markup syntax for highlighting. More...
 
std::string rgb2highlight_pango (Uint32 rgb)
 Converts a color value to WML text markup syntax for highlighting. More...
 

Function Documentation

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

Creates a reference color palette from a color range.

Definition at line 130 of file color_range.cpp.

References c, i, and recolor_range().

Referenced by game_config::add_color_info().

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_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 30 of file color_range.cpp.

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

Referenced by BOOST_AUTO_TEST_CASE(), and palette().

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 158 of file color_range.cpp.

References h.

Referenced by mp::get_color_string(), and team::get_side_highlight().

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 168 of file color_range.cpp.

References h.

Referenced by team::get_side_highlight_pango().

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