1// Aseprite
2// Copyright (C) 2019 Igara Studio S.A.
3// Copyright (C) 2001-2015 David Capello
4//
5// This program is distributed under the terms of
6// the End-User License Agreement for Aseprite.
7
8#ifndef APP_UTIL_AUTOCROP_H_INCLUDED
9#define APP_UTIL_AUTOCROP_H_INCLUDED
10#pragma once
11
12#include "doc/color.h"
13#include "gfx/rect.h"
14
15namespace doc {
16 class Image;
17 class Sprite;
18}
19
20namespace app {
21
22 bool get_shrink_rect(int* x1, int* y1, int* x2, int* y2,
23 doc::Image *image, doc::color_t refpixel);
24 bool get_shrink_rect2(int* x1, int* y1, int* x2, int* y2,
25 doc::Image* image, doc::Image* regimage);
26
27 // Returns false if a refColor cannot be automatically decided (so
28 // in this case we should ask to the user to select a specific
29 // "refColor" to trim).
30 bool get_best_refcolor_for_trimming(
31 doc::Image* image,
32 doc::color_t& refColor);
33
34 gfx::Rect get_trimmed_bounds(
35 const doc::Sprite* sprite,
36 const bool byGrid);
37
38} // namespace app
39
40#endif
41