summaryrefslogtreecommitdiffstats
path: root/libass/ass_outline.h
blob: 86c6b3e549bcde94b23c1e2b4230ebef16d4d6d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * Copyright (C) 2016 Vabishchevich Nikolay <vabnick@gmail.com>
 *
 * This file is part of libass.
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef LIBASS_OUTLINE_H
#define LIBASS_OUTLINE_H

#include <ft2build.h>
#include FT_OUTLINE_H
#include <stdbool.h>


typedef struct ass_outline {
    size_t n_contours, max_contours;
    size_t *contours;
    size_t n_points, max_points;
    FT_Vector *points;
    char *tags;
} ASS_Outline;

#define EFFICIENT_CONTOUR_COUNT 8

bool outline_alloc(ASS_Outline *outline, size_t n_points, size_t n_contours);
ASS_Outline *outline_create(size_t n_points, size_t n_contours);
ASS_Outline *outline_convert(const FT_Outline *source);
ASS_Outline *outline_copy(const ASS_Outline *source);
void outline_free(ASS_Outline *outline);

bool outline_add_point(ASS_Outline *outline, FT_Vector pt, char tag);
bool outline_close_contour(ASS_Outline *outline);

void outline_translate(const ASS_Outline *outline, FT_Pos dx, FT_Pos dy);
void outline_transform(const ASS_Outline *outline, const FT_Matrix *matrix);
void outline_get_cbox(const ASS_Outline *outline, FT_BBox *cbox);

bool outline_stroke(ASS_Outline *result, ASS_Outline *result1,
                    const ASS_Outline *path, int xbord, int ybord, int eps);


#endif /* LIBASS_OUTLINE_H */