The Battle for Wesnoth  1.15.2+dev
Classes | Namespaces | Macros | Functions | Variables
picture.cpp File Reference

Routines for images: load, scale, re-color, etc. More...

#include "picture.hpp"
#include "config.hpp"
#include "display.hpp"
#include "filesystem.hpp"
#include "game_config.hpp"
#include "image_modifications.hpp"
#include "log.hpp"
#include "preferences/general.hpp"
#include "serialization/base64.hpp"
#include "serialization/string_utils.hpp"
#include "sdl/rect.hpp"
#include "utils/general.hpp"
#include <SDL2/SDL_image.h>
#include "utils/functional.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/functional/hash_fwd.hpp>
#include <set>
Include dependency graph for picture.cpp:

Go to the source code of this file.


struct  cache_item< T >
struct  std::hash< image::locator::value >
class  image::cache_type< T >


 this module manages the cache of images.


#define ERR_DP   LOG_STREAM(err, log_display)
#define LOG_DP   LOG_STREAM(info, log_display)
#define ERR_CFG   LOG_STREAM(err, log_config)


void image::flush_cache ()
static void image::add_localized_overlay (const std::string &ovr_file, surface &orig_surf)
static surface image::load_image_file (const image::locator &loc)
static surface image::load_image_sub_file (const image::locator &loc)
static surface image::load_image_data_uri (const image::locator &loc)
static signed char image::col_to_uchar (int i)
light_string image::get_light_string (int op, int r, int g, int b)
 return light_string of one light operation(see above) More...
static surface image::apply_light (surface surf, const light_string &ls)
surface image::load_from_disk (const locator &loc)
void image::set_color_adjustment (int r, int g, int b)
 will make all scaled images have these rgb values added to all their pixels. More...
void image::set_team_colors (const std::vector< std::string > *colors=nullptr)
 set the team colors used by the TC image modification use a vector with one string for each team using nullptr will reset to default TC More...
const std::vector< std::string > & image::get_team_colors ()
void image::set_zoom (unsigned int zoom)
 sets the amount scaled images should be scaled. More...
static surface image::get_hexed (const locator &i_locator)
static surface image::get_scaled_to_hex (const locator &i_locator)
static surface image::get_tod_colored (const locator &i_locator)
static surface image::get_scaled_to_zoom (const locator &i_locator)
static surface image::get_brightened (const locator &i_locator)
static TYPE image::simplify_type (const image::locator &i_locator, TYPE type)
 translate type to a simpler one when possible More...
surface image::get_image (const locator &i_locator, TYPE type=UNSCALED)
 function to get the surface corresponding to an image. More...
surface image::get_lighted_image (const image::locator &i_locator, const light_string &ls, TYPE type)
 function to get the surface corresponding to an image. More...
surface image::get_hexmask ()
 function to get the standard hex mask More...
bool image::is_in_hex (const locator &i_locator)
 function to check if an image fit into an hex return false if the image has not the standard size. More...
bool image::is_empty_hex (const locator &i_locator)
 function to check if an image is empty after hex cut should be only used on terrain image (cache the hex cut version) More...
surface image::reverse_image (const surface &surf)
 function to reverse an image. More...
bool image::exists (const locator &i_locator)
 returns true if the given image actually exists, without loading it. More...
static void image::precache_file_existence_internal (const std::string &dir, const std::string &subdir)
void image::precache_file_existence (const std::string &subdir="")
 precache the existence of files in the subdir (ex: "terrain/") More...
bool image::precached_file_exists (const std::string &file)
save_result image::save_image (const locator &i_locator, const std::string &filename)
save_result image::save_image (const surface &surf, const std::string &filename)


static lg::log_domain log_display ("display")
static lg::log_domain log_config ("config")
mini_terrain_cache_map image::mini_terrain_cache
mini_terrain_cache_map image::mini_fogged_terrain_cache
mini_terrain_cache_map image::mini_highlighted_terrain_cache
static int image::last_index_ = 0

Detailed Description

Routines for images: load, scale, re-color, etc.

Definition in file picture.cpp.

Macro Definition Documentation


#define ERR_CFG   LOG_STREAM(err, log_config)

Definition at line 48 of file picture.cpp.

Referenced by image::load_image_sub_file().


#define ERR_DP   LOG_STREAM(err, log_display)


#define LOG_DP   LOG_STREAM(info, log_display)

Definition at line 45 of file picture.cpp.

Referenced by image::save_image().

Variable Documentation

◆ log_config

lg::log_domain log_config("config")

◆ log_display

lg::log_domain log_display("display")