The Battle for Wesnoth  1.17.0-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 <SDL2/SDL_image.h>
#include <functional>
#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 >


 Functions to load and save images from/to disk.


#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 ()
 Purges all image caches. More...
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)
 Returns the light_string for one light operation. 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)
 Changes Time of Day color tint for all applicable image types. More...
void image::set_zoom (unsigned int zoom)
 Sets the scaling factor for images. 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)
 Caches and returns an image. More...
surface image::get_lighted_image (const image::locator &i_locator, const light_string &ls, TYPE type)
 Caches and returns an image with a lightmap applied to it. More...
surface image::get_hexmask ()
 Retrieves the standard hexagonal tile mask. More...
bool image::is_in_hex (const locator &i_locator)
 Checks if an image fits into a single hex. More...
bool image::is_empty_hex (const locator &i_locator)
 Checks if an image is empty after hex masking. More...
surface image::reverse_image (const surface &surf)
 Horizontally flips 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 a binary path subdirectory (e.g. 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")