annotate libass/ass_drawing.h @ 36984:3f3a415d605b

Move most of TranslateFilename() back to the renderer files. Although it would be nice to share the code (which was the reason for r34263), most of it really doesn't belong to string.c.
author ib
date Thu, 27 Mar 2014 01:49:01 +0000
parents 6e7f60f6f9d4
children
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>
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 31875
diff changeset
23 #include FT_OUTLINE_H
30200
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
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 31875
diff changeset
56 FT_Outline outline; // target outline
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 31875
diff changeset
57 FT_Vector advance; // advance (from cbox)
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
58 int hash; // hash value (for caching)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
59
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
60 // private
31875
ac6e48baa03d Import libass 0.9.11
greg
parents: 31853
diff changeset
61 FT_Library ftlibrary; // needed for font ops
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
62 ASS_Library *library;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
63 int size; // current buffer size
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
64 ASS_DrawingToken *tokens; // tokenized drawing
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
65 int max_points; // current maximum size
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
66 int max_contours;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
67 double point_scale_x;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
68 double point_scale_y;
31853
e64df5862cea Import libass 0.9.10
greg
parents: 30200
diff changeset
69 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
70 } ASS_Drawing;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
71
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 31875
diff changeset
72 ASS_Drawing *ass_drawing_new(ASS_Library *lib, FT_Library ftlib);
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
73 void ass_drawing_free(ASS_Drawing* drawing);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
74 void ass_drawing_add_char(ASS_Drawing* drawing, char symbol);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
75 void ass_drawing_hash(ASS_Drawing* drawing);
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 31875
diff changeset
76 FT_Outline *ass_drawing_parse(ASS_Drawing *drawing, int raw_mode);
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
77
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
78 #endif /* LIBASS_DRAWING_H */