* \param[in] img The small Image descriptor
* \param[in] x Leftmost pos
* \param[in] y Topmost pos
-* \param[in] alpha Alaha value from 0(completely transparent) to 255(opaque)
+* \param[in] percent Alaha value from 0(completely transparent) to 100(opaque)
*/
-SWITCH_DECLARE(void) switch_img_overlay(switch_image_t *IMG, switch_image_t *img, int x, int y, uint8_t alpha);
+SWITCH_DECLARE(void) switch_img_overlay(switch_image_t *IMG, switch_image_t *img, int x, int y, uint8_t percent);
SWITCH_DECLARE(switch_status_t) switch_img_scale(switch_image_t *src, switch_image_t **destP, int width, int height);
SWITCH_DECLARE(switch_status_t) switch_img_fit(switch_image_t **srcP, int width, int height, switch_img_fit_t fit);
switch_timer_t timer;
int logo_always;
switch_img_position_t logo_pos;
- int logo_opacity;
+ uint8_t logo_opacity;
+ uint8_t text_opacity;
};
typedef struct local_stream_source local_stream_source_t;
}
if (frame->img && context->banner_img && frame->img->d_w >= context->banner_img->d_w) {
- //switch_img_overlay(frame->img, context->banner_img, 0, frame->img->d_h - context->banner_img->d_h, 100);
- switch_img_patch(frame->img, context->banner_img, 0, frame->img->d_h - context->banner_img->d_h);
- //switch_img_patch(frame->img, context->banner_img, 0, 0);
+ switch_img_overlay(frame->img, context->banner_img, 0, frame->img->d_h - context->banner_img->d_h, context->source->text_opacity);
}
if (frame->img && context->source->logo_img &&
y -= context->banner_img->d_h;
}
- if (context->source->logo_opacity > 0 && context->source->logo_opacity < 100) {
- switch_img_overlay(frame->img, context->source->logo_img, x, y-1, context->source->logo_opacity);
- } else {
- switch_img_patch(frame->img, context->source->logo_img, x, y-1);
- }
+ switch_img_overlay(frame->img, context->source->logo_img, x, y, context->source->logo_opacity);
}
return SWITCH_STATUS_SUCCESS;
source->stopped = 0;
source->hup = 0;
source->chime_freq = 30;
+ source->logo_opacity = source->text_opacity = 100;
+
for (param = switch_xml_child(directory, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
if (source->logo_opacity < 0 && source->logo_opacity > 100) {
source->logo_opacity = 0;
}
+ } else if (!strcasecmp(var, "text-opacity") && !zstr(val)) {
+ source->text_opacity = atoi(val);
+ if (source->text_opacity < 0 && source->text_opacity > 100) {
+ source->text_opacity = 0;
+ }
}
}
#endif
}
-SWITCH_DECLARE(void) switch_img_overlay(switch_image_t *IMG, switch_image_t *img, int x, int y, uint8_t alpha)
+SWITCH_DECLARE(void) switch_img_overlay(switch_image_t *IMG, switch_image_t *img, int x, int y, uint8_t percent)
{
int i, j, len, max_h;
switch_rgb_color_t RGB = {0}, rgb = {0}, c = {0};
int xoff = 0, yoff = 0;
+ uint8_t alpha = (int8_t)((255 * percent) / 100);
+
switch_assert(IMG->fmt == SWITCH_IMG_FMT_I420);