1 | // Aseprite Document Library |
2 | // Copyright (c) 2019 Igara Studio S.A. |
3 | // Copyright (c) 2001-2018 David Capello |
4 | // |
5 | // This file is released under the terms of the MIT license. |
6 | // Read LICENSE.txt for more information. |
7 | |
8 | #ifndef DOC_ALGORITHM_RESIZE_IMAGE_H_INCLUDED |
9 | #define DOC_ALGORITHM_RESIZE_IMAGE_H_INCLUDED |
10 | #pragma once |
11 | |
12 | #include "doc/color.h" |
13 | #include "gfx/fwd.h" |
14 | |
15 | namespace doc { |
16 | class Image; |
17 | class Palette; |
18 | class RgbMap; |
19 | |
20 | namespace algorithm { |
21 | |
22 | enum ResizeMethod { |
23 | RESIZE_METHOD_NEAREST_NEIGHBOR, |
24 | RESIZE_METHOD_BILINEAR, |
25 | RESIZE_METHOD_ROTSPRITE, |
26 | }; |
27 | |
28 | // Resizes the source image 'src' to the destination image 'dst'. |
29 | // |
30 | // Warning: If you are using the RESIZE_METHOD_BILINEAR, it is |
31 | // recommended to use 'fixup_image_transparent_colors' function |
32 | // over the source image 'src' BEFORE using this routine. |
33 | void resize_image(const Image* src, |
34 | Image* dst, |
35 | const ResizeMethod method, |
36 | const Palette* palette, |
37 | const RgbMap* rgbmap, |
38 | const color_t maskColor); |
39 | |
40 | // It does not modify the image to the human eye, but internally |
41 | // tries to fixup all colors that are completely transparent |
42 | // (alpha = 0) with the average of its 4-neighbors. Useful if you |
43 | // want to use resize_image() with images that contains |
44 | // transparent pixels. |
45 | void fixup_image_transparent_colors(Image* image); |
46 | |
47 | } |
48 | } |
49 | |
50 | #endif |
51 | |