Commit bb9834b5 authored by Francois Cartegnie's avatar Francois Cartegnie

text_style: fix alpha values

parent a222da2d
...@@ -50,36 +50,29 @@ typedef struct ...@@ -50,36 +50,29 @@ typedef struct
int i_font_size; /**< The font size in pixels */ int i_font_size; /**< The font size in pixels */
int i_font_color; /**< The color of the text 0xRRGGBB int i_font_color; /**< The color of the text 0xRRGGBB
(native endianness) */ (native endianness) */
uint8_t i_font_alpha; /**< The transparency of the text. uint8_t i_font_alpha; /**< The transparency of the text.*/
0x00 is fully opaque,
0xFF fully transparent */
int i_spacing; /**< The spaceing between glyphs in pixels */ int i_spacing; /**< The spaceing between glyphs in pixels */
/* Outline */ /* Outline */
int i_outline_color; /**< The color of the outline 0xRRGGBB */ int i_outline_color; /**< The color of the outline 0xRRGGBB */
uint8_t i_outline_alpha; /**< The transparency of the outline. uint8_t i_outline_alpha; /**< The transparency of the outline */
0x00 is fully opaque,
0xFF fully transparent */
int i_outline_width; /**< The width of the outline in pixels */ int i_outline_width; /**< The width of the outline in pixels */
/* Shadow */ /* Shadow */
int i_shadow_color; /**< The color of the shadow 0xRRGGBB */ int i_shadow_color; /**< The color of the shadow 0xRRGGBB */
uint8_t i_shadow_alpha; /**< The transparency of the shadow. uint8_t i_shadow_alpha; /**< The transparency of the shadow. */
0x00 is fully opaque,
0xFF fully transparent */
int i_shadow_width; /**< The width of the shadow in pixels */ int i_shadow_width; /**< The width of the shadow in pixels */
/* Background (and karaoke) */ /* Background (and karaoke) */
int i_background_color;/**< The color of the background 0xRRGGBB */ int i_background_color;/**< The color of the background 0xRRGGBB */
uint8_t i_background_alpha;/**< The transparency of the background. uint8_t i_background_alpha;/**< The transparency of the background */
0x00 is fully opaque,
0xFF fully transparent */
int i_karaoke_background_color;/**< Background color for karaoke 0xRRGGBB */ int i_karaoke_background_color;/**< Background color for karaoke 0xRRGGBB */
uint8_t i_karaoke_background_alpha;/**< The transparency of the karaoke bg. uint8_t i_karaoke_background_alpha;/**< The transparency of the karaoke bg */
0x00 is fully opaque,
0xFF fully transparent */
} text_style_t; } text_style_t;
#define STYLE_ALPHA_OPAQUE 0xFF
#define STYLE_ALPHA_TRANSPARENT 0x00
/* Features flags for \ref i_features */ /* Features flags for \ref i_features */
#define STYLE_NO_DEFAULTS 0x0 #define STYLE_NO_DEFAULTS 0x0
#define STYLE_FULLY_SET 0xFFFF #define STYLE_FULLY_SET 0xFFFF
......
...@@ -792,7 +792,7 @@ static inline int RenderAXYZ( filter_t *p_filter, ...@@ -792,7 +792,7 @@ static inline int RenderAXYZ( filter_t *p_filter,
if (p_region->b_renderbg) { if (p_region->b_renderbg) {
/* Render the background just under the text */ /* Render the background just under the text */
FillPicture( p_picture, 0x00, 0x00, 0x00, 0x00 ); FillPicture( p_picture, STYLE_ALPHA_TRANSPARENT, 0x00, 0x00, 0x00 );
RenderBackground(p_region, p_line_head, p_bbox, i_margin, p_picture, i_text_width, RenderBackground(p_region, p_line_head, p_bbox, i_margin, p_picture, i_text_width,
ExtractComponents, BlendPixel); ExtractComponents, BlendPixel);
} else { } else {
......
...@@ -853,7 +853,7 @@ static int LoadGlyphs( filter_t *p_filter, paragraph_t *p_paragraph, ...@@ -853,7 +853,7 @@ static int LoadGlyphs( filter_t *p_filter, paragraph_t *p_paragraph,
p_bitmaps->p_outline = 0; p_bitmaps->p_outline = 0;
} }
if( p_filter->p_sys->p_style->i_shadow_alpha > 0 ) if( p_filter->p_sys->p_style->i_shadow_alpha != STYLE_ALPHA_TRANSPARENT )
p_bitmaps->p_shadow = p_bitmaps->p_outline ? p_bitmaps->p_shadow = p_bitmaps->p_outline ?
p_bitmaps->p_outline : p_bitmaps->p_glyph; p_bitmaps->p_outline : p_bitmaps->p_glyph;
......
...@@ -51,15 +51,15 @@ text_style_t *text_style_Create( int i_defaults ) ...@@ -51,15 +51,15 @@ text_style_t *text_style_Create( int i_defaults )
p_style->f_font_relsize = STYLE_DEFAULT_REL_FONT_SIZE; p_style->f_font_relsize = STYLE_DEFAULT_REL_FONT_SIZE;
p_style->i_font_size = STYLE_DEFAULT_FONT_SIZE; p_style->i_font_size = STYLE_DEFAULT_FONT_SIZE;
p_style->i_font_color = 0xffffff; p_style->i_font_color = 0xffffff;
p_style->i_font_alpha = 0xff; p_style->i_font_alpha = STYLE_ALPHA_OPAQUE;
p_style->i_outline_color = 0x000000; p_style->i_outline_color = 0x000000;
p_style->i_outline_alpha = 0xff; p_style->i_outline_alpha = STYLE_ALPHA_OPAQUE;
p_style->i_shadow_color = 0x808080; p_style->i_shadow_color = 0x808080;
p_style->i_shadow_alpha = 0xff; p_style->i_shadow_alpha = STYLE_ALPHA_OPAQUE;
p_style->i_background_color = 0x000000; p_style->i_background_color = 0x000000;
p_style->i_background_alpha = 0xff; p_style->i_background_alpha = STYLE_ALPHA_OPAQUE;
p_style->i_karaoke_background_color = 0xffffff; p_style->i_karaoke_background_color = 0xffffff;
p_style->i_karaoke_background_alpha = 0xff; p_style->i_karaoke_background_alpha = STYLE_ALPHA_OPAQUE;
p_style->i_outline_width = 1; p_style->i_outline_width = 1;
p_style->i_shadow_width = 0; p_style->i_shadow_width = 0;
p_style->i_spacing = -1; p_style->i_spacing = -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment