]> granicus.if.org Git - libass/blob - libass/ass_outline.h
86c6b3e549bcde94b23c1e2b4230ebef16d4d6d5
[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 #define EFFICIENT_CONTOUR_COUNT 8
36
37 bool outline_alloc(ASS_Outline *outline, size_t n_points, size_t n_contours);
38 ASS_Outline *outline_create(size_t n_points, size_t n_contours);
39 ASS_Outline *outline_convert(const FT_Outline *source);
40 ASS_Outline *outline_copy(const ASS_Outline *source);
41 void outline_free(ASS_Outline *outline);
42
43 bool outline_add_point(ASS_Outline *outline, FT_Vector pt, char tag);
44 bool outline_close_contour(ASS_Outline *outline);
45
46 void outline_translate(const ASS_Outline *outline, FT_Pos dx, FT_Pos dy);
47 void outline_transform(const ASS_Outline *outline, const FT_Matrix *matrix);
48 void outline_get_cbox(const ASS_Outline *outline, FT_BBox *cbox);
49
50 bool outline_stroke(ASS_Outline *result, ASS_Outline *result1,
51                     const ASS_Outline *path, int xbord, int ybord, int eps);
52
53
54 #endif /* LIBASS_OUTLINE_H */