improve window animation

This commit is contained in:
xianjimli 2018-06-10 18:09:54 +08:00
parent 36854877d5
commit 7cf666a4a2
16 changed files with 30 additions and 24 deletions

View File

@ -136,7 +136,12 @@ bin\demo1
## 最新动态
* 2018/06/08
* 2018/06/10
* 优化窗口动画。
* 完善lcd的接口。
* 完善资源管理。
* 2018/06/09
* 修改stb\_image/stb\_truetype在开发板不工作的问题(内存分配/stack大小)。
* 图片加载支持bgra/rgb565格式。
* 修stm32\_g2d中blend\_image的BUG。

View File

@ -38401,4 +38401,4 @@ const unsigned char image_bg800x480[] = {
0x17,0x34,0x17,0x34,0x17,0x34,0x17,0x34,0x37,0x34,0x37,0x34,0x37,0x34,0x37,0x34,0x57,0x34,0x57,0x34,
0x57,0x34,0x76,0x34,0x76,0x34,0x76,0x34,0x76,0x34,0x96,0x3c,0x96,0x3c,0x96,0x3c,0x96,0x3c,0xb6,0x3c,
0xb6,0x3c,0xd5,0x3c,0xd5,0x3c,0xd5,0x3c,0xd5,0x3c,0xd5,0x3c,0xd5,0x44,0xf5,0x44,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,};/*768044*/
0x97,0xab,0xc4,0xff,};/*768044*/

View File

@ -361,4 +361,4 @@ const unsigned char image_bricks[] = {
0xcd,0xbb,0xcc,0xbb,0xed,0xbb,0x0d,0xc4,0x0d,0xbc,0x0d,0xc4,0x0d,0xc4,0x0d,0xc4,0xed,0xc3,0x0d,0xc4,
0x0d,0xc4,0x0d,0xc4,0x0e,0xcc,0x11,0xd5,0xb0,0xc4,0xad,0xbb,0xac,0xbb,0xec,0xc3,0xec,0xc3,0xcc,0xbb,
0xcc,0xbb,0xcc,0xc3,0xcc,0xc3,0xed,0xc3,0xed,0xc3,0xcc,0xbb,0xcc,0xbb,0xd2,0xc4,0x00,0x00,0x00,0x00,
0x12,0x5a,0x2b,0xad,};/*7244*/
0x00,0x00,0x00,0x00,};/*7244*/

View File

@ -181,4 +181,4 @@ const unsigned char image_green_btn_o[] = {
0x26,0x83,0x5a,0xff,0x26,0x83,0x5a,0xff,0x26,0x83,0x5a,0xff,0x26,0x83,0x5a,0xff,0x26,0x83,0x5a,0xff,
0x26,0x83,0x5a,0xff,0x3a,0x8d,0x68,0xff,0x62,0xa2,0x85,0xd7,0x85,0xb7,0xa0,0x97,0xd4,0xe5,0xdd,0x37,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,};/*3644*/
0x78,0x0c,0xeb,0x7a,};/*3644*/

View File

@ -116,4 +116,4 @@ const unsigned char image_left_off[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x88,0x2a,0xe9,0x7a,};/*2348*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*2348*/

View File

@ -27,4 +27,4 @@ const unsigned char ui_animation[] = {
0x65,0x78,0x74,0x00,0x62,0x6f,0x74,0x74,0x6f,0x6d,0x00,0x00,0x00,0x01,0x00,0x0a,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x6c,0x6f,0x73,0x65,0x00,0x74,0x65,0x78,0x74,0x00,0x43,0x6c,0x6f,
0x73,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x5b,};/*570*/
0x73,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*570*/

View File

@ -6,4 +6,4 @@ const unsigned char ui_animator[] = {
0x30,0x20,0x68,0x33,0x30,0x20,0x35,0x20,0x31,0x30,0x00,0x00,0x01,0x00,0x0a,0x00,0x00,0x00,0x01,0x00,
0x0a,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x6e,0x61,0x6d,0x65,0x00,0x63,0x6c,0x6f,0x73,0x65,0x00,0x74,0x65,0x78,0x74,0x00,0x43,0x6c,0x6f,0x73,
0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*149*/
0x65,0x00,0x00,0x00,0x00,0x92,0x51,0x80,0xed,};/*149*/

View File

@ -11,4 +11,4 @@ const unsigned char ui_dialog2[] = {
0x74,0x00,0x74,0x65,0x78,0x74,0x00,0xe7,0xa1,0xae,0xe5,0xae,0x9a,0x00,0x00,0x00,0x01,0x00,0x0a,0x00,
0x03,0x03,0x01,0x00,0x0a,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x71,0x75,0x69,0x74,0x00,0x74,0x65,0x78,0x74,0x00,0xe5,
0x8f,0x96,0xe6,0xb6,0x88,0x00,0x00,0x00,0x00,0x52,0xde,0x78,0xff,};/*253*/
0x8f,0x96,0xe6,0xb6,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*253*/

View File

@ -105,7 +105,7 @@ ret_t resource_init(void) {
#ifdef WITH_FS_RES
resource_manager_load(rm, RESOURCE_TYPE_THEME, "default");
resource_manager_load(rm, RESOURCE_TYPE_FONT, "default_ttf");
resource_manager_load(rm, RESOURCE_TYPE_FONT, "default");
#else
resource_manager_add(rm, font_default);
resource_manager_add(rm, image_bg800x480);

8
src/lcd/lcd_mem.inc Normal file → Executable file
View File

@ -37,6 +37,10 @@ static ret_t lcd_mem_to_bitmap(lcd_t* lcd, bitmap_t* fb) {
fb->data = mem->fbuff;
fb->format = LCD_FORMAT;
if (lcd->draw_mode == LCD_DRAW_ANIMATION && mem->online_fbuff) {
fb->data = mem->online_fbuff;
}
return RET_OK;
}
@ -288,10 +292,6 @@ static bitmap_t* lcd_mem_init_offline_fb(lcd_t* lcd, bitmap_t* fb) {
fb->format = mem->format;
fb->data = mem->fbuff;
if (lcd->draw_mode == LCD_DRAW_ANIMATION && mem->online_fbuff) {
fb->data = mem->online_fbuff;
}
return fb;
}

View File

@ -1,9 +1,9 @@
static ret_t window_animator_open_bottom_to_top_update_percent(window_animator_t* wa) {
if (wa->open) {
wa->percent = 0.5f + 0.5f * wa->easing(wa->time_percent);
wa->percent = wa->easing(wa->time_percent);
} else {
wa->percent = 1.0f - 0.5f * wa->easing(wa->time_percent);
wa->percent = 1.0f - wa->easing(wa->time_percent);
}
return RET_OK;
@ -72,10 +72,10 @@ static window_animator_t* window_animator_create_bottom_to_top(bool_t open) {
return_value_if_fail(wa != NULL, NULL);
if (open) {
wa->easing = easing_get(EASING_QUADRATIC_IN);
wa->easing = easing_get(EASING_CUBIC_OUT);
wa->destroy = window_animator_open_destroy;
} else {
wa->easing = easing_get(EASING_QUADRATIC_IN);
wa->easing = easing_get(EASING_CUBIC_IN);
wa->destroy = window_animator_close_destroy;
}

View File

@ -47,6 +47,7 @@ static ret_t window_animator_open_fade_draw_curr(window_animator_t* wa) {
vgcanvas_set_global_alpha(vg, alpha);
vgcanvas_draw_image(vg, &(wa->curr_img), src.x, src.y, src.w, src.h, dst.x, dst.y, dst.w, dst.h);
vgcanvas_restore(vg);
(void)global_alpha;
#else
global_alpha = alpha * 0xff;
lcd_set_global_alpha(c->lcd, global_alpha);

View File

@ -1,9 +1,9 @@
static ret_t window_animator_open_top_to_bottom_update_percent(window_animator_t* wa) {
if (wa->open) {
wa->percent = 0.5f + 0.5f * wa->easing(wa->time_percent);
wa->percent = wa->easing(wa->time_percent);
} else {
wa->percent = 1.0f - 0.5f * wa->easing(wa->time_percent);
wa->percent = 1.0f - wa->easing(wa->time_percent);
}
return RET_OK;
@ -72,10 +72,10 @@ static window_animator_t* window_animator_create_top_to_bottom(bool_t open) {
return_value_if_fail(wa != NULL, NULL);
if (open) {
wa->easing = easing_get(EASING_LINEAR);
wa->easing = easing_get(EASING_CUBIC_OUT);
wa->destroy = window_animator_open_destroy;
} else {
wa->easing = easing_get(EASING_LINEAR);
wa->easing = easing_get(EASING_CUBIC_IN);
wa->destroy = window_animator_close_destroy;
}

View File

@ -47,7 +47,7 @@ static ret_t window_animator_prepare(window_animator_t* wa, canvas_t* c, widget_
wa->ratio = 1;
wa->canvas = c;
wa->open = open;
wa->duration = 600;
wa->duration = 500;
wa->prev_win = prev_win;
wa->curr_win = curr_win;
rect_init(r, 0, 0, wm->w, wm->h);

View File

@ -59,7 +59,7 @@ static ret_t window_animator_prepare(window_animator_t* wa, canvas_t* c, widget_
wa->canvas = c;
wa->open = open;
wa->duration = 400;
wa->duration = 500;
wa->prev_win = prev_win;
wa->curr_win = curr_win;

View File

@ -167,7 +167,7 @@ def gen_res_c():
result += '#ifdef WITH_FS_RES\n'
result += ' resource_manager_load(rm, RESOURCE_TYPE_THEME, "default");\n'
result += ' resource_manager_load(rm, RESOURCE_TYPE_FONT, "default_ttf");\n'
result += ' resource_manager_load(rm, RESOURCE_TYPE_FONT, "default");\n'
result += '#else\n'
files=glob.glob(joinPath(OUTPUT_DIR, '**/*.data'))