31 #define GETTEXT_DOMAIN "wesnoth-lib"
34 #define ERR_DP LOG_STREAM(err, log_display)
41 priorities_[mod->priority()].push_back(std::move(mod));
48 auto& top_vector = top_pair->second;
51 top_vector.erase(top_vector.begin());
52 if(top_vector.empty()) {
61 std::size_t count = 0;
62 for(
const map_type::value_type& pair :
priorities_) {
63 count += pair.second.size();
79 using mod_parser = std::function<std::unique_ptr<modification>(std::string_view)>;
86 std::map<std::string, mod_parser, std::less<>> mod_parsers;
95 std::unique_ptr<modification> decode_modification(
const std::string& encoded_mod)
99 if(
split.size() != 2) {
100 ERR_DP <<
"error parsing image modifications: " << encoded_mod;
104 const std::string& mod_type =
split[0];
105 const std::string& args =
split[1];
107 if(
const auto parser = mod_parsers.find(mod_type); parser != mod_parsers.end()) {
108 return std::invoke(parser->second, args);
110 ERR_DP <<
"unknown image function in path: " << mod_type;
119 : message(message_stream.str())
144 if(
auto mod = decode_modification(encoded_mod)) {
145 mods.
push(std::move(mod));
162 if(horiz_ && vert_ ) {
177 const int normalized = degrees_ >= 0 ?
178 degrees_ - 360 * (degrees_ / 360) :
179 degrees_ + 360 * (1 + (-degrees_) / 360);
181 switch ( normalized )
187 case 360:
return src;
233 :
p(
p), clr(clr),
w(
w),
h(
h)
238 add_input(inputs,
"x");
239 add_input(inputs,
"y");
240 add_input(inputs,
"u");
241 add_input(inputs,
"v");
242 add_input(inputs,
"red");
243 add_input(inputs,
"green");
244 add_input(inputs,
"blue");
245 add_input(inputs,
"alpha");
246 add_input(inputs,
"height");
247 add_input(inputs,
"width");
255 }
else if(key ==
"y") {
257 }
else if(key ==
"red") {
258 return variant(clr.r);
259 }
else if(key ==
"green") {
260 return variant(clr.g);
261 }
else if(key ==
"blue") {
262 return variant(clr.b);
263 }
else if(key ==
"alpha") {
264 return variant(clr.a);
265 }
else if(key ==
"width") {
267 }
else if(key ==
"height") {
269 }
else if(key ==
"u") {
270 return variant(
p.x /
static_cast<float>(
w));
271 }
else if(key ==
"v") {
272 return variant(
p.y /
static_cast<float>(
h));
294 if(nsurf ==
nullptr) {
295 PLAIN_LOG <<
"could not make neutral surface...";
301 uint32_t* cur = lock.
pixels();
302 uint32_t*
const end = cur + nsurf->w * src->h;
303 uint32_t*
const beg = cur;
307 pixel.a = (*cur) >> 24;
308 pixel.r = (*cur) >> 16;
309 pixel.g = (*cur) >> 8;
318 pixel.a = std::min<unsigned>(new_alpha.
evaluate(px).
as_int(), 255);
319 *cur = (pixel.a << 24) + (pixel.r << 16) + (pixel.g << 8) + pixel.b;
341 if(nsurf ==
nullptr) {
342 PLAIN_LOG <<
"could not make neutral surface...";
348 uint32_t* cur = lock.
pixels();
349 uint32_t*
const end = cur + nsurf->w * src->h;
350 uint32_t*
const beg = cur;
354 pixel.a = (*cur) >> 24;
355 pixel.r = (*cur) >> 16;
356 pixel.g = (*cur) >> 8;
366 pixel.g = std::min<unsigned>(new_green.
evaluate(px).
as_int(), 255);
367 pixel.b = std::min<unsigned>(new_blue.
evaluate(px).
as_int(), 255);
368 pixel.a = std::min<unsigned>(new_alpha.
evaluate(px).
as_int(), 255);
369 *cur = (pixel.a << 24) + (pixel.r << 16) + (pixel.g << 8) + pixel.b;
380 SDL_Rect area = slice_;
403 std::stringstream sstr;
404 sstr <<
"~BLIT(): x-coordinate '"
405 << x_ <<
"' larger than destination image's width '"
406 << src->w <<
"' no blitting performed.\n";
412 std::stringstream sstr;
413 sstr <<
"~BLIT(): y-coordinate '"
414 << y_ <<
"' larger than destination image's height '"
415 << src->h <<
"' no blitting performed.\n";
420 if(surf_->w + x_ < 0) {
421 std::stringstream sstr;
422 sstr <<
"~BLIT(): offset and width '"
423 << x_ + surf_->w <<
"' less than zero no blitting performed.\n";
428 if(surf_->h + y_ < 0) {
429 std::stringstream sstr;
430 sstr <<
"~BLIT(): offset and height '"
431 << y_ + surf_->h <<
"' less than zero no blitting performed.\n";
437 SDL_Rect r {x_, y_, 0, 0};
444 if(src->w == mask_->w && src->h == mask_->h && x_ == 0 && y_ == 0) {
448 SDL_Rect r {x_, y_, 0, 0};
449 surface new_mask(src->w, src->h);
450 sdl_blit(mask_,
nullptr, new_mask, &r);
455 if(src ==
nullptr) {
return nullptr; }
459 if(surf_->w != src->w || surf_->h != src->h) {
474 }
else if(flags_ & X_BY_FACTOR) {
475 size.x = src->w * (
static_cast<double>(
size.x) / 100);
480 }
else if(flags_ & Y_BY_FACTOR) {
481 size.y = src->h * (
static_cast<double>(
size.y) / 100);
484 if(flags_ & PRESERVE_ASPECT_RATIO) {
485 const auto ratio = std::min(
486 static_cast<long double>(
size.x) / src->w,
487 static_cast<long double>(
size.y) / src->h
491 static_cast<int>(src->w * ratio),
492 static_cast<int>(src->h * ratio)
496 if(flags_ & SCALE_SHARP) {
520 if(nsurf ==
nullptr) {
521 PLAIN_LOG <<
"could not make neutral surface...";
529 uint32_t* beg = lock.
pixels();
530 uint32_t* end = beg + nsurf->w * src->h;
533 uint8_t alpha = (*beg) >> 24;
542 *beg = (alpha << 24) + (r << 16) + (
g << 8) +
b;
554 return((r_ != 0 || g_ != 0 ||
b_ != 0)
573 SDL_FillRect(ret,
nullptr, SDL_MapRGBA(ret->format, color_.r, color_.g,
574 color_.b, color_.a));
575 sdl_blit(src,
nullptr, ret,
nullptr);
586 struct parse_mod_registration
588 parse_mod_registration(
const char* name, mod_parser parser)
590 mod_parsers[name] = parser;
603 #define REGISTER_MOD_PARSER(type, args_var) \
604 static std::unique_ptr<modification> parse_##type##_mod(std::string_view); \
605 static parse_mod_registration parse_##type##_mod_registration_aux(#type, &parse_##type##_mod); \
606 static std::unique_ptr<modification> parse_##type##_mod(std::string_view args_var) \
613 if(params.size() < 2) {
614 ERR_DP <<
"too few arguments passed to the ~TC() function";
619 const int side_n = utils::from_chars<int>(params[0]).value_or(-1);
621 ERR_DP <<
"Invalid side (" << params[0] <<
") passed to the ~TC() function";
629 ERR_DP <<
"could not load TC info for '" << params[1] <<
"' palette";
630 ERR_DP <<
"bailing out from TC";
642 ERR_DP <<
"caught config::error while processing TC: " <<
e.message;
643 ERR_DP <<
"bailing out from TC";
648 return std::make_unique<rc_modification>(rc_map);
656 if(recolor_params.size() <= 1) {
671 <<
"caught config::error while processing color-range RC: "
673 ERR_DP <<
"bailing out from RC";
677 return std::make_unique<rc_modification>(rc_map);
685 if(remap_params.size() < 2) {
686 ERR_DP <<
"not enough arguments passed to the ~PAL() function: " << args;
696 for(std::size_t
i = 0;
i < old_palette.size() &&
i < new_palette.size(); ++
i) {
697 rc_map[old_palette[
i]] = new_palette[
i];
700 return std::make_unique<rc_modification>(rc_map);
703 <<
"caught config::error while processing PAL function: "
706 <<
"bailing out from PAL";
715 bool horiz = (args.empty() || args.find(
"horiz") != std::string::npos);
716 bool vert = (args.find(
"vert") != std::string::npos);
718 return std::make_unique<fl_modification>(horiz, vert);
726 switch(slice_params.size()) {
728 return std::make_unique<rotate_modification>();
730 return std::make_unique<rotate_modification>(
731 utils::from_chars<int>(slice_params[0]).value_or(0));
733 return std::make_unique<rotate_modification>(
734 utils::from_chars<int>(slice_params[0]).value_or(0),
735 utils::from_chars<int>(slice_params[1]).value_or(0));
737 return std::make_unique<rotate_modification>(
738 utils::from_chars<int>(slice_params[0]).value_or(0),
739 utils::from_chars<int>(slice_params[1]).value_or(0),
740 utils::from_chars<int>(slice_params[2]).value_or(0));
748 return std::make_unique<gs_modification>();
754 return std::make_unique<crop_transparency_modification>();
758 bool in_range(
int val,
int min,
int max)
760 return min <= val && val <= max;
768 if(params.size() != 1) {
769 ERR_DP <<
"~BW() requires exactly one argument";
774 const auto threshold = utils::from_chars<int>(params[0]);
776 ERR_DP <<
"unsupported argument in ~BW() function";
780 if(!in_range(*threshold, 0, 255)) {
781 ERR_DP <<
"~BW() argument out of range 0 - 255";
785 return std::make_unique<bw_modification>(*threshold);
791 return std::make_unique<sepia_modification>();
799 switch(params.size()) {
803 return std::make_unique<negative_modification>(-1, -1, -1);
806 const auto threshold = utils::from_chars<int>(params[0]);
808 if(threshold && in_range(*threshold, -1, 255)) {
809 return std::make_unique<negative_modification>(*threshold, *threshold, *threshold);
811 ERR_DP <<
"unsupported argument value in ~NEG() function";
817 const auto thR = utils::from_chars<int>(params[0]);
818 const auto thG = utils::from_chars<int>(params[1]);
819 const auto thB = utils::from_chars<int>(params[2]);
821 if(thR && thG && thB && in_range(*thR, -1, 255) && in_range(*thG, -1, 255) && in_range(*thB, -1, 255)) {
822 return std::make_unique<negative_modification>(*thR, *thG, *thB);
824 ERR_DP <<
"unsupported argument value in ~NEG() function";
830 ERR_DP <<
"~NEG() requires 0, 1 or 3 arguments";
838 return std::make_unique<plot_alpha_modification>();
844 return std::make_unique<wipe_alpha_modification>();
854 if(params.size() != 1) {
855 ERR_DP <<
"~ADJUST_ALPHA() requires exactly 1 arguments";
859 return std::make_unique<adjust_alpha_modification>(params.at(0));
869 if(params.size() < 1 || params.size() > 4) {
870 ERR_DP <<
"~CHAN() requires 1 to 4 arguments";
874 return std::make_unique<adjust_channels_modification>(params);
881 const std::size_t
s = factors.size();
884 ERR_DP <<
"no arguments passed to the ~CS() function";
888 int r = 0,
g = 0,
b = 0;
890 r = utils::from_chars<int>(factors[0]).value_or(0);
893 g = utils::from_chars<int>(factors[0]).value_or(0);
896 b = utils::from_chars<int>(factors[0]).value_or(0);
899 return std::make_unique<cs_modification>(r,
g ,
b);
907 if(params.size() != 4) {
908 ERR_DP <<
"~BLEND() requires exactly 4 arguments";
912 float opacity = 0.0f;
913 const std::string_view& opacity_str = params[3];
914 const std::string_view::size_type p100_pos = opacity_str.find(
'%');
916 if(p100_pos == std::string::npos)
917 opacity = lexical_cast_default<float>(opacity_str);
920 const std::string_view parsed_field = opacity_str.substr(0, p100_pos);
921 opacity = lexical_cast_default<float>(parsed_field);
925 return std::make_unique<blend_modification>(
926 utils::from_chars<int>(params[0]).value_or(0),
927 utils::from_chars<int>(params[1]).value_or(0),
928 utils::from_chars<int>(params[2]).value_or(0),
936 const std::size_t
s = slice_params.size();
938 if(
s == 0 || (
s == 1 && slice_params[0].empty())) {
939 ERR_DP <<
"no arguments passed to the ~CROP() function";
943 SDL_Rect slice_rect { 0, 0, 0, 0 };
945 slice_rect.x = utils::from_chars<int16_t>(slice_params[0]).value_or(0);
948 slice_rect.y = utils::from_chars<int16_t>(slice_params[1]).value_or(0);
951 slice_rect.w = utils::from_chars<uint16_t>(slice_params[2]).value_or(0);
954 slice_rect.h = utils::from_chars<uint16_t>(slice_params[3]).value_or(0);
957 return std::make_unique<crop_modification>(slice_rect);
960 static bool check_image(
const image::locator& img, std::stringstream & message)
972 const std::size_t
s = param.size();
974 if(
s == 0 || (
s == 1 && param[0].empty())){
975 ERR_DP <<
"no arguments passed to the ~BLIT() function";
980 ERR_DP <<
"too many arguments passed to the ~BLIT() function";
987 x = utils::from_chars<int>(param[1]).value_or(0);
988 y = utils::from_chars<int>(param[2]).value_or(0);
994 if(!check_image(img, message))
998 return std::make_unique<blit_modification>(surf, x, y);
1005 const std::size_t
s = param.size();
1007 if(
s == 0 || (
s == 1 && param[0].empty())){
1008 ERR_DP <<
"no arguments passed to the ~MASK() function";
1015 x = utils::from_chars<int>(param[1]).value_or(0);
1016 y = utils::from_chars<int>(param[2]).value_or(0);
1019 if(x < 0 || y < 0) {
1020 ERR_DP <<
"negative position arguments in ~MASK() function";
1027 if(!check_image(img, message))
1031 return std::make_unique<mask_modification>(surf, x, y);
1038 ERR_DP <<
"no arguments passed to the ~L() function";
1043 return std::make_unique<light_modification>(surf);
1048 std::pair<int, bool> parse_scale_value(std::string_view arg)
1050 if(
const std::size_t pos = arg.rfind(
'%'); pos != std::string_view::npos) {
1051 return { utils::from_chars<int>(arg.substr(0, pos)).value_or(0),
true };
1053 return { utils::from_chars<int>(arg).value_or(0),
false };
1058 std::optional<std::pair<point, uint8_t>> parse_scale_args(std::string_view args)
1061 const std::size_t num_args = scale_params.size();
1063 if(num_args == 0 || (num_args == 1 && scale_params[0].empty())) {
1064 return std::nullopt;
1068 std::array<int, 2> parsed_sizes{0,0};
1070 for(
unsigned i = 0; i < std::min<unsigned>(2, num_args); ++
i) {
1071 const auto& [
size, relative] = parse_scale_value(scale_params[
i]);
1074 ERR_DP <<
"Negative size passed to scaling IPF. Original image dimension will be used instead";
1078 parsed_sizes[
i] =
size;
1085 return std::pair{
point{parsed_sizes[0], parsed_sizes[1]}, flags};
1093 if(
auto params = parse_scale_args(args)) {
1095 return std::make_unique<scale_modification>(params->first, mode | params->second);
1097 ERR_DP <<
"no arguments passed to the ~SCALE() function";
1104 if(
auto params = parse_scale_args(args)) {
1106 return std::make_unique<scale_modification>(params->first, mode | params->second);
1108 ERR_DP <<
"no arguments passed to the ~SCALE_SHARP() function";
1115 if(
auto params = parse_scale_args(args)) {
1117 return std::make_unique<scale_modification>(params->first, mode | params->second);
1119 ERR_DP <<
"no arguments passed to the ~SCALE_INTO() function";
1126 if(
auto params = parse_scale_args(args)) {
1128 return std::make_unique<scale_modification>(params->first, mode | params->second);
1130 ERR_DP <<
"no arguments passed to the ~SCALE_INTO_SHARP() function";
1138 int z = utils::from_chars<int>(args).value_or(0);
1139 if(z < 1 || z > 5) {
1143 return std::make_unique<xbrz_modification>(z);
1149 const int depth = std::max<int>(0, utils::from_chars<int>(args).value_or(0));
1150 return std::make_unique<bl_modification>(depth);
1156 const std::string::size_type p100_pos = args.find(
'%');
1158 if(p100_pos == std::string::npos) {
1159 num = lexical_cast_default<float, std::string_view>(args);
1162 const std::string_view parsed_field = args.substr(0, p100_pos);
1163 num = lexical_cast_default<float, std::string_view>(parsed_field);
1167 return std::make_unique<o_modification>(num);
1177 const int r = utils::from_chars<int>(args).value_or(0);
1178 return std::make_unique<cs_modification>(r, 0, 0);
1184 const int g = utils::from_chars<int>(args).value_or(0);
1185 return std::make_unique<cs_modification>(0,
g, 0);
1191 const int b = utils::from_chars<int>(args).value_or(0);
1192 return std::make_unique<cs_modification>(0, 0,
b);
1216 int c[4] { 0, 0, 0, SDL_ALPHA_OPAQUE };
1219 for(
int i = 0; i < std::min<int>(factors.size(), 4); ++
i) {
1220 c[
i] = utils::from_chars<int>(factors[
i]).value_or(0);
1223 return std::make_unique<background_modification>(
color_t(
c[0],
c[1],
c[2],
c[3]));
1232 if(params.size() != 3 && params.size() != 4) {
1233 ERR_DP <<
"incorrect number of arguments in ~SWAP() function, they must be 3 or 4";
1237 channel redValue, greenValue, blueValue, alphaValue;
1239 if(params[0] ==
"red") {
1241 }
else if(params[0] ==
"green") {
1243 }
else if(params[0] ==
"blue") {
1245 }
else if(params[0] ==
"alpha") {
1248 ERR_DP <<
"unsupported argument value in ~SWAP() function: " << params[0];
1253 if(params[1] ==
"red") {
1255 }
else if(params[1] ==
"green") {
1257 }
else if(params[1] ==
"blue") {
1259 }
else if(params[1] ==
"alpha") {
1262 ERR_DP <<
"unsupported argument value in ~SWAP() function: " << params[0];
1266 if(params[2] ==
"red") {
1268 }
else if(params[2] ==
"green") {
1270 }
else if(params[2] ==
"blue") {
1272 }
else if(params[2] ==
"alpha") {
1275 ERR_DP <<
"unsupported argument value in ~SWAP() function: " << params[0];
1281 if(params.size() == 3) {
1284 if(params[3] ==
"red") {
1286 }
else if(params[3] ==
"green") {
1288 }
else if(params[3] ==
"blue") {
1290 }
else if(params[3] ==
"alpha") {
1293 ERR_DP <<
"unsupported argument value in ~SWAP() function: " << params[3];
1298 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 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.
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 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 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 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.
void store() const noexcept
Stores a copy the current exception to be rethrown.
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(std::string_view name)
const color_range & color_info(std::string_view 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_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
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 get_non_transparent_portion(const surface &surf)
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)