1 | // Aseprite Document Library |
2 | // Copyright (C) 2018-2021 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_ALGO_H_INCLUDED |
9 | #define DOC_ALGO_H_INCLUDED |
10 | #pragma once |
11 | |
12 | #include "gfx/fwd.h" |
13 | #include "doc/algorithm/hline.h" |
14 | |
15 | namespace doc { |
16 | |
17 | class Image; |
18 | |
19 | typedef void (*AlgoPixel)(int x, int y, void *data); |
20 | typedef void (*AlgoLine)(int x1, int y1, int x2, int y2, void *data); |
21 | typedef void (*AlgoLineWithAlgoPixel)(int x1, int y1, int x2, int y2, void *data, AlgoPixel proc); |
22 | |
23 | // Useful to create lines with more predictable behavior and perfect |
24 | // pixel block of lines where we'll have a number of lines/rows that |
25 | // looks the same. |
26 | // |
27 | // Related to: https://github.com/aseprite/aseprite/issues/1395 |
28 | void algo_line_perfect(int x1, int y1, int x2, int y2, void* data, AlgoPixel proc); |
29 | void algo_line_perfect_with_fix_for_line_brush(int x1, int y1, int x2, int y2, void *data, AlgoPixel proc); |
30 | |
31 | // Useful to create continuous lines (you can draw from one point to |
32 | // another, and continue from that point to another in the same |
33 | // angle and the line will look continous). |
34 | // |
35 | // Related to: |
36 | // https://community.aseprite.org/t/1045 |
37 | // https://github.com/aseprite/aseprite/issues/1894 |
38 | void algo_line_continuous(int x1, int y1, int x2, int y2, void *data, AlgoPixel proc); |
39 | void algo_line_continuous_with_fix_for_line_brush(int x1, int y1, int x2, int y2, void *data, AlgoPixel proc); |
40 | |
41 | void algo_ellipse(int x1, int y1, int x2, int y2, int hPixels, int vPixels, void *data, AlgoPixel proc); |
42 | void algo_ellipsefill(int x1, int y1, int x2, int y2, int hPixels, int vPixels, void *data, AlgoHLine proc); |
43 | |
44 | void draw_rotated_ellipse(int cx, int cy, int a, int b, double angle, void* data, AlgoPixel proc); |
45 | void fill_rotated_ellipse(int cx, int cy, int a, int b, double angle, void* data, AlgoHLine proc); |
46 | |
47 | void algo_spline(double x0, double y0, double x1, double y1, |
48 | double x2, double y2, double x3, double y3, |
49 | void *data, AlgoLine proc); |
50 | double algo_spline_get_y(double x0, double y0, double x1, double y1, |
51 | double x2, double y2, double x3, double y3, |
52 | double x); |
53 | double algo_spline_get_tan(double x0, double y0, double x1, double y1, |
54 | double x2, double y2, double x3, double y3, |
55 | double in_x); |
56 | |
57 | } // namespace doc |
58 | |
59 | #endif |
60 | |