annotate libass/ass_drawing.h @ 34116:5f7c090e5ae8

Support H264 from QNAP Systems.
author cehoyos
date Sat, 15 Oct 2011 16:33:05 +0000
parents ac6e48baa03d
children 6e7f60f6f9d4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
1 /*
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
2 * Copyright (C) 2009 Grigori Goronzy <greg@geekmind.org>
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
3 *
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
4 * This file is part of libass.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
5 *
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
6 * Permission to use, copy, modify, and distribute this software for any
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
7 * purpose with or without fee is hereby granted, provided that the above
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
8 * copyright notice and this permission notice appear in all copies.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
9 *
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
17 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
18
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
19 #ifndef LIBASS_DRAWING_H
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
20 #define LIBASS_DRAWING_H
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
21
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
22 #include <ft2build.h>
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
23 #include FT_GLYPH_H
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
24
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
25 #include "ass.h"
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
26
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
27 #define DRAWING_INITIAL_SIZE 256
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
28
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
29 typedef enum {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
30 TOKEN_MOVE,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
31 TOKEN_MOVE_NC,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
32 TOKEN_LINE,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
33 TOKEN_CUBIC_BEZIER,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
34 TOKEN_CONIC_BEZIER,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
35 TOKEN_B_SPLINE,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
36 TOKEN_EXTEND_SPLINE,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
37 TOKEN_CLOSE
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
38 } ASS_TokenType;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
39
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
40 typedef struct ass_drawing_token {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
41 ASS_TokenType type;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
42 FT_Vector point;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
43 struct ass_drawing_token *next;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
44 struct ass_drawing_token *prev;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
45 } ASS_DrawingToken;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
46
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
47 typedef struct {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
48 char *text; // drawing string
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
49 int i; // text index
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
50 int scale; // scale (1-64) for subpixel accuracy
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
51 double pbo; // drawing will be shifted in y direction by this amount
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
52 double scale_x; // FontScaleX
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
53 double scale_y; // FontScaleY
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
54 int asc; // ascender
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
55 int desc; // descender
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
56 FT_OutlineGlyph glyph; // the "fake" glyph created for later rendering
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
57 int hash; // hash value (for caching)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
58
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
59 // private
31875
ac6e48baa03d Import libass 0.9.11
greg
parents: 31853
diff changeset
60 FT_Library ftlibrary; // needed for font ops
ac6e48baa03d Import libass 0.9.11
greg
parents: 31853
diff changeset
61 ASS_Font *font; // dito
ac6e48baa03d Import libass 0.9.11
greg
parents: 31853
diff changeset
62 void *fontconfig_priv; // dito
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
63 ASS_Library *library;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
64 int size; // current buffer size
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
65 ASS_DrawingToken *tokens; // tokenized drawing
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
66 int max_points; // current maximum size
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
67 int max_contours;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
68 double point_scale_x;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
69 double point_scale_y;
31853
e64df5862cea Import libass 0.9.10
greg
parents: 30200
diff changeset
70 FT_BBox cbox; // bounding box, or let's say... VSFilter's idea of it
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
71 } ASS_Drawing;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
72
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
73 ASS_Drawing *ass_drawing_new(void *fontconfig_priv, ASS_Font *font,
31875
ac6e48baa03d Import libass 0.9.11
greg
parents: 31853
diff changeset
74 FT_Library lib);
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
75 void ass_drawing_free(ASS_Drawing* drawing);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
76 void ass_drawing_add_char(ASS_Drawing* drawing, char symbol);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
77 void ass_drawing_hash(ASS_Drawing* drawing);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
78 FT_OutlineGlyph *ass_drawing_parse(ASS_Drawing *drawing, int raw_mode);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
79
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
80 #endif /* LIBASS_DRAWING_H */