]> git.sesse.net Git - vlc/blob - src/misc/text_style.c
Use var_Inherit* instead of var_CreateGet*.
[vlc] / src / misc / text_style.c
1 /*****************************************************************************
2  * text_style.c
3  *****************************************************************************
4  * Copyright (C) 1999-2010 the VideoLAN team
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
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 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 General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, 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->i_font_size = 22;
41     p_style->i_font_color = 0xffffff;
42     p_style->i_font_alpha = 0xff;
43     p_style->i_style_flags = STYLE_OUTLINE;
44     p_style->i_outline_color = 0x000000;
45     p_style->i_outline_alpha = 0xff;
46     p_style->i_shadow_color = 0x000000;
47     p_style->i_shadow_alpha = 0xff;
48     p_style->i_background_color = 0xffffff;
49     p_style->i_background_alpha = 0x80;
50     p_style->i_karaoke_background_color = 0xffffff;
51     p_style->i_karaoke_background_alpha = 0xff;
52     p_style->i_outline_width = 1;
53     p_style->i_shadow_width = 0;
54     p_style->i_spacing = -1;
55
56     return p_style;
57 }
58
59 text_style_t *text_style_Copy( text_style_t *p_dst, const text_style_t *p_src )
60 {
61     if( !p_src )
62         return p_dst;
63
64     /* */
65     *p_dst = *p_src;
66
67     if( p_src->psz_fontname )
68         p_dst->psz_fontname = strdup( p_src->psz_fontname );
69
70     return p_dst;
71 }
72
73 text_style_t *text_style_Duplicate( const text_style_t *p_src )
74 {
75     if( !p_src )
76         return NULL;
77
78     text_style_t *p_dst = calloc( 1, sizeof(*p_dst) );
79     if( p_dst )
80         text_style_Copy( p_dst, p_src );
81     return p_dst;
82 }
83
84 void text_style_Delete( text_style_t *p_style )
85 {
86     if( p_style )
87         free( p_style->psz_fontname );
88     free( p_style );
89 }
90