2014-10-21 01:21:31 +00:00
|
|
|
// Aseprite Document Library
|
2021-06-11 17:22:19 +00:00
|
|
|
// Copyright (c) 2018-2021 Igara Studio S.A.
|
2016-07-01 21:42:10 +00:00
|
|
|
// Copyright (c) 2001-2016 David Capello
|
2014-10-21 01:21:31 +00:00
|
|
|
//
|
|
|
|
// This file is released under the terms of the MIT license.
|
|
|
|
// Read LICENSE.txt for more information.
|
|
|
|
|
|
|
|
#ifndef DOC_PRIMITIVES_H_INCLUDED
|
|
|
|
#define DOC_PRIMITIVES_H_INCLUDED
|
2014-03-29 22:40:17 +00:00
|
|
|
#pragma once
|
2013-11-09 22:59:05 +00:00
|
|
|
|
2019-10-02 15:55:09 +00:00
|
|
|
#include "base/ints.h"
|
2014-10-21 01:21:31 +00:00
|
|
|
#include "doc/color.h"
|
|
|
|
#include "doc/image_buffer.h"
|
2014-12-08 17:57:56 +00:00
|
|
|
#include "gfx/fwd.h"
|
2013-11-09 22:59:05 +00:00
|
|
|
|
2014-10-21 01:21:31 +00:00
|
|
|
namespace doc {
|
2014-06-14 18:09:43 +00:00
|
|
|
class Brush;
|
2013-11-09 22:59:05 +00:00
|
|
|
class Image;
|
|
|
|
class Palette;
|
2015-07-06 19:15:54 +00:00
|
|
|
class Remap;
|
2013-11-09 22:59:05 +00:00
|
|
|
|
|
|
|
color_t get_pixel(const Image* image, int x, int y);
|
|
|
|
void put_pixel(Image* image, int x, int y, color_t c);
|
|
|
|
|
|
|
|
void clear_image(Image* image, color_t bg);
|
|
|
|
|
2014-12-28 14:06:11 +00:00
|
|
|
void copy_image(Image* dst, const Image* src);
|
2013-11-09 22:59:05 +00:00
|
|
|
void copy_image(Image* dst, const Image* src, int x, int y);
|
2013-11-10 16:26:48 +00:00
|
|
|
Image* crop_image(const Image* image, int x, int y, int w, int h, color_t bg, const ImageBufferPtr& buffer = ImageBufferPtr());
|
2016-07-01 21:42:10 +00:00
|
|
|
Image* crop_image(const Image* image, const gfx::Rect& bounds, color_t bg, const ImageBufferPtr& buffer = ImageBufferPtr());
|
2013-11-09 22:59:05 +00:00
|
|
|
void rotate_image(const Image* src, Image* dst, int angle);
|
|
|
|
|
|
|
|
void draw_hline(Image* image, int x1, int y, int x2, color_t c);
|
|
|
|
void draw_vline(Image* image, int x, int y1, int y2, color_t c);
|
|
|
|
void draw_rect(Image* image, int x1, int y1, int x2, int y2, color_t c);
|
|
|
|
void fill_rect(Image* image, int x1, int y1, int x2, int y2, color_t c);
|
2014-12-08 17:57:56 +00:00
|
|
|
void fill_rect(Image* image, const gfx::Rect& rc, color_t c);
|
2013-11-09 22:59:05 +00:00
|
|
|
void blend_rect(Image* image, int x1, int y1, int x2, int y2, color_t c, int opacity);
|
|
|
|
void draw_line(Image* image, int x1, int y1, int x2, int y2, color_t c);
|
2021-06-11 17:22:19 +00:00
|
|
|
void draw_ellipse(Image* image, int x1, int y1, int x2, int y2, int extraXPxs, int extraYPxs, color_t color);
|
|
|
|
void fill_ellipse(Image* image, int x1, int y1, int x2, int y2, int extraXPxs, int extraYPxs, color_t color);
|
2013-11-09 22:59:05 +00:00
|
|
|
|
2018-11-07 19:56:32 +00:00
|
|
|
bool is_plain_image(const Image* img, color_t c);
|
|
|
|
bool is_empty_image(const Image* img);
|
|
|
|
|
2013-11-09 22:59:05 +00:00
|
|
|
int count_diff_between_images(const Image* i1, const Image* i2);
|
2018-11-13 15:52:51 +00:00
|
|
|
bool is_same_image(const Image* i1, const Image* i2);
|
2013-11-09 22:59:05 +00:00
|
|
|
|
2015-07-06 19:15:54 +00:00
|
|
|
void remap_image(Image* image, const Remap& remap);
|
|
|
|
|
2019-10-02 15:55:09 +00:00
|
|
|
uint32_t calculate_image_hash(const Image* image,
|
|
|
|
const gfx::Rect& bounds);
|
|
|
|
|
2014-10-21 01:21:31 +00:00
|
|
|
} // namespace doc
|
2013-11-09 22:59:05 +00:00
|
|
|
|
|
|
|
#endif
|