]> granicus.if.org Git - libass/blob - libass/ass_drawing.h
drawing: remove unnecessary fields from ASS_Drawing struct
[libass] / libass / ass_drawing.h
1 /*
2  * Copyright (C) 2009 Grigori Goronzy <greg@geekmind.org>
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_DRAWING_H
20 #define LIBASS_DRAWING_H
21
22 #include "ass.h"
23 #include "ass_outline.h"
24 #include "ass_bitmap.h"
25
26 typedef enum {
27     TOKEN_MOVE,
28     TOKEN_MOVE_NC,
29     TOKEN_LINE,
30     TOKEN_CUBIC_BEZIER,
31     TOKEN_CONIC_BEZIER,
32     TOKEN_B_SPLINE,
33     TOKEN_EXTEND_SPLINE,
34     TOKEN_CLOSE
35 } ASS_TokenType;
36
37 typedef struct ass_drawing_token {
38     ASS_TokenType type;
39     ASS_Vector point;
40     struct ass_drawing_token *next;
41     struct ass_drawing_token *prev;
42 } ASS_DrawingToken;
43
44 typedef struct {
45     char *text; // drawing string
46     int scale;  // scale (1-64) for subpixel accuracy
47     double pbo; // drawing will be shifted in y direction by this amount
48     double scale_x;      // FontScaleX
49     double scale_y;      // FontScaleY
50     int asc;             // ascender
51     int desc;            // descender
52     ASS_Outline outline; // target outline
53     ASS_Vector advance;  // advance (from cbox)
54
55     // private
56     ASS_Library *library;
57     double point_scale_x;
58     double point_scale_y;
59     ASS_Rect cbox;   // bounding box, or let's say... VSFilter's idea of it
60 } ASS_Drawing;
61
62 ASS_Drawing *ass_drawing_new(ASS_Library *lib);
63 void ass_drawing_free(ASS_Drawing *drawing);
64 void ass_drawing_set_text(ASS_Drawing *drawing, char *str, size_t n);
65 ASS_Outline *ass_drawing_parse(ASS_Drawing *drawing, bool raw_mode);
66
67 #endif /* LIBASS_DRAWING_H */