1 | // Aseprite Render Library |
2 | // Copyright (c) 2019-2020 Igara Studio S.A. |
3 | // Copyright (c) 2017 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 RENDER_GRADIENT_H_INCLUDED |
9 | #define RENDER_GRADIENT_H_INCLUDED |
10 | #pragma once |
11 | |
12 | #include "doc/brush.h" |
13 | #include "doc/color.h" |
14 | #include "gfx/point.h" |
15 | |
16 | namespace doc { |
17 | class Image; |
18 | } |
19 | |
20 | namespace render { |
21 | |
22 | class DitheringMatrix; |
23 | |
24 | enum class GradientType { |
25 | Linear, |
26 | Radial, |
27 | }; |
28 | |
29 | void render_rgba_gradient( |
30 | doc::Image* img, |
31 | const gfx::Point imgPos, |
32 | const gfx::Point p0, |
33 | const gfx::Point p1, |
34 | doc::color_t c0, |
35 | doc::color_t c1, |
36 | const render::DitheringMatrix& matrix, |
37 | const GradientType type); |
38 | |
39 | void render_rgba_linear_gradient( |
40 | doc::Image* img, |
41 | const gfx::Point imgPos, |
42 | const gfx::Point p0, |
43 | const gfx::Point p1, |
44 | doc::color_t c0, |
45 | doc::color_t c1, |
46 | const render::DitheringMatrix& matrix); |
47 | |
48 | void render_rgba_radial_gradient( |
49 | doc::Image* img, |
50 | const gfx::Point imgPos, |
51 | const gfx::Point p0, |
52 | const gfx::Point p1, |
53 | doc::color_t c0, |
54 | doc::color_t c1, |
55 | const render::DitheringMatrix& matrix); |
56 | |
57 | void convert_bitmap_brush_to_dithering_brush( |
58 | doc::Brush* brush, |
59 | const doc::PixelFormat pixelFormat, |
60 | const render::DitheringMatrix& matrix, |
61 | const float f, |
62 | const doc::color_t c0, |
63 | const doc::color_t c1); |
64 | |
65 | } // namespace render |
66 | |
67 | #endif |
68 | |