30 #define GETTEXT_DOMAIN "wesnoth-lib"
33 #define ERR_DP LOG_STREAM(err, log_display)
50 auto& top_vector = top_pair->second;
53 top_vector.erase(top_vector.begin());
54 if(top_vector.empty()) {
63 std::size_t count = 0;
64 for(
const map_type::value_type& pair :
priorities_) {
65 count += pair.second.size();
81 using mod_parser = std::function<
modification*(
const std::string&)>;
88 std::map<std::string, mod_parser> mod_parsers;
97 modification* decode_modification(
const std::string& encoded_mod)
101 if(
split.size() != 2) {
102 ERR_DP <<
"error parsing image modifications: " << encoded_mod;
106 std::string mod_type =
split[0];
107 std::string args =
split[1];
109 if(mod_parsers.find(mod_type) == mod_parsers.end()) {
110 ERR_DP <<
"unknown image function in path: " << mod_type;
114 return mod_parsers[mod_type](args);
121 : message(message_stream.str())
164 if(horiz_ && vert_ ) {
179 const int normalized = degrees_ >= 0 ?
180 degrees_ - 360 * (degrees_ / 360) :
181 degrees_ + 360 * (1 + (-degrees_) / 360);
183 switch ( normalized )
189 case 360:
return src;
230 :
p(
p), clr(clr),
w(
w),
h(
h)
235 add_input(inputs,
"x");
236 add_input(inputs,
"y");
237 add_input(inputs,
"u");
238 add_input(inputs,
"v");
239 add_input(inputs,
"red");
240 add_input(inputs,
"green");
241 add_input(inputs,
"blue");
242 add_input(inputs,
"alpha");
243 add_input(inputs,
"height");
244 add_input(inputs,
"width");
252 }
else if(key ==
"y") {
254 }
else if(key ==
"red") {
255 return variant(clr.r);
256 }
else if(key ==
"green") {
257 return variant(clr.g);
258 }
else if(key ==
"blue") {
259 return variant(clr.b);
260 }
else if(key ==
"alpha") {
261 return variant(clr.a);
262 }
else if(key ==
"width") {
264 }
else if(key ==
"height") {
266 }
else if(key ==
"u") {
267 return variant(
p.x /
static_cast<float>(
w));
268 }
else if(key ==
"v") {
269 return variant(
p.y /
static_cast<float>(
h));
291 if(nsurf ==
nullptr) {
292 PLAIN_LOG <<
"could not make neutral surface...";
298 uint32_t* cur = lock.
pixels();
299 uint32_t*
const end = cur + nsurf->w * src->h;
300 uint32_t*
const beg = cur;
304 pixel.a = (*cur) >> 24;
305 pixel.r = (*cur) >> 16;
306 pixel.g = (*cur) >> 8;
315 pixel.a = std::min<unsigned>(new_alpha.
evaluate(px).
as_int(), 255);
316 *cur = (pixel.a << 24) + (pixel.r << 16) + (pixel.g << 8) + pixel.b;
338 if(nsurf ==
nullptr) {
339 PLAIN_LOG <<
"could not make neutral surface...";
345 uint32_t* cur = lock.
pixels();
346 uint32_t*
const end = cur + nsurf->w * src->h;
347 uint32_t*
const beg = cur;
351 pixel.a = (*cur) >> 24;
352 pixel.r = (*cur) >> 16;
353 pixel.g = (*cur) >> 8;
363 pixel.g = std::min<unsigned>(new_green.
evaluate(px).
as_int(), 255);
364 pixel.b = std::min<unsigned>(new_blue.
evaluate(px).
as_int(), 255);
365 pixel.a = std::min<unsigned>(new_alpha.
evaluate(px).
as_int(), 255);
366 *cur = (pixel.a << 24) + (pixel.r << 16) + (pixel.g << 8) + pixel.b;
377 SDL_Rect area = slice_;
400 std::stringstream sstr;
401 sstr <<
"~BLIT(): x-coordinate '"
402 << x_ <<
"' larger than destination image's width '"
403 << src->w <<
"' no blitting performed.\n";
409 std::stringstream sstr;
410 sstr <<
"~BLIT(): y-coordinate '"
411 << y_ <<
"' larger than destination image's height '"
412 << src->h <<
"' no blitting performed.\n";
417 if(surf_->w + x_ < 0) {
418 std::stringstream sstr;
419 sstr <<
"~BLIT(): offset and width '"
420 << x_ + surf_->w <<
"' less than zero no blitting performed.\n";
425 if(surf_->h + y_ < 0) {
426 std::stringstream sstr;
427 sstr <<
"~BLIT(): offset and height '"
428 << y_ + surf_->h <<
"' less than zero no blitting performed.\n";
434 SDL_Rect r {x_, y_, 0, 0};
441 if(src->w == mask_->w && src->h == mask_->h && x_ == 0 && y_ == 0) {
445 SDL_Rect r {x_, y_, 0, 0};
446 surface new_mask(src->w, src->h);
447 sdl_blit(mask_,
nullptr, new_mask, &r);
452 if(src ==
nullptr) {
return nullptr; }
456 if(surf_->w != src->w || surf_->h != src->h) {
467 std::pair<int,int> sz = calculate_size(src);
478 const int old_w = src->w;
479 const int old_h = src->h;
485 ERR_DP <<
"width of " << fn_ <<
" is negative - resetting to original width";
492 ERR_DP <<
"height of " << fn_ <<
" is negative - resetting to original height";
502 const int old_w = src->w;
503 const int old_h = src->h;
504 long double w = get_w();
505 long double h = get_h();
509 ERR_DP <<
"width of SCALE_INTO is negative - resetting to original width";
516 ERR_DP <<
"height of SCALE_INTO is negative - resetting to original height";
521 long double ratio = std::min(
w / old_w,
h / old_h);
523 return {
static_cast<int>(old_w * ratio),
static_cast<int>(old_h * ratio)};
543 if(nsurf ==
nullptr) {
544 PLAIN_LOG <<
"could not make neutral surface...";
552 uint32_t* beg = lock.
pixels();
553 uint32_t* end = beg + nsurf->w * src->h;
556 uint8_t alpha = (*beg) >> 24;
565 *beg = (alpha << 24) + (r << 16) + (
g << 8) +
b;
577 return((r_ != 0 || g_ != 0 ||
b_ != 0)
596 SDL_FillRect(ret,
nullptr, SDL_MapRGBA(ret->format, color_.r, color_.g,
597 color_.b, color_.a));
598 sdl_blit(src,
nullptr, ret,
nullptr);
609 struct parse_mod_registration
611 parse_mod_registration(
const char* name, mod_parser parser)
613 mod_parsers[name] = parser;
626 #define REGISTER_MOD_PARSER(type, args_var) \
627 static modification* parse_##type##_mod(const std::string&); \
628 static parse_mod_registration parse_##type##_mod_registration_aux(#type, &parse_##type##_mod); \
629 static modification* parse_##type##_mod(const std::string& args_var) \
634 std::vector<std::string> params =
utils::split(args,
',');
636 if(params.size() < 2) {
637 ERR_DP <<
"too few arguments passed to the ~TC() function";
642 const int side_n = lexical_cast_default<int>(params[0], -1);
644 ERR_DP <<
"Invalid side (" << side_n <<
") passed to the ~TC() function";
652 ERR_DP <<
"could not load TC info for '" << params[1] <<
"' palette";
653 ERR_DP <<
"bailing out from TC";
665 ERR_DP <<
"caught config::error while processing TC: " <<
e.message;
666 ERR_DP <<
"bailing out from TC";
671 return new rc_modification(rc_map);
677 const std::vector<std::string> recolor_params =
utils::split(args,
'>');
679 if(recolor_params.size() <= 1) {
694 <<
"caught config::error while processing color-range RC: "
696 ERR_DP <<
"bailing out from RC";
700 return new rc_modification(rc_map);
706 const std::vector<std::string> remap_params =
utils::split(args,
'>');
708 if(remap_params.size() < 2) {
709 ERR_DP <<
"not enough arguments passed to the ~PAL() function: " << args;
719 for(std::size_t
i = 0;
i < old_palette.size() &&
i < new_palette.size(); ++
i) {
720 rc_map[old_palette[
i]] = new_palette[
i];
723 return new rc_modification(rc_map);
726 <<
"caught config::error while processing PAL function: "
729 <<
"bailing out from PAL";
738 bool horiz = (args.empty() || args.find(
"horiz") != std::string::npos);
739 bool vert = (args.find(
"vert") != std::string::npos);
741 return new fl_modification(horiz, vert);
748 const std::size_t
s = slice_params.size();
752 return new rotate_modification();
755 return new rotate_modification(
756 lexical_cast_default<int>(slice_params[0]));
759 return new rotate_modification(
760 lexical_cast_default<int>(slice_params[0]),
761 lexical_cast_default<int>(slice_params[1]));
764 return new rotate_modification(
765 lexical_cast_default<int>(slice_params[0]),
766 lexical_cast_default<int>(slice_params[1]),
767 lexical_cast_default<int>(slice_params[2]));
776 return new gs_modification;
782 const std::vector<std::string>& params =
utils::split(args,
',');
784 if(params.size() != 1) {
785 ERR_DP <<
"~BW() requires exactly one argument";
790 int threshold = std::stoi(params[0]);
791 if(threshold < 0 || threshold > 255) {
792 ERR_DP <<
"~BW() argument out of range 0 - 255";
795 return new bw_modification(threshold);
797 }
catch (
const std::invalid_argument&) {
798 ERR_DP <<
"unsupported argument in ~BW() function";
806 return new sepia_modification;
812 const std::vector<std::string>& params =
utils::split(args,
',');
814 switch (params.size()) {
819 return new negative_modification(-1,-1,-1);
823 int threshold = std::stoi(params[0]);
824 if(threshold < -1 || threshold > 255) {
825 ERR_DP <<
"unsupported argument value in ~NEG() function";
828 return new negative_modification(threshold, threshold, threshold);
830 }
catch (
const std::invalid_argument&) {
831 ERR_DP <<
"unsupported argument value in ~NEG() function";
837 int thresholdRed = std::stoi(params[0]);
838 int thresholdGreen = std::stoi(params[1]);
839 int thresholdBlue = std::stoi(params[2]);
840 if(thresholdRed < -1 || thresholdRed > 255 || thresholdGreen < -1 || thresholdGreen > 255 || thresholdBlue < -1 || thresholdBlue > 255) {
841 ERR_DP <<
"unsupported argument value in ~NEG() function";
844 return new negative_modification(thresholdRed, thresholdGreen, thresholdBlue);
846 }
catch (
const std::invalid_argument&) {
847 ERR_DP <<
"unsupported argument value in ~NEG() function";
852 ERR_DP <<
"~NEG() requires 0, 1 or 3 arguments";
862 return new plot_alpha_modification;
868 return new wipe_alpha_modification;
878 if(params.size() != 1) {
879 ERR_DP <<
"~ADJUST_ALPHA() requires exactly 1 arguments";
883 return new adjust_alpha_modification(params.at(0));
893 if(params.size() < 1 || params.size() > 4) {
894 ERR_DP <<
"~CHAN() requires 1 to 4 arguments";
898 return new adjust_channels_modification(params);
904 std::vector<std::string>
const factors =
utils::split(args,
',');
905 const std::size_t
s = factors.size();
908 ERR_DP <<
"no arguments passed to the ~CS() function";
912 int r = 0,
g = 0,
b = 0;
914 r = lexical_cast_default<int>(factors[0]);
917 g = lexical_cast_default<int>(factors[1]);
920 b = lexical_cast_default<int>(factors[2]);
923 return new cs_modification(r,
g,
b);
929 const std::vector<std::string>& params =
utils::split(args,
',');
931 if(params.size() != 4) {
932 ERR_DP <<
"~BLEND() requires exactly 4 arguments";
936 float opacity = 0.0f;
937 const std::string& opacity_str = params[3];
938 const std::string::size_type p100_pos = opacity_str.find(
'%');
940 if(p100_pos == std::string::npos)
941 opacity = lexical_cast_default<float>(opacity_str);
944 const std::string& parsed_field = opacity_str.substr(0, p100_pos);
945 opacity = lexical_cast_default<float>(parsed_field);
949 return new blend_modification(
950 lexical_cast_default<int>(params[0]),
951 lexical_cast_default<int>(params[1]),
952 lexical_cast_default<int>(params[2]),
960 const std::size_t
s = slice_params.size();
962 if(
s == 0 || (
s == 1 && slice_params[0].empty())) {
963 ERR_DP <<
"no arguments passed to the ~CROP() function";
967 SDL_Rect slice_rect { 0, 0, 0, 0 };
969 slice_rect.x = lexical_cast_default<int16_t, const std::string&>(slice_params[0]);
972 slice_rect.y = lexical_cast_default<int16_t, const std::string&>(slice_params[1]);
975 slice_rect.w = lexical_cast_default<uint16_t, const std::string&>(slice_params[2]);
978 slice_rect.h = lexical_cast_default<uint16_t, const std::string&>(slice_params[3]);
981 return new crop_modification(slice_rect);
984 static bool check_image(
const image::locator& img, std::stringstream & message)
996 const std::size_t
s = param.size();
998 if(
s == 0 || (
s == 1 && param[0].empty())){
999 ERR_DP <<
"no arguments passed to the ~BLIT() function";
1004 ERR_DP <<
"too many arguments passed to the ~BLIT() function";
1011 x = lexical_cast_default<int>(param[1]);
1012 y = lexical_cast_default<int>(param[2]);
1018 if(!check_image(img, message))
1022 return new blit_modification(surf, x, y);
1029 const std::size_t
s = param.size();
1031 if(
s == 0 || (
s == 1 && param[0].empty())){
1032 ERR_DP <<
"no arguments passed to the ~MASK() function";
1039 x = lexical_cast_default<int>(param[1]);
1040 y = lexical_cast_default<int>(param[2]);
1043 if(x < 0 || y < 0) {
1044 ERR_DP <<
"negative position arguments in ~MASK() function";
1051 if(!check_image(img, message))
1055 return new mask_modification(surf, x, y);
1062 ERR_DP <<
"no arguments passed to the ~L() function";
1068 return new light_modification(surf);
1075 const std::size_t
s = scale_params.size();
1077 if(
s == 0 || (
s == 1 && scale_params[0].empty())) {
1078 ERR_DP <<
"no arguments passed to the ~SCALE() function";
1084 w = lexical_cast_default<int, const std::string&>(scale_params[0]);
1087 h = lexical_cast_default<int, const std::string&>(scale_params[1]);
1090 return new scale_exact_modification(
w,
h,
"SCALE",
false);
1096 const std::size_t
s = scale_params.size();
1098 if(
s == 0 || (
s == 1 && scale_params[0].empty())) {
1099 ERR_DP <<
"no arguments passed to the ~SCALE_SHARP() function";
1105 w = lexical_cast_default<int, const std::string&>(scale_params[0]);
1108 h = lexical_cast_default<int, const std::string&>(scale_params[1]);
1111 return new scale_exact_modification(
w,
h,
"SCALE_SHARP",
true);
1117 const std::size_t
s = scale_params.size();
1119 if(
s == 0 || (
s == 1 && scale_params[0].empty())) {
1120 ERR_DP <<
"no arguments passed to the ~SCALE_INTO() function";
1126 w = lexical_cast_default<int, const std::string&>(scale_params[0]);
1129 h = lexical_cast_default<int, const std::string&>(scale_params[1]);
1132 return new scale_into_modification(
w,
h,
"SCALE_INTO",
false);
1138 const std::size_t
s = scale_params.size();
1140 if(
s == 0 || (
s == 1 && scale_params[0].empty())) {
1141 ERR_DP <<
"no arguments passed to the ~SCALE_INTO_SHARP() function";
1147 w = lexical_cast_default<int, const std::string&>(scale_params[0]);
1150 h = lexical_cast_default<int, const std::string&>(scale_params[1]);
1153 return new scale_into_modification(
w,
h,
"SCALE_INTO_SHARP",
true);
1159 int z = lexical_cast_default<int, const std::string &>(args);
1160 if(z < 1 || z > 5) {
1164 return new xbrz_modification(z);
1172 const int depth = std::max<int>(0, lexical_cast_default<int>(args));
1174 return new bl_modification(depth);
1180 const std::string::size_type p100_pos = args.find(
'%');
1182 if(p100_pos == std::string::npos) {
1183 num = lexical_cast_default<float,const std::string&>(args);
1186 const std::string parsed_field = args.substr(0, p100_pos);
1187 num = lexical_cast_default<float,const std::string&>(parsed_field);
1191 return new o_modification(num);
1201 const int r = lexical_cast_default<int>(args);
1203 return new cs_modification(r,0,0);
1209 const int g = lexical_cast_default<int>(args);
1211 return new cs_modification(0,
g,0);
1217 const int b = lexical_cast_default<int>(args);
1219 return new cs_modification(0,0,
b);
1243 int c[4] { 0, 0, 0, SDL_ALPHA_OPAQUE };
1244 std::vector<std::string> factors =
utils::split(args,
',');
1246 for(
int i = 0; i < std::min<int>(factors.size(), 4); ++
i) {
1247 c[
i] = lexical_cast_default<int>(factors[
i]);
1250 return new background_modification(
color_t(
c[0],
c[1],
c[2],
c[3]));
1259 if(params.size() != 3 && params.size() != 4) {
1260 ERR_DP <<
"incorrect number of arguments in ~SWAP() function, they must be 3 or 4";
1264 channel redValue, greenValue, blueValue, alphaValue;
1266 if(params[0] ==
"red") {
1268 }
else if(params[0] ==
"green") {
1270 }
else if(params[0] ==
"blue") {
1272 }
else if(params[0] ==
"alpha") {
1275 ERR_DP <<
"unsupported argument value in ~SWAP() function: " << params[0];
1280 if(params[1] ==
"red") {
1282 }
else if(params[1] ==
"green") {
1284 }
else if(params[1] ==
"blue") {
1286 }
else if(params[1] ==
"alpha") {
1289 ERR_DP <<
"unsupported argument value in ~SWAP() function: " << params[0];
1293 if(params[2] ==
"red") {
1295 }
else if(params[2] ==
"green") {
1297 }
else if(params[2] ==
"blue") {
1299 }
else if(params[2] ==
"alpha") {
1302 ERR_DP <<
"unsupported argument value in ~SWAP() function: " << params[0];
1308 if(params.size() == 3) {
1311 if(params[3] ==
"red") {
1313 }
else if(params[3] ==
"green") {
1315 }
else if(params[3] ==
"blue") {
1317 }
else if(params[3] ==
"alpha") {
1320 ERR_DP <<
"unsupported argument value in ~SWAP() function: " << params[3];
1325 return new swap_modification(redValue, greenValue, blueValue, alphaValue);
A color range definition is made of four reference RGB colors, used for calculating conversions from ...
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
Generic locator abstracting the location of an image.
bool file_exists() const
Tests whether the file the locator points at exists.
const std::string & get_filename() const
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
A modified priority queue used to order image modifications.
modification * top() const
Returns the top element in the queue .
void push(modification *mod)
Adds mod to the queue (unless mod is nullptr).
void pop()
Removes the top element from the queue.
map_type priorities_
Map from a mod's priority() to the mods having that priority.
std::size_t size() const
Returns the number of elements in the queue.
Base abstract class for an image-path modification.
static modification_queue decode(const std::string &)
Decodes modifications from a modification string.
virtual int priority() const
Specifies the priority of the modification.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
pixel_callable(SDL_Point p, color_t clr, uint32_t w, uint32_t h)
wfl::variant get_value(const std::string &key) const override
void get_inputs(wfl::formula_input_vector &inputs) const override
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
virtual std::pair< int, int > calculate_size(const surface &src) const
virtual std::pair< int, int > calculate_size(const surface &src) const
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
Helper class for pinning SDL surfaces into memory.
surface clone() const
Makes a copy of this surface.
static const color_range get_side_color_range(int side)
constexpr uint8_t color_multiply(uint8_t n1, uint8_t n2)
Multiply two 8-bit colour values as if in the range [0.0,1.0].
constexpr uint8_t float_to_color(double n)
Convert a double in the range [0.0,1.0] to an 8-bit colour value.
color_range_map recolor_range(const color_range &new_range, const std::vector< color_t > &old_rgb)
Converts a source palette using the specified color_range object.
std::unordered_map< color_t, color_t > color_range_map
#define REGISTER_MOD_PARSER(type, args_var)
A macro for automatic modification parser registration.
static lg::log_domain log_display("display")
New lexcical_cast header.
Standard logging facilities (interface).
const std::vector< color_t > & tc_info(const std::string &name)
const color_range & color_info(const std::string &name)
Functions to load and save images from/to disk.
surface get_surface(const image::locator &i_locator, TYPE type, bool skip_cache)
Returns an image surface suitable for software manipulation.
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
@ STRIP_SPACES
REMOVE_EMPTY: remove empty elements.
std::vector< std::string > parenthetical_split(const std::string &val, const char separator, const std::string &left, const std::string &right, const int flags)
Splits a string based either on a separator, except then the text appears within specified parenthesi...
std::vector< std::string > split(const config_attribute_value &val)
std::string::const_iterator iterator
std::vector< formula_input > formula_input_vector
The basic class for representing 8-bit RGB or RGBA colour values.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
Exception thrown by the operator() when an error occurs.
imod_exception(const std::stringstream &message_stream)
Constructor.
virtual surface operator()(const surface &src) const
Applies the image-path modification on the specified surface.
static map_location::DIRECTION s
surface alpha_to_greyscale(const surface &surf)
surface blur_alpha_surface(const surface &surf, int depth)
Cross-fades a surface with alpha channel.
surface adjust_surface_color(const surface &surf, int red, int green, int blue)
surface recolor_image(surface surf, const color_range_map &map_rgb)
Recolors a surface using a map with source and converted palette values.
surface negative_image(const surface &surf, const int thresholdR, const int thresholdG, const int thresholdB)
surface swap_channels_image(const surface &surf, channel r, channel g, channel b, channel a)
surface light_surface(const surface &surf, const surface &lightmap)
Light surf using lightmap.
surface scale_surface_legacy(const surface &surf, int w, int h)
Scale a surface using simple bilinear filtering (discarding rgb from source pixels with 0 alpha)
surface flip_surface(const surface &surf)
surface sepia_image(const surface &surf)
surface blend_surface(const surface &surf, const double amount, const color_t color)
Blends a surface with a color.
surface cut_surface(const surface &surf, const SDL_Rect &r)
Cuts a rectangle from a surface.
surface wipe_alpha(const surface &surf)
surface flop_surface(const surface &surf)
surface scale_surface_xbrz(const surface &surf, std::size_t z)
Scale a surface using xBRZ algorithm.
surface scale_surface_sharp(const surface &surf, int w, int h)
Scale a surface using modified nearest neighbour algorithm.
surface monochrome_image(const surface &surf, const int threshold)
surface rotate_90_surface(const surface &surf, bool clockwise)
Rotates a surface 90 degrees.
surface rotate_180_surface(const surface &surf)
Rotates a surface 180 degrees.
surface greyscale_image(const surface &surf)
surface scale_surface(const surface &surf, int w, int h)
Scale a surface using alpha-weighted modified bilinear filtering Note: causes artifacts with alpha gr...
surface mask_surface(const surface &surf, const surface &mask, bool *empty_result, const std::string &filename)
Applies a mask on a surface.
surface rotate_any_surface(const surface &surf, float angle, int zoom, int offset)
Rotates a surface by any degrees.
void sdl_blit(const surface &src, const SDL_Rect *src_rect, surface &dst, SDL_Rect *dst_rect)