switch_img_scale(img, &layer->img, img_w, img_h);
-
+
if (layer->logo_img) {
int ew = layer->screen_w - (layer->geometry.border * 2), eh = layer->screen_h - (layer->banner_img ? layer->banner_img->d_h : 0) - (layer->geometry.border * 2);
int ex = 0, ey = 0;
}
img = switch_img_write_text_img(member->video_logo->d_w, member->video_logo->d_h, SWITCH_FALSE, var);
- switch_img_fit(&img, member->video_logo->d_w, member->video_logo->d_h, SWITCH_FIT_SIZE);
+ switch_img_fit(&img, member->video_logo->d_w, member->video_logo->d_h, SWITCH_FIT_NECESSARY);
switch_img_attenuate(member->video_logo);
switch_img_patch(member->video_logo, img, x, y);
switch_img_free(&img);
{SWITCH_FIT_SIZE, "fit-size"},
{SWITCH_FIT_SCALE, "fit-scale"},
{SWITCH_FIT_SIZE_AND_SCALE, "fit-size-and-scale"},
+ {SWITCH_FIT_NECESSARY, "fit-necessary"},
{SWITCH_FIT_NONE, NULL}
};
color->b = 255;
}
}
+
+ color->a = 255;
}
#ifdef SWITCH_HAVE_YUV
color->r = c1->r + (c2->r - c1->r) * i / MAX_GRADIENT;
color->g = c1->g + (c2->g - c1->g) * i / MAX_GRADIENT;
color->b = c1->b + (c2->b - c1->b) * i / MAX_GRADIENT;
+ color->a = 255;
}
}
switch_img_txt_handle_create(&txthandle, font_face, fg, bg, font_size, 0, NULL);
- if (bg) {
- switch_color_set_rgb(&bgcolor, bg);
- }
-
pre_width = switch_img_txt_handle_render(txthandle,
NULL,
font_size / 2, font_size / 2,
} else {
width = pre_width;
}
-
+
//if (bg) {
// txtimg = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, width, height, 1);
// switch_assert(txtimg);
// switch_img_fill(txtimg, 0, 0, txtimg->d_w, txtimg->d_h, &bgcolor);
//} else {
- txtimg = switch_img_alloc(NULL, SWITCH_IMG_FMT_ARGB, width, height, 1);
- switch_assert(txtimg);
+ txtimg = switch_img_alloc(NULL, SWITCH_IMG_FMT_ARGB, width, height, 1);
+ switch_assert(txtimg);
+ //memset(txtimg->planes[SWITCH_PLANE_PACKED], 0, width * height * 4);
+ if (bg) {
+ switch_color_set_rgb(&bgcolor, bg);
+ switch_img_fill(txtimg, 0, 0, txtimg->d_w, txtimg->d_h, &bgcolor);
+ } else {
memset(txtimg->planes[SWITCH_PLANE_PACKED], 0, width * height * 4);
- if (bg) {
- switch_img_fill(txtimg, 0, 0, txtimg->d_w, txtimg->d_h, &bgcolor);
- }
+ }
//}
x = font_size / 2;
return SWITCH_STATUS_SUCCESS;
}
+ if (fit == SWITCH_FIT_NECESSARY && src->d_w <= width && src->d_h < height) {
+ return SWITCH_STATUS_SUCCESS;
+ }
+
if (fit == SWITCH_FIT_SCALE) {
switch_img_scale(src, &tmp, width, height);
switch_img_free(&src);