]> git.sesse.net Git - vlc/blob - src/misc/text_style.c
decoder: inline DecoderSignalWait()
[vlc] / src / misc / text_style.c
1 /*****************************************************************************
2  * text_style.c
3  *****************************************************************************
4  * Copyright (C) 1999-2010 VLC authors and VideoLAN
5  * $Id$
6  *
7  * Author: basOS G <noxelia 4t gmail , com>
8  *
9  * This program is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #ifdef HAVE_CONFIG_H
25 # include "config.h"
26 #endif
27
28 #include <vlc_common.h>
29 #include <vlc_text_style.h>
30
31 /* */
32 text_style_t *text_style_New( void )
33 {
34     text_style_t *p_style = calloc( 1, sizeof(*p_style) );
35     if( !p_style )
36         return NULL;
37
38     /* initialize to default text style */
39     p_style->psz_fontname = NULL;
40     p_style->psz_monofontname = NULL;
41     p_style->i_font_size = STYLE_DEFAULT_FONT_SIZE;
42     p_style->i_font_color = 0xffffff;
43     p_style->i_font_alpha = 0xff;
44     p_style->i_style_flags = STYLE_OUTLINE;
45     p_style->i_outline_color = 0x000000;
46     p_style->i_outline_alpha = 0xff;
47     p_style->i_shadow_color = 0x000000;
48     p_style->i_shadow_alpha = 0xff;
49     p_style->i_background_color = 0xffffff;
50     p_style->i_background_alpha = 0x80;
51     p_style->i_karaoke_background_color = 0xffffff;
52     p_style->i_karaoke_background_alpha = 0xff;
53     p_style->i_outline_width = 1;
54     p_style->i_shadow_width = 0;
55     p_style->i_spacing = -1;
56
57     return p_style;
58 }
59
60 text_style_t *text_style_Copy( text_style_t *p_dst, const text_style_t *p_src )
61 {
62     if( !p_src )
63         return p_dst;
64
65     /* */
66     *p_dst = *p_src;
67
68     if( p_src->psz_fontname )
69         p_dst->psz_fontname = strdup( p_src->psz_fontname );
70
71     if( p_src->psz_monofontname )
72         p_dst->psz_monofontname = strdup( p_src->psz_monofontname );
73
74     return p_dst;
75 }
76
77 text_style_t *text_style_Duplicate( const text_style_t *p_src )
78 {
79     if( !p_src )
80         return NULL;
81
82     text_style_t *p_dst = calloc( 1, sizeof(*p_dst) );
83     if( p_dst )
84         text_style_Copy( p_dst, p_src );
85     return p_dst;
86 }
87
88 void text_style_Delete( text_style_t *p_style )
89 {
90     if( p_style )
91         free( p_style->psz_fontname );
92     if( p_style )
93         free( p_style->psz_monofontname );
94     free( p_style );
95 }
96