2014-10-21 09:21:31 +08:00
|
|
|
// Aseprite Document Library
|
2019-08-14 05:16:30 +08:00
|
|
|
// Copyright (c) 2019 Igara Studio S.A.
|
2018-05-25 01:21:00 +08:00
|
|
|
// Copyright (c) 2001-2018 David Capello
|
2014-10-21 09:21:31 +08:00
|
|
|
//
|
|
|
|
// This file is released under the terms of the MIT license.
|
|
|
|
// Read LICENSE.txt for more information.
|
|
|
|
|
|
|
|
#ifndef DOC_ALGORITHM_RESIZE_IMAGE_H_INCLUDED
|
|
|
|
#define DOC_ALGORITHM_RESIZE_IMAGE_H_INCLUDED
|
2014-03-30 06:40:17 +08:00
|
|
|
#pragma once
|
2013-11-10 06:59:05 +08:00
|
|
|
|
2015-07-02 08:33:30 +08:00
|
|
|
#include "doc/color.h"
|
2013-11-10 06:59:05 +08:00
|
|
|
#include "gfx/fwd.h"
|
|
|
|
|
2014-10-21 09:21:31 +08:00
|
|
|
namespace doc {
|
2013-11-10 06:59:05 +08:00
|
|
|
class Image;
|
|
|
|
class Palette;
|
|
|
|
class RgbMap;
|
2024-12-17 01:52:19 +08:00
|
|
|
|
2013-11-10 06:59:05 +08:00
|
|
|
namespace algorithm {
|
2024-12-17 01:52:19 +08:00
|
|
|
|
2013-11-10 06:59:05 +08:00
|
|
|
enum ResizeMethod {
|
|
|
|
RESIZE_METHOD_NEAREST_NEIGHBOR,
|
|
|
|
RESIZE_METHOD_BILINEAR,
|
2016-03-23 04:02:41 +08:00
|
|
|
RESIZE_METHOD_ROTSPRITE,
|
2013-11-10 06:59:05 +08:00
|
|
|
};
|
2024-12-17 01:52:19 +08:00
|
|
|
|
2013-11-10 06:59:05 +08:00
|
|
|
// Resizes the source image 'src' to the destination image 'dst'.
|
|
|
|
//
|
|
|
|
// Warning: If you are using the RESIZE_METHOD_BILINEAR, it is
|
|
|
|
// recommended to use 'fixup_image_transparent_colors' function
|
|
|
|
// over the source image 'src' BEFORE using this routine.
|
2019-08-14 05:16:30 +08:00
|
|
|
void resize_image(const Image* src,
|
|
|
|
Image* dst,
|
|
|
|
const ResizeMethod method,
|
|
|
|
const Palette* palette,
|
|
|
|
const RgbMap* rgbmap,
|
|
|
|
const color_t maskColor);
|
2024-12-17 01:52:19 +08:00
|
|
|
|
2013-11-10 06:59:05 +08:00
|
|
|
// It does not modify the image to the human eye, but internally
|
2018-05-25 01:21:00 +08:00
|
|
|
// tries to fixup all colors that are completely transparent
|
2013-11-10 06:59:05 +08:00
|
|
|
// (alpha = 0) with the average of its 4-neighbors. Useful if you
|
|
|
|
// want to use resize_image() with images that contains
|
|
|
|
// transparent pixels.
|
2025-03-07 22:52:00 +08:00
|
|
|
void fixup_image_transparent_colors(Image* image, bool skip_for_nearest_neighbor);
|
2024-12-17 01:52:19 +08:00
|
|
|
|
2013-11-10 06:59:05 +08:00
|
|
|
} // namespace algorithm
|
|
|
|
} // namespace doc
|
|
|
|
|
|
|
|
#endif
|