]> granicus.if.org Git - libass/blob - libass/ass_outline.h
9f3802034809fd9512bcd15ae5e6fbc07acf5cb9
[libass] / libass / ass_outline.h
1 /*
2  * Copyright (C) 2016 Vabishchevich Nikolay <vabnick@gmail.com>
3  *
4  * This file is part of libass.
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18
19 #ifndef LIBASS_OUTLINE_H
20 #define LIBASS_OUTLINE_H
21
22 #include <ft2build.h>
23 #include FT_OUTLINE_H
24 #include <stdbool.h>
25
26
27 typedef struct ass_outline {
28     size_t n_contours, max_contours;
29     size_t *contours;
30     size_t n_points, max_points;
31     FT_Vector *points;
32     char *tags;
33 } ASS_Outline;
34
35 bool outline_alloc(ASS_Outline *outline, size_t n_points, size_t n_contours);
36 ASS_Outline *outline_create(size_t n_points, size_t n_contours);
37 ASS_Outline *outline_convert(const FT_Outline *source);
38 ASS_Outline *outline_copy(const ASS_Outline *source);
39 void outline_free(ASS_Outline *outline);
40
41 bool outline_add_point(ASS_Outline *outline, FT_Vector pt, char tag);
42 bool outline_close_contour(ASS_Outline *outline);
43
44 void outline_translate(const ASS_Outline *outline, FT_Pos dx, FT_Pos dy);
45 void outline_transform(const ASS_Outline *outline, const FT_Matrix *matrix);
46 void outline_get_cbox(const ASS_Outline *outline, FT_BBox *cbox);
47
48 bool outline_stroke(ASS_Outline *result, ASS_Outline *result1,
49                     const ASS_Outline *path, int xbord, int ybord, int eps);
50
51
52 #endif /* LIBASS_OUTLINE_H */