Skip to content

Commit cbdb62d

Browse files
Merge pull request #29 from netease-im/main-beta
Release 1.1.6
2 parents 5da7794 + 5aa34a7 commit cbdb62d

File tree

262 files changed

+45187
-1617
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

262 files changed

+45187
-1617
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# CMakeLists in this exact order for cmake to work correctly
55
cmake_minimum_required(VERSION 3.16)
66

7-
set(PROJECT_VER "1.7.2")
7+
set(PROJECT_VER "1.1.6")
88

99
# Add this line to disable the specific warning
1010
add_compile_options(-Wno-missing-field-initializers)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# GIF表情组件
2+
3+
# 收集所有GIF源文件
4+
if (CONFIG_USE_ANIM_EMOJI_NERTC)
5+
file(GLOB GIF_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/nertc/*.c")
6+
elseif (CONFIG_USE_ANIM_EMOJI_OTTO)
7+
file(GLOB GIF_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/otto/*.c")
8+
elseif (CONFIG_USE_ANIM_EYE_240X240_GIF1)
9+
file(GLOB GIF_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/eye/gif1_240/*.c")
10+
elseif (CONFIG_USE_ANIM_EYE_240X240_GIF2)
11+
file(GLOB GIF_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/eye/gif2_240/*.c")
12+
elseif (CONFIG_USE_ANIM_EYE_160X160_GIF1)
13+
file(GLOB GIF_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/eye/gif1_160/*.c")
14+
elseif (CONFIG_USE_ANIM_EYE_160X160_GIF2)
15+
file(GLOB GIF_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/eye/gif2_160/*.c")
16+
endif()
17+
18+
# 检查是否找到GIF源文件
19+
list(LENGTH GIF_SOURCES GIF_COUNT)
20+
if(GIF_COUNT EQUAL 0)
21+
message(WARNING "未找到GIF源文件,请确保src目录中包含对应资源的.c文件")
22+
endif()
23+
# 追加 src/ 根目录下的 .c 文件
24+
file(GLOB EXTRA_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.c")
25+
26+
# 合并两个列表
27+
list(APPEND GIF_SOURCES ${EXTRA_SOURCES})
28+
29+
# 注册组件
30+
idf_component_register(
31+
SRCS ${GIF_SOURCES}
32+
INCLUDE_DIRS "include"
33+
REQUIRES "lvgl"
34+
)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## IDF Component Manager Manifest File
2+
dependencies:
3+
lvgl/lvgl: ">=9.0"
4+
5+
## Required IDF version
6+
idf:
7+
version: ">=5.4.0"
8+
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/**
2+
* @file anim_emoji_gif.h
3+
* @brief GIF表情资源组件
4+
*
5+
* 这个头文件声明了GIF表情资源,用于在LVGL显示屏上显示动态表情。
6+
*
7+
* 支持的表情:
8+
* - neutral: 静态状态/中性表情
9+
* - sad: 悲伤表情
10+
* - happy: 开心表情
11+
* - surprised: 惊吓/惊讶表情
12+
* - confused: 不学/困惑表情
13+
* - angry: 愤怒表情
14+
* - laughing: 大笑表情
15+
* - funny: 搞笑表情
16+
* - crying: 哭泣表情
17+
* - loving: 恋爱表情
18+
* - embarrassed: 尴尬表情
19+
* - shocked: 震惊表情
20+
* - thinking: 思考表情
21+
* - winking: 眨眼表情
22+
* - cool: 酷炫表情
23+
* - relaxed: 放松表情
24+
* - delicious: 美味表情
25+
* - kissy: 飞吻表情
26+
* - confident: 自信表情
27+
* - sleepy: 困倦表情
28+
* - silly: 调皮表情
29+
*/
30+
31+
#pragma once
32+
33+
#include <libs/gif/lv_gif.h>
34+
35+
#ifdef __cplusplus
36+
extern "C" {
37+
#endif
38+
39+
/**
40+
* @brief 表情GIF声明
41+
*
42+
* 这些GIF资源可以直接用于LVGL的lv_gif组件
43+
*
44+
* 使用示例:
45+
* ```c
46+
* lv_obj_t* gif = lv_gif_create(parent);
47+
* lv_image_dsc_t* happy = anim_emoji_gif_get_by_name("happy");
48+
* lv_gif_set_src(gif, &happy); // 设置开心表情
49+
* ```
50+
*/
51+
52+
/**
53+
* @brief 获取组件版本
54+
* @return 版本字符串
55+
*/
56+
const char* anim_emoji_gif_get_version(void);
57+
58+
/**
59+
* @brief 根据名称获取表情资源
60+
* @param name 表情名称
61+
* @return 表情资源指针,如果未找到则返回NULL
62+
*/
63+
const lv_image_dsc_t* anim_emoji_gif_get_by_name(const char* name);
64+
65+
#ifdef __cplusplus
66+
}
67+
#endif
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
/**
2+
* @file anim_emoji_gif_utils.c
3+
* @brief GIF表情资源组件辅助函数实现
4+
*/
5+
6+
#include <string.h>
7+
8+
#include "anim_emoji_gif.h"
9+
10+
// 表情映射表
11+
typedef struct {
12+
const char* name;
13+
const lv_image_dsc_t* gif;
14+
} emotion_map_t;
15+
16+
#if defined(CONFIG_USE_ANIM_EMOJI_NERTC)
17+
18+
#elif defined(CONFIG_USE_ANIM_EMOJI_OTTO)
19+
// 外部声明的GIF资源
20+
extern const lv_image_dsc_t staticstate;
21+
extern const lv_image_dsc_t sad;
22+
extern const lv_image_dsc_t happy;
23+
extern const lv_image_dsc_t scare;
24+
extern const lv_image_dsc_t buxue;
25+
extern const lv_image_dsc_t anger;
26+
27+
// 表情映射表(21 个表情全部映射到 6 个目标状态)
28+
static const emotion_map_t emotion_maps[] = {
29+
{"neutral", &staticstate},
30+
{"happy", &happy},
31+
{"laughing", &happy},
32+
{"funny", &happy},
33+
{"sad", &sad},
34+
{"angry", &anger},
35+
{"crying", &sad},
36+
{"loving", &happy},
37+
{"embarrassed", &buxue},
38+
{"surprised", &scare},
39+
{"shocked", &scare},
40+
{"thinking", &buxue},
41+
{"winking", &happy},
42+
{"cool", &happy},
43+
{"relaxed", &staticstate},
44+
{"delicious", &happy},
45+
{"kissy", &happy},
46+
{"confident", &happy},
47+
{"sleepy", &staticstate},
48+
{"silly", &happy},
49+
{"confused", &buxue},
50+
{NULL, NULL} // 结束标记
51+
};
52+
#elif defined(CONFIG_USE_ANIM_EYE_240X240_GIF1) || defined(CONFIG_USE_ANIM_EYE_160X160_GIF1)
53+
extern const lv_image_dsc_t angry;
54+
extern const lv_image_dsc_t confused;
55+
extern const lv_image_dsc_t cool;
56+
extern const lv_image_dsc_t delicious;
57+
extern const lv_image_dsc_t happy;
58+
extern const lv_image_dsc_t love;
59+
extern const lv_image_dsc_t sad;
60+
extern const lv_image_dsc_t sleepy;
61+
extern const lv_image_dsc_t thinking;
62+
63+
static const emotion_map_t emotion_maps[] = {
64+
{"neutral", &happy},
65+
{"happy", &happy},
66+
{"laughing", &happy},
67+
{"funny", &happy},
68+
{"sad", &sad},
69+
{"angry", &angry},
70+
{"crying", &sad},
71+
{"loving", &love},
72+
{"embarrassed", &confused},
73+
{"surprised", &delicious},
74+
{"shocked", &delicious},
75+
{"thinking", &thinking},
76+
{"winking", &cool},
77+
{"cool", &cool},
78+
{"relaxed", &happy},
79+
{"delicious", &delicious},
80+
{"kissy", &love},
81+
{"confident", &confused},
82+
{"sleepy", &sleepy},
83+
{"silly", &delicious},
84+
{"confused", &confused},
85+
{NULL, NULL} /* 结束标记 */
86+
};
87+
#elif defined(CONFIG_USE_ANIM_EYE_240X240_GIF2) || defined(CONFIG_USE_ANIM_EYE_160X160_GIF2)
88+
extern const lv_image_dsc_t angry;
89+
extern const lv_image_dsc_t confused;
90+
extern const lv_image_dsc_t happy;
91+
extern const lv_image_dsc_t love;
92+
extern const lv_image_dsc_t neutral;
93+
extern const lv_image_dsc_t sleepy;
94+
extern const lv_image_dsc_t thinking;
95+
extern const lv_image_dsc_t winking;
96+
97+
static const emotion_map_t emotion_maps[] = {
98+
{"neutral", &neutral},
99+
{"happy", &happy},
100+
{"laughing", &happy},
101+
{"funny", &happy},
102+
{"sad", &neutral},
103+
{"angry", &angry},
104+
{"crying", &neutral},
105+
{"loving", &love},
106+
{"embarrassed", &confused},
107+
{"surprised", &confused},
108+
{"shocked", &winking},
109+
{"thinking", &thinking},
110+
{"winking", &winking},
111+
{"cool", &winking},
112+
{"relaxed", &happy},
113+
{"delicious", &winking},
114+
{"kissy", &love},
115+
{"confident", &confused},
116+
{"sleepy", &sleepy},
117+
{"silly", &neutral},
118+
{"confused", &confused},
119+
{NULL, NULL}
120+
};
121+
#else
122+
static const emotion_map_t emotion_maps[] = {
123+
{NULL, NULL} // 结束标记
124+
};
125+
#endif
126+
127+
const char* anim_emoji_gif_get_version(void) {
128+
return "1.0.1";
129+
}
130+
131+
const lv_image_dsc_t* anim_emoji_gif_get_by_name(const char* name) {
132+
if (name == NULL) {
133+
return NULL;
134+
}
135+
136+
for (int i = 0; emotion_maps[i].name != NULL; i++) {
137+
if (strcmp(emotion_maps[i].name, name) == 0) {
138+
return emotion_maps[i].gif;
139+
}
140+
}
141+
142+
return NULL; // 未找到
143+
}

components/anim-emoji-gif/src/eye/gif1_160/angry.c

Lines changed: 33 additions & 0 deletions
Large diffs are not rendered by default.

components/anim-emoji-gif/src/eye/gif1_160/confused.c

Lines changed: 33 additions & 0 deletions
Large diffs are not rendered by default.

components/anim-emoji-gif/src/eye/gif1_160/cool.c

Lines changed: 33 additions & 0 deletions
Large diffs are not rendered by default.

components/anim-emoji-gif/src/eye/gif1_160/delicious.c

Lines changed: 33 additions & 0 deletions
Large diffs are not rendered by default.

components/anim-emoji-gif/src/eye/gif1_160/happy.c

Lines changed: 33 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)