The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Namespaces | Macros | Functions | Variables
image.cpp File Reference

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

#include "global.hpp"
#include "color_range.hpp"
#include "config.hpp"
#include "filesystem.hpp"
#include "game_config.hpp"
#include "image.hpp"
#include "image_modifications.hpp"
#include "log.hpp"
#include "gettext.hpp"
#include "gui/dialogs/advanced_graphics_options.hpp"
#include "preferences.hpp"
#include "sdl/rect.hpp"
#include "serialization/string_utils.hpp"
#include "video.hpp"
#include <SDL_image.h>
#include "utils/functional.hpp"
#include <boost/functional/hash.hpp>
#include <list>
#include <set>
Include dependency graph for image.cpp:

Go to the source code of this file.

Classes

struct  cache_item< T >
 
singleton  image::cache_type< T >
 

Namespaces

 image
 this module manages the cache of images.
 

Macros

#define GETTEXT_DOMAIN   "wesnoth-lib"
 
#define ERR_DP   LOG_STREAM(err, log_display)
 
#define LOG_DP   LOG_STREAM(info, log_display)
 
#define ERR_CFG   LOG_STREAM(err , log_config)
 

Functions

void image::flush_cache ()
 
size_t image::hash_value (const locator::value &val)
 
static bool image::localized_file_uptodate (const std::string &loc_file)
 
static std::string image::get_localized_path (const std::string &file, const std::string &suff="")
 
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 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_pixel_format (SDL_PixelFormat *format)
 sets the pixel format used by the images. More...
 
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 (int zoom)
 sets the amount scaled images should be scaled. More...
 
template<scaling_function F>
static surface image::scale_xbrz_helper (const surface &res, int w, int h)
 
static scaling_function image::select_algorithm (gui2::tadvanced_graphics_options::SCALING_ALGORITHM algo)
 
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)
 
bool image::save_image (const locator &i_locator, const std::string &filename)
 
bool image::save_image (const surface &surf, const std::string &filename)
 
bool image::update_from_preferences ()
 initialize any private data, e.g. algorithm choices from preferences More...
 

Variables

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
 
static std::set< std::stringimage::fuzzy_localized_files
 
static SDL_PixelFormat image::last_pixel_format
 

Detailed Description

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

Definition in file image.cpp.

Macro Definition Documentation

#define ERR_CFG   LOG_STREAM(err , log_config)

Definition at line 56 of file image.cpp.

Referenced by image::load_image_sub_file().

#define ERR_DP   LOG_STREAM(err, log_display)

Definition at line 52 of file image.cpp.

Referenced by image::load_image_file().

#define GETTEXT_DOMAIN   "wesnoth-lib"

Definition at line 20 of file image.cpp.

#define LOG_DP   LOG_STREAM(info, log_display)

Definition at line 53 of file image.cpp.

Referenced by image::save_image(), and image::set_pixel_format().

Variable Documentation

lg::log_domain log_config("config")
static
lg::log_domain log_display("display")
static