31 #include "formula/callable_objects.hpp"
33 #define GETTEXT_DOMAIN "wesnoth-lib"
36 #define ERR_DP LOG_STREAM(err, log_display)
43 priorities_[mod->priority()].push_back(std::move(mod));
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<std::unique_ptr<modification>(std::string_view)>;
88 std::map<std::string, mod_parser, std::less<>> mod_parsers;
97 std::unique_ptr<modification> decode_modification(
const std::string& encoded_mod)
101 if(
split.size() != 2) {
102 ERR_DP <<
"error parsing image modifications: " << encoded_mod;
106 const std::string& mod_type =
split[0];
107 const std::string& args =
split[1];
109 if(
const auto parser = mod_parsers.find(mod_type); parser != mod_parsers.end()) {
110 return std::invoke(parser->second, args);
112 ERR_DP <<
"unknown image function in path: " << mod_type;
121 : message(message_stream.str())
146 if(
auto mod = decode_modification(encoded_mod)) {
147 mods.
push(std::move(mod));
161 if(horiz_ && vert_ ) {
174 const int normalized = degrees_ >= 0 ?
175 degrees_ - 360 * (degrees_ / 360) :
176 degrees_ + 360 * (1 + (-degrees_) / 360);
178 switch ( normalized )
206 if(src_rect.w ==
src->w && src_rect.h ==
src->h) {
213 ERR_DP <<
"Failed to either crop or scale the surface";
247 : color_callable(clr),
p(
p),
w(
w),
h(
h)
252 color_callable::get_inputs(inputs);
253 add_input(inputs,
"x");
254 add_input(inputs,
"y");
255 add_input(inputs,
"u");
256 add_input(inputs,
"v");
257 add_input(inputs,
"height");
258 add_input(inputs,
"width");
266 }
else if(key ==
"y") {
268 }
else if(key ==
"width") {
270 }
else if(key ==
"height") {
272 }
else if(key ==
"u") {
273 return variant(
p.x /
static_cast<float>(
w));
274 }
else if(key ==
"v") {
275 return variant(
p.y /
static_cast<float>(
h));
278 return color_callable::get_value(key);
292 uint32_t* cur = lock.
pixels();
293 uint32_t*
const end = cur +
src.
area();
294 uint32_t*
const beg = cur;
298 pixel.a = (*cur) >> 24;
299 pixel.r = (*cur) >> 16;
300 pixel.g = (*cur) >> 8;
309 pixel.a = std::min<unsigned>(new_alpha.
evaluate(px).
as_int(), 255);
310 *cur = (pixel.a << 24) + (pixel.r << 16) + (pixel.g << 8) + pixel.b;
326 uint32_t* cur = lock.
pixels();
327 uint32_t*
const end = cur +
src.
area();
328 uint32_t*
const beg = cur;
332 pixel.a = (*cur) >> 24;
333 pixel.r = (*cur) >> 16;
334 pixel.g = (*cur) >> 8;
344 pixel.g = std::min<unsigned>(new_green.
evaluate(px).
as_int(), 255);
345 pixel.b = std::min<unsigned>(new_blue.
evaluate(px).
as_int(), 255);
346 pixel.a = std::min<unsigned>(new_alpha.
evaluate(px).
as_int(), 255);
347 *cur = (pixel.a << 24) + (pixel.r << 16) + (pixel.g << 8) + pixel.b;
356 SDL_Rect area = slice_;
371 std::stringstream sstr;
372 sstr <<
"~BLIT(): x-coordinate '"
373 << x_ <<
"' larger than destination image's width '"
374 <<
src->w <<
"' no blitting performed.\n";
380 std::stringstream sstr;
381 sstr <<
"~BLIT(): y-coordinate '"
382 << y_ <<
"' larger than destination image's height '"
383 <<
src->h <<
"' no blitting performed.\n";
388 if(surf_->w + x_ < 0) {
389 std::stringstream sstr;
390 sstr <<
"~BLIT(): offset and width '"
391 << x_ + surf_->w <<
"' less than zero no blitting performed.\n";
396 if(surf_->h + y_ < 0) {
397 std::stringstream sstr;
398 sstr <<
"~BLIT(): offset and height '"
399 << y_ + surf_->h <<
"' less than zero no blitting performed.\n";
404 SDL_Rect r {x_, y_, 0, 0};
410 if(
src->w == mask_->w &&
src->h == mask_->h && x_ == 0 && y_ == 0) {
415 SDL_Rect r {x_, y_, 0, 0};
417 sdl_blit(mask_,
nullptr, new_mask, &r);
423 if(
src ==
nullptr) {
return; }
426 if(surf_->w !=
src->w || surf_->h !=
src->h) {
439 }
else if(flags_ & X_BY_FACTOR) {
440 size.x =
src->w * (
static_cast<double>(
size.x) / 100);
445 }
else if(flags_ & Y_BY_FACTOR) {
446 size.y =
src->h * (
static_cast<double>(
size.y) / 100);
449 if(flags_ & PRESERVE_ASPECT_RATIO) {
450 const auto ratio = std::min(
451 static_cast<long double>(
size.x) /
src->w,
452 static_cast<long double>(
size.y) /
src->h
456 static_cast<int>(
src->w * ratio),
457 static_cast<int>(
src->h * ratio)
461 if(flags_ & SCALE_SHARP) {
485 uint32_t* beg = lock.
pixels();
486 uint32_t* end = beg +
src.
area();
489 uint8_t alpha = (*beg) >> 24;
498 *beg = (alpha << 24) + (r << 16) + (
g << 8) +
b;
508 if((r_ != 0 || g_ != 0 ||
b_ != 0)) {
526 SDL_FillRect(ret,
nullptr, SDL_MapRGBA(ret->format, color_.r, color_.g, color_.b, color_.a));
538 struct parse_mod_registration
540 parse_mod_registration(
const char* name, mod_parser parser)
542 mod_parsers[name] = std::move(parser);
555 #define REGISTER_MOD_PARSER(type, args_var) \
556 static std::unique_ptr<modification> parse_##type##_mod(std::string_view); \
557 static parse_mod_registration parse_##type##_mod_registration_aux(#type, &parse_##type##_mod); \
558 static std::unique_ptr<modification> parse_##type##_mod(std::string_view args_var) \
565 if(params.size() < 2) {
566 ERR_DP <<
"too few arguments passed to the ~TC() function";
571 const int side_n = utils::from_chars<int>(params[0]).value_or(-1);
573 ERR_DP <<
"Invalid side (" << params[0] <<
") passed to the ~TC() function";
581 ERR_DP <<
"could not load TC info for '" << params[1] <<
"' palette";
582 ERR_DP <<
"bailing out from TC";
594 ERR_DP <<
"caught config::error while processing TC: " <<
e.message;
595 ERR_DP <<
"bailing out from TC";
600 return std::make_unique<rc_modification>(rc_map);
608 if(recolor_params.size() <= 1) {
623 <<
"caught config::error while processing color-range RC: "
625 ERR_DP <<
"bailing out from RC";
629 return std::make_unique<rc_modification>(rc_map);
637 if(remap_params.size() < 2) {
638 ERR_DP <<
"not enough arguments passed to the ~PAL() function: " << args;
648 for(std::size_t
i = 0;
i < old_palette.size() &&
i < new_palette.size(); ++
i) {
649 rc_map[old_palette[
i]] = new_palette[
i];
652 return std::make_unique<rc_modification>(rc_map);
655 <<
"caught config::error while processing PAL function: "
658 <<
"bailing out from PAL";
667 bool horiz = (args.empty() || args.find(
"horiz") != std::string::npos);
668 bool vert = (args.find(
"vert") != std::string::npos);
670 return std::make_unique<fl_modification>(horiz, vert);
678 switch(slice_params.size()) {
680 return std::make_unique<rotate_modification>();
682 return std::make_unique<rotate_modification>(
683 utils::from_chars<int>(slice_params[0]).value_or(0));
685 return std::make_unique<rotate_modification>(
686 utils::from_chars<int>(slice_params[0]).value_or(0),
687 utils::from_chars<int>(slice_params[1]).value_or(0));
689 return std::make_unique<rotate_modification>(
690 utils::from_chars<int>(slice_params[0]).value_or(0),
691 utils::from_chars<int>(slice_params[1]).value_or(0),
692 utils::from_chars<int>(slice_params[2]).value_or(0));
700 return std::make_unique<gs_modification>();
706 return std::make_unique<crop_transparency_modification>();
710 bool in_range(
int val,
int min,
int max)
712 return min <= val && val <= max;
720 if(params.size() != 1) {
721 ERR_DP <<
"~BW() requires exactly one argument";
726 const auto threshold = utils::from_chars<int>(params[0]);
728 ERR_DP <<
"unsupported argument in ~BW() function";
732 if(!in_range(*threshold, 0, 255)) {
733 ERR_DP <<
"~BW() argument out of range 0 - 255";
737 return std::make_unique<bw_modification>(*threshold);
743 return std::make_unique<sepia_modification>();
751 switch(params.size()) {
755 return std::make_unique<negative_modification>(-1, -1, -1);
758 const auto threshold = utils::from_chars<int>(params[0]);
760 if(threshold && in_range(*threshold, -1, 255)) {
761 return std::make_unique<negative_modification>(*threshold, *threshold, *threshold);
763 ERR_DP <<
"unsupported argument value in ~NEG() function";
769 const auto thR = utils::from_chars<int>(params[0]);
770 const auto thG = utils::from_chars<int>(params[1]);
771 const auto thB = utils::from_chars<int>(params[2]);
773 if(thR && thG && thB && in_range(*thR, -1, 255) && in_range(*thG, -1, 255) && in_range(*thB, -1, 255)) {
774 return std::make_unique<negative_modification>(*thR, *thG, *thB);
776 ERR_DP <<
"unsupported argument value in ~NEG() function";
782 ERR_DP <<
"~NEG() requires 0, 1 or 3 arguments";
790 return std::make_unique<plot_alpha_modification>();
796 return std::make_unique<wipe_alpha_modification>();
806 if(params.size() != 1) {
807 ERR_DP <<
"~ADJUST_ALPHA() requires exactly 1 arguments";
811 return std::make_unique<adjust_alpha_modification>(params.at(0));
821 if(params.size() < 1 || params.size() > 4) {
822 ERR_DP <<
"~CHAN() requires 1 to 4 arguments";
826 return std::make_unique<adjust_channels_modification>(params);
833 const std::size_t
s = factors.size();
836 ERR_DP <<
"no arguments passed to the ~CS() function";
840 int r = 0,
g = 0,
b = 0;
842 r = utils::from_chars<int>(factors[0]).value_or(0);
845 g = utils::from_chars<int>(factors[1]).value_or(0);
848 b = utils::from_chars<int>(factors[2]).value_or(0);
851 return std::make_unique<cs_modification>(r,
g ,
b);
859 if(params.size() != 4) {
860 ERR_DP <<
"~BLEND() requires exactly 4 arguments";
864 float opacity = 0.0f;
865 const std::string_view& opacity_str = params[3];
866 const std::string_view::size_type p100_pos = opacity_str.find(
'%');
868 if(p100_pos == std::string::npos)
869 opacity = lexical_cast_default<float>(opacity_str);
872 const std::string_view parsed_field = opacity_str.substr(0, p100_pos);
873 opacity = lexical_cast_default<float>(parsed_field);
877 return std::make_unique<blend_modification>(
878 utils::from_chars<int>(params[0]).value_or(0),
879 utils::from_chars<int>(params[1]).value_or(0),
880 utils::from_chars<int>(params[2]).value_or(0),
888 const std::size_t
s = slice_params.size();
890 if(
s == 0 || (
s == 1 && slice_params[0].empty())) {
891 ERR_DP <<
"no arguments passed to the ~CROP() function";
895 SDL_Rect slice_rect { 0, 0, 0, 0 };
897 slice_rect.x = utils::from_chars<int16_t>(slice_params[0]).value_or(0);
900 slice_rect.y = utils::from_chars<int16_t>(slice_params[1]).value_or(0);
903 slice_rect.w = utils::from_chars<uint16_t>(slice_params[2]).value_or(0);
906 slice_rect.h = utils::from_chars<uint16_t>(slice_params[3]).value_or(0);
909 return std::make_unique<crop_modification>(slice_rect);
915 message <<
" image not found: '" <<
img.get_filename() <<
"'\n";
924 const std::size_t
s = param.size();
926 if(
s == 0 || (
s == 1 && param[0].empty())){
927 ERR_DP <<
"no arguments passed to the ~BLIT() function";
932 ERR_DP <<
"too many arguments passed to the ~BLIT() function";
939 x = utils::from_chars<int>(param[1]).value_or(0);
940 y = utils::from_chars<int>(param[2]).value_or(0);
946 if(!check_image(
img, message))
950 return std::make_unique<blit_modification>(
surf, x, y);
957 const std::size_t
s = param.size();
959 if(
s == 0 || (
s == 1 && param[0].empty())){
960 ERR_DP <<
"no arguments passed to the ~MASK() function";
967 x = utils::from_chars<int>(param[1]).value_or(0);
968 y = utils::from_chars<int>(param[2]).value_or(0);
972 ERR_DP <<
"negative position arguments in ~MASK() function";
979 if(!check_image(
img, message))
983 return std::make_unique<mask_modification>(
surf, x, y);
990 ERR_DP <<
"no arguments passed to the ~L() function";
995 return std::make_unique<light_modification>(
surf);
1000 std::pair<int, bool> parse_scale_value(std::string_view arg)
1002 if(
const std::size_t pos = arg.rfind(
'%'); pos != std::string_view::npos) {
1003 return { utils::from_chars<int>(arg.substr(0, pos)).value_or(0),
true };
1005 return { utils::from_chars<int>(arg).value_or(0),
false };
1010 utils::optional<std::pair<point, uint8_t>> parse_scale_args(std::string_view args)
1013 const std::size_t num_args = scale_params.size();
1015 if(num_args == 0 || (num_args == 1 && scale_params[0].empty())) {
1016 return utils::nullopt;
1020 std::array<int, 2> parsed_sizes{0,0};
1022 for(
unsigned i = 0; i < std::min<unsigned>(2, num_args); ++
i) {
1023 const auto& [
size, relative] = parse_scale_value(scale_params[
i]);
1026 ERR_DP <<
"Negative size passed to scaling IPF. Original image dimension will be used instead";
1030 parsed_sizes[
i] =
size;
1037 return std::pair{
point{parsed_sizes[0], parsed_sizes[1]}, flags};
1045 if(
auto params = parse_scale_args(args)) {
1047 return std::make_unique<scale_modification>(params->first, mode | params->second);
1049 ERR_DP <<
"no arguments passed to the ~SCALE() function";
1056 if(
auto params = parse_scale_args(args)) {
1058 return std::make_unique<scale_modification>(params->first, mode | params->second);
1060 ERR_DP <<
"no arguments passed to the ~SCALE_SHARP() function";
1067 if(
auto params = parse_scale_args(args)) {
1069 return std::make_unique<scale_modification>(params->first, mode | params->second);
1071 ERR_DP <<
"no arguments passed to the ~SCALE_INTO() function";
1078 if(
auto params = parse_scale_args(args)) {
1080 return std::make_unique<scale_modification>(params->first, mode | params->second);
1082 ERR_DP <<
"no arguments passed to the ~SCALE_INTO_SHARP() function";
1090 const int factor = std::clamp(utils::from_chars<int>(args).value_or(1), 1, 6);
1091 return std::make_unique<xbrz_modification>(factor);
1097 const int depth = std::max<int>(0, utils::from_chars<int>(args).value_or(0));
1098 return std::make_unique<bl_modification>(depth);
1104 const std::string::size_type p100_pos = args.find(
'%');
1106 if(p100_pos == std::string::npos) {
1107 num = lexical_cast_default<float, std::string_view>(args);
1110 const std::string_view parsed_field = args.substr(0, p100_pos);
1111 num = lexical_cast_default<float, std::string_view>(parsed_field);
1115 return std::make_unique<o_modification>(num);
1125 const int r = utils::from_chars<int>(args).value_or(0);
1126 return std::make_unique<cs_modification>(r, 0, 0);
1132 const int g = utils::from_chars<int>(args).value_or(0);
1133 return std::make_unique<cs_modification>(0,
g, 0);
1139 const int b = utils::from_chars<int>(args).value_or(0);
1140 return std::make_unique<cs_modification>(0, 0,
b);
1164 int c[4] { 0, 0, 0, SDL_ALPHA_OPAQUE };
1167 for(
int i = 0; i < std::min<int>(factors.size(), 4); ++
i) {
1168 c[
i] = utils::from_chars<int>(factors[
i]).value_or(0);
1171 return std::make_unique<background_modification>(
color_t(
c[0],
c[1],
c[2],
c[3]));
1180 if(params.size() != 3 && params.size() != 4) {
1181 ERR_DP <<
"incorrect number of arguments in ~SWAP() function, they must be 3 or 4";
1185 channel redValue, greenValue, blueValue, alphaValue;
1187 if(params[0] ==
"red") {
1189 }
else if(params[0] ==
"green") {
1191 }
else if(params[0] ==
"blue") {
1193 }
else if(params[0] ==
"alpha") {
1196 ERR_DP <<
"unsupported argument value in ~SWAP() function: " << params[0];
1201 if(params[1] ==
"red") {
1203 }
else if(params[1] ==
"green") {
1205 }
else if(params[1] ==
"blue") {
1207 }
else if(params[1] ==
"alpha") {
1210 ERR_DP <<
"unsupported argument value in ~SWAP() function: " << params[0];
1214 if(params[2] ==
"red") {
1216 }
else if(params[2] ==
"green") {
1218 }
else if(params[2] ==
"blue") {
1220 }
else if(params[2] ==
"alpha") {
1223 ERR_DP <<
"unsupported argument value in ~SWAP() function: " << params[0];
1229 if(params.size() == 3) {
1232 if(params[3] ==
"red") {
1234 }
else if(params[3] ==
"green") {
1236 }
else if(params[3] ==
"blue") {
1238 }
else if(params[3] ==
"alpha") {
1241 ERR_DP <<
"unsupported argument value in ~SWAP() function: " << params[3];
1246 return std::make_unique<swap_modification>(redValue, greenValue, blueValue, alphaValue);
A color range definition is made of four reference RGB colors, used for calculating conversions from ...
virtual void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
virtual void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
virtual void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
virtual void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
virtual void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
virtual void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
virtual void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
virtual void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
virtual void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
virtual void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
virtual void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
virtual void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
Generic locator abstracting the location of an image.
virtual void operator()(surface &src) const override
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 pop()
Removes the top element from the queue.
void push(std::unique_ptr< modification > mod)
Adds mod to the queue (unless mod is nullptr).
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 void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
virtual void operator()(surface &src) const override
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 void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
virtual void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
virtual void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
virtual void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
virtual void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
virtual void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
virtual void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
void store() const noexcept
Stores a copy the current exception to be rethrown.
Helper class for pinning SDL surfaces into memory.
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
Definitions for the interface to Wesnoth Markup Language (WML).
#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(std::string_view name)
const color_range & color_info(std::string_view name)
Functions to load and save images from/to disk.
bool exists(const image::locator &i_locator)
Returns true if the given image actually exists, without loading it.
surface get_surface(const image::locator &i_locator, TYPE type, bool skip_cache)
Returns an image surface suitable for software manipulation.
std::string img(const std::string &src, const std::string &align, const bool floating)
std::size_t size(std::string_view str)
Length in characters of a UTF-8 string.
@ STRIP_SPACES
REMOVE_EMPTY: remove empty elements.
std::vector< std::string_view > split_view(std::string_view s, const char sep, const int flags)
std::vector< std::string > parenthetical_split(std::string_view val, const char separator, std::string_view left, std::string_view 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
rect src
Non-transparent portion of the surface to compose.
The basic class for representing 8-bit RGB or RGBA colour values.
virtual void operator()(surface &src) const override
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 void operator()(surface &src) const override
Applies the image-path modification on the specified surface.
An abstract description of a rectangle with integer coordinates.
constexpr int area() const
The area of this rectangle, in square pixels.
static map_location::direction s
void mask_surface(surface &nsurf, const surface &nmask, bool *empty_result, const std::string &filename)
Applies a mask on a surface.
rect get_non_transparent_portion(const surface &nsurf)
void alpha_to_greyscale(surface &nsurf)
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)
void recolor_image(surface &nsurf, const color_range_map &map_rgb)
Recolors a surface using a map with source and converted palette values.
void wipe_alpha(surface &nsurf)
void sepia_image(surface &nsurf)
void blend_surface(surface &nsurf, const double amount, const color_t color)
Blends a surface with a color.
void swap_channels_image(surface &nsurf, channel r, channel g, channel b, channel a)
void adjust_surface_color(surface &nsurf, int red, int green, int blue)
surface cut_surface(const surface &surf, const SDL_Rect &r)
Cuts a rectangle from a surface.
void negative_image(surface &nsurf, const int thresholdR, const int thresholdG, const int thresholdB)
void light_surface(surface &nsurf, const surface &lightmap)
Light surf using lightmap.
surface get_surface_portion(const surface &src, SDL_Rect &area)
Get a portion of the screen.
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.
void blur_alpha_surface(surface &res, int depth)
Cross-fades a surface with alpha channel.
void greyscale_image(surface &nsurf)
void flop_surface(surface &nsurf)
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.
void flip_surface(surface &nsurf)
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 rotate_any_surface(const surface &surf, float angle, int zoom, int offset)
Rotates a surface by any degrees.
void monochrome_image(surface &nsurf, const int threshold)
void sdl_blit(const surface &src, const SDL_Rect *src_rect, surface &dst, SDL_Rect *dst_rect)