Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
c857be45
提交
c857be45
authored
2月 11, 2015
作者:
Seven Du
提交者:
Michael Jerris
5月 28, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7506: improve draw_text with minimum anti aliasing
上级
8a1cb140
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
39 行增加
和
12 行删除
+39
-12
switch_core_video.h
src/include/switch_core_video.h
+1
-1
mod_conference.c
src/mod/applications/mod_conference/mod_conference.c
+38
-11
没有找到文件。
src/include/switch_core_video.h
浏览文件 @
c857be45
...
...
@@ -183,7 +183,7 @@ SWITCH_DECLARE(void) switch_img_flip(switch_image_t *img);
*/
SWITCH_DECLARE
(
void
)
switch_img_free
(
switch_image_t
**
img
);
SWITCH_DECLARE
(
void
)
switch_img_draw_text
(
switch_image_t
*
IMG
,
int
x
,
int
y
,
char
*
text
);
SWITCH_DECLARE
(
void
)
switch_img_draw_text
(
switch_image_t
*
IMG
,
int
x
,
int
y
,
switch_yuv_color_t
color
,
uint16_t
font_size
,
char
*
text
);
SWITCH_DECLARE
(
void
)
switch_img_add_text
(
void
*
buffer
,
int
w
,
int
x
,
int
y
,
char
*
s
);
...
...
src/mod/applications/mod_conference/mod_conference.c
浏览文件 @
c857be45
...
...
@@ -736,19 +736,31 @@ static void draw_bitmap(switch_image_t *img, FT_Bitmap* bitmap, FT_Int x, FT_Int
FT_Int
x_max
=
x
+
bitmap
->
width
;
FT_Int
y_max
=
y
+
bitmap
->
rows
;
switch
(
bitmap
->
pixel_mode
)
{
case
FT_PIXEL_MODE_GRAY
:
// it should always be GRAY since we use FT_LOAD_RENDER?
break
;
case
FT_PIXEL_MODE_NONE
:
case
FT_PIXEL_MODE_MONO
:
case
FT_PIXEL_MODE_GRAY2
:
case
FT_PIXEL_MODE_GRAY4
:
case
FT_PIXEL_MODE_LCD
:
case
FT_PIXEL_MODE_LCD_V
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"unsupported pixel mode %d
\n
"
,
bitmap
->
pixel_mode
);
return
;
}
for
(
i
=
x
,
p
=
0
;
i
<
x_max
;
i
++
,
p
++
)
{
for
(
j
=
y
,
q
=
0
;
j
<
y_max
;
j
++
,
q
++
)
{
if
(
i
<
0
||
j
<
0
||
i
>=
img
->
d_w
||
j
>=
img
->
d_h
)
continue
;
if
(
bitmap
->
buffer
[
q
*
bitmap
->
width
+
p
])
{
// TODO the value ranges from 1 - 255, maybe we should reset the color based on that
if
(
bitmap
->
buffer
[
q
*
bitmap
->
width
+
p
]
>
128
)
{
switch_image_draw_pixel
(
img
,
i
,
j
,
color
);
}
}
}
}
SWITCH_DECLARE
(
void
)
switch_img_draw_text
(
switch_image_t
*
img
,
int
x
,
int
y
,
char
*
text
)
SWITCH_DECLARE
(
void
)
switch_img_draw_text
(
switch_image_t
*
img
,
int
x
,
int
y
,
switch_yuv_color_t
color
,
uint16_t
font_size
,
char
*
text
)
{
FT_Library
library
;
FT_Face
face
;
...
...
@@ -756,16 +768,14 @@ SWITCH_DECLARE(void) switch_img_draw_text(switch_image_t *img, int x, int y, cha
FT_Matrix
matrix
;
/* transformation matrix */
FT_Vector
pen
;
/* untransformed origin */
FT_Error
error
;
char
*
font_family
=
"/usr/local/freeswitch/SimHei.ttf"
;
int
font_size
=
64
;
//
char* font_family = "/usr/local/freeswitch/SimHei.ttf";
char
*
font_family
=
"/usr/local/freeswitch/Arial.ttf"
;
double
angle
;
int
target_height
;
int
index
=
0
;
FT_ULong
ch
;
switch_yuv_color_t
color
;
if
(
zstr
(
text
))
return
;
switch_color_set
(
&
color
,
"#FFFFFF"
);
angle
=
0
;
// (45.0 / 360 ) * 3.14159 * 2;
target_height
=
img
->
d_h
;
...
...
@@ -777,7 +787,7 @@ SWITCH_DECLARE(void) switch_img_draw_text(switch_image_t *img, int x, int y, cha
if
(
error
)
return
;
/* use 50pt at 100dpi */
error
=
FT_Set_Char_Size
(
face
,
50
*
font_size
,
0
,
100
,
0
);
/* set character size */
error
=
FT_Set_Char_Size
(
face
,
64
*
font_size
,
0
,
96
,
96
);
/* set character size */
if
(
error
)
return
;
slot
=
face
->
glyph
;
...
...
@@ -788,14 +798,18 @@ SWITCH_DECLARE(void) switch_img_draw_text(switch_image_t *img, int x, int y, cha
matrix
.
yx
=
(
FT_Fixed
)(
sin
(
angle
)
*
0x10000L
);
matrix
.
yy
=
(
FT_Fixed
)(
cos
(
angle
)
*
0x10000L
);
/* the pen position in 26.6 cartesian space coordinates; */
/* start at (300,200) relative to the upper left corner */
pen
.
x
=
x
*
64
;
pen
.
y
=
(
target_height
-
y
)
*
64
;
while
(
*
(
text
+
index
))
{
ch
=
get_utf8_char
(
text
,
&
index
);
if
(
ch
==
'\n'
)
{
pen
.
x
=
x
*
64
;
pen
.
y
-=
(
font_size
+
font_size
/
4
)
*
64
;
continue
;
}
/* set transformation */
FT_Set_Transform
(
face
,
&
matrix
,
&
pen
);
...
...
@@ -1561,7 +1575,15 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
}
}
// switch_img_draw_text(conference->canvas->img, 10, 10, "AVA 123 你好 FreeSWITCH");
if
(
1
)
{
switch_yuv_color_t
color
;
switch_color_set
(
&
color
,
"#FFFFFF"
);
switch_img_draw_text
(
conference
->
canvas
->
img
,
10
,
10
,
color
,
12
,
"AVA 123 你好 FreeSWITCH
\n
FreeSWITCH Rocks!"
);
switch_img_draw_text
(
conference
->
canvas
->
img
,
10
,
40
,
color
,
16
,
"AVA 123 你好 FreeSWITCH
\n
FreeSWITCH Rocks!"
);
switch_img_draw_text
(
conference
->
canvas
->
img
,
10
,
80
,
color
,
24
,
"AVA 123 你好 FreeSWITCH
\n
FreeSWITCH Rocks!"
);
switch_img_draw_text
(
conference
->
canvas
->
img
,
10
,
160
,
color
,
36
,
"AVA 123 你好 FreeSWITCH
\n
FreeSWITCH Rocks!"
);
switch_img_draw_text
(
conference
->
canvas
->
img
,
10
,
300
,
color
,
72
,
"AVA 123 你好 FreeSWITCH
\n
FreeSWITCH Rocks!"
);
}
if
(
used
)
{
switch_time_t
now
=
switch_micro_time_now
();
...
...
@@ -7759,6 +7781,11 @@ static switch_status_t conf_api_sub_vid_layout(conference_obj_t *conference, swi
return
SWITCH_STATUS_SUCCESS
;
}
if
(
!
conference
->
canvas
)
{
stream
->
write_function
(
stream
,
"Conference is not in mixing mode
\n
"
);
return
SWITCH_STATUS_SUCCESS
;
}
if
(
!
strcasecmp
(
argv
[
2
],
"group"
))
{
layout_group_t
*
lg
=
NULL
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论