comparison libass/ass_render.h @ 34295:6e7f60f6f9d4

Update libass to 0.10 release. Patch by [subjunk gmail com], see bug #2008.
author reimar
date Sat, 03 Dec 2011 21:35:56 +0000
parents 88eebbbbd6a0
children 49fc594fda43
comparison
equal deleted inserted replaced
34294:d30ea496ed2a 34295:6e7f60f6f9d4
25 #include FT_FREETYPE_H 25 #include FT_FREETYPE_H
26 #include FT_STROKER_H 26 #include FT_STROKER_H
27 #include FT_GLYPH_H 27 #include FT_GLYPH_H
28 #include FT_SYNTHESIS_H 28 #include FT_SYNTHESIS_H
29 29
30 // XXX: fix the inclusion mess so we can avoid doing this here
31 typedef struct ass_shaper ASS_Shaper;
32
30 #include "ass.h" 33 #include "ass.h"
31 #include "ass_font.h" 34 #include "ass_font.h"
32 #include "ass_bitmap.h" 35 #include "ass_bitmap.h"
33 #include "ass_cache.h" 36 #include "ass_cache.h"
34 #include "ass_utils.h" 37 #include "ass_utils.h"
71 int use_margins; // 0 - place all subtitles inside original frame 74 int use_margins; // 0 - place all subtitles inside original frame
72 // 1 - use margins for placing toptitles and subtitles 75 // 1 - use margins for placing toptitles and subtitles
73 double aspect; // frame aspect ratio, d_width / d_height. 76 double aspect; // frame aspect ratio, d_width / d_height.
74 double storage_aspect; // pixel ratio of the source image 77 double storage_aspect; // pixel ratio of the source image
75 ASS_Hinting hinting; 78 ASS_Hinting hinting;
79 ASS_ShapingLevel shaper;
76 80
77 char *default_font; 81 char *default_font;
78 char *default_family; 82 char *default_family;
79 } ASS_Settings; 83 } ASS_Settings;
80 84
94 EF_KARAOKE_KO 98 EF_KARAOKE_KO
95 } Effect; 99 } Effect;
96 100
97 // describes a glyph 101 // describes a glyph
98 // GlyphInfo and TextInfo are used for text centering and word-wrapping operations 102 // GlyphInfo and TextInfo are used for text centering and word-wrapping operations
99 typedef struct { 103 typedef struct glyph_info {
100 unsigned symbol; 104 unsigned symbol;
101 unsigned skip; // skip glyph when layouting text 105 unsigned skip; // skip glyph when layouting text
102 FT_Glyph glyph; 106 ASS_Font *font;
103 FT_Glyph outline_glyph; 107 int face_index;
108 int glyph_index;
109 double font_size;
110 ASS_Drawing *drawing;
111 FT_Outline *outline;
112 FT_Outline *border;
104 Bitmap *bm; // glyph bitmap 113 Bitmap *bm; // glyph bitmap
105 Bitmap *bm_o; // outline bitmap 114 Bitmap *bm_o; // outline bitmap
106 Bitmap *bm_s; // shadow bitmap 115 Bitmap *bm_s; // shadow bitmap
107 FT_BBox bbox; 116 FT_BBox bbox;
108 FT_Vector pos; 117 FT_Vector pos;
118 FT_Vector offset;
109 char linebreak; // the first (leading) glyph of some line ? 119 char linebreak; // the first (leading) glyph of some line ?
110 uint32_t c[4]; // colors 120 uint32_t c[4]; // colors
111 FT_Vector advance; // 26.6 121 FT_Vector advance; // 26.6
122 FT_Vector cluster_advance;
112 Effect effect_type; 123 Effect effect_type;
113 int effect_timing; // time duration of current karaoke word 124 int effect_timing; // time duration of current karaoke word
114 // after process_karaoke_effects: distance in pixels from the glyph origin. 125 // after process_karaoke_effects: distance in pixels from the glyph origin.
115 // part of the glyph to the left of it is displayed in a different color. 126 // part of the glyph to the left of it is displayed in a different color.
116 int effect_skip_timing; // delay after the end of last karaoke word 127 int effect_skip_timing; // delay after the end of last karaoke word
119 double blur; // gaussian blur 130 double blur; // gaussian blur
120 double shadow_x; 131 double shadow_x;
121 double shadow_y; 132 double shadow_y;
122 double frx, fry, frz; // rotation 133 double frx, fry, frz; // rotation
123 double fax, fay; // text shearing 134 double fax, fay; // text shearing
135 double scale_x, scale_y;
136 double border_x, border_y;
137 unsigned italic;
138 unsigned bold;
139 int flags;
140
141 int bm_run_id;
142 int shape_run_id;
124 143
125 BitmapHashKey hash_key; 144 BitmapHashKey hash_key;
145
146 // next glyph in this cluster
147 struct glyph_info *next;
126 } GlyphInfo; 148 } GlyphInfo;
127 149
128 typedef struct { 150 typedef struct {
129 double asc, desc; 151 double asc, desc;
152 int offset, len;
130 } LineInfo; 153 } LineInfo;
131 154
132 typedef struct { 155 typedef struct {
133 GlyphInfo *glyphs; 156 GlyphInfo *glyphs;
134 int length; 157 int length;
145 ASS_Event *event; 168 ASS_Event *event;
146 ASS_Style *style; 169 ASS_Style *style;
147 int parsed_tags; 170 int parsed_tags;
148 171
149 ASS_Font *font; 172 ASS_Font *font;
150 char *font_path;
151 double font_size; 173 double font_size;
152 int flags; // decoration flags (underline/strike-through) 174 int flags; // decoration flags (underline/strike-through)
153 175
154 FT_Stroker stroker; 176 FT_Stroker stroker;
155 int alignment; // alignment overrides go here; if zero, style value will be used 177 int alignment; // alignment overrides go here; if zero, style value will be used
184 206
185 Effect effect_type; 207 Effect effect_type;
186 int effect_timing; 208 int effect_timing;
187 int effect_skip_timing; 209 int effect_skip_timing;
188 210
211 // bitmap run id (used for final bitmap rendering)
212 int bm_run_id;
213
189 enum { 214 enum {
190 SCROLL_LR, // left-to-right 215 SCROLL_LR, // left-to-right
191 SCROLL_RL, 216 SCROLL_RL,
192 SCROLL_TB, // top-to-bottom 217 SCROLL_TB, // top-to-bottom
193 SCROLL_BT 218 SCROLL_BT
198 char *family; 223 char *family;
199 unsigned bold; 224 unsigned bold;
200 unsigned italic; 225 unsigned italic;
201 int treat_family_as_pattern; 226 int treat_family_as_pattern;
202 int wrap_style; 227 int wrap_style;
228 int font_encoding;
203 } RenderContext; 229 } RenderContext;
204 230
205 typedef struct { 231 typedef struct {
206 Hashmap *font_cache; 232 Cache *font_cache;
207 Hashmap *glyph_cache; 233 Cache *outline_cache;
208 Hashmap *bitmap_cache; 234 Cache *bitmap_cache;
209 Hashmap *composite_cache; 235 Cache *composite_cache;
210 size_t glyph_max; 236 size_t glyph_max;
211 size_t bitmap_max_size; 237 size_t bitmap_max_size;
212 } CacheStore; 238 } CacheStore;
213 239
214 struct ass_renderer { 240 struct ass_renderer {
216 FT_Library ftlibrary; 242 FT_Library ftlibrary;
217 FCInstance *fontconfig_priv; 243 FCInstance *fontconfig_priv;
218 ASS_Settings settings; 244 ASS_Settings settings;
219 int render_id; 245 int render_id;
220 ASS_SynthPriv *synth_priv; 246 ASS_SynthPriv *synth_priv;
247 ASS_Shaper *shaper;
221 248
222 ASS_Image *images_root; // rendering result is stored here 249 ASS_Image *images_root; // rendering result is stored here
223 ASS_Image *prev_images_root; 250 ASS_Image *prev_images_root;
224 251
225 EventImages *eimg; // temporary buffer for sorting rendered events 252 EventImages *eimg; // temporary buffer for sorting rendered events
263 } Segment; 290 } Segment;
264 291
265 void reset_render_context(ASS_Renderer *render_priv); 292 void reset_render_context(ASS_Renderer *render_priv);
266 void ass_free_images(ASS_Image *img); 293 void ass_free_images(ASS_Image *img);
267 294
295 // XXX: this is actually in ass.c, includes should be fixed later on
296 void ass_lazy_track_init(ASS_Library *lib, ASS_Track *track);
297
268 #endif /* LIBASS_RENDER_H */ 298 #endif /* LIBASS_RENDER_H */