]> granicus.if.org Git - libass/blob - libass/ass_bitmap.h
Fix bitmap cache
[libass] / libass / ass_bitmap.h
1 /*
2  * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
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_BITMAP_H
20 #define LIBASS_BITMAP_H
21
22 #include <ft2build.h>
23 #include FT_GLYPH_H
24
25 #include "ass.h"
26
27 typedef struct ass_synth_priv ASS_SynthPriv;
28
29 ASS_SynthPriv *ass_synth_init(double);
30 void ass_synth_done(ASS_SynthPriv *priv);
31
32 typedef struct {
33     int left, top;
34     int w, h;                   // width, height
35     int stride;
36     unsigned char *buffer;      // w x h buffer
37 } Bitmap;
38
39 Bitmap *outline_to_bitmap(ASS_Library *library, FT_Library ftlib,
40                           FT_Outline *outline, int bord);
41 /**
42  * \brief perform glyph rendering
43  * \param glyph original glyph
44  * \param outline_glyph "border" glyph, produced from original by FreeType's glyph stroker
45  * \param bm_g out: pointer to the bitmap of original glyph is returned here
46  * \param bm_o out: pointer to the bitmap of outline (border) glyph is returned here
47  * \param bm_g out: pointer to the bitmap of glyph shadow is returned here
48  * \param be 1 = produces blurred bitmaps, 0 = normal bitmaps
49  */
50 int outline_to_bitmap3(ASS_Library *library, ASS_SynthPriv *priv_blur,
51                        FT_Library ftlib, FT_Outline *outline, FT_Outline *border,
52                        Bitmap **bm_g, Bitmap **bm_o, Bitmap **bm_s,
53                        int be, double blur_radius, FT_Vector shadow_offset,
54                        int border_style);
55
56 void ass_free_bitmap(Bitmap *bm);
57
58 #endif                          /* LIBASS_BITMAP_H */