PNG图片分层,模拟时钟!

void mmi_idle_sublcd_diplay_clockwise(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
gdi_handle active_layer;
applib_time_struct t;
U16 image_nHour = 0;
U16 image_nMin = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
if (srv_backlight_is_lcd_sleep())
{
StopTimer(SUBLCD_ANALOG_CLOCK_TIMER);
return;
}

applib_dt_get_date_time(&t);

if (t.nHour > 12)
t.nHour = t.nHour - 12;

image_nHour = (t.nHour * 5) + t.nMin /12;
image_nMin = t.nMin;

gdi_layer_get_active(&active_layer);
gdi_push_and_set_alpha_blending_source_layer(active_layer);
gdi_image_draw_id(0, 0, (IMG_SUBLCD_CLOCKWISE_00 + image_nHour)); 
gdi_image_draw_id(0, 0, (IMG_SUBLCD_MINUTE_HAND_00 + image_nMin)); 
gdi_pop_and_restore_alpha_blending_source_layer();   
}


void mmi_idle_sublcd_analog_clock(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    GDI_HANDLE act_lcd = GDI_ERROR_HANDLE;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
if (srv_backlight_is_lcd_sleep())
{
StopTimer(SUBLCD_ANALOG_CLOCK_TIMER);
return;
}


    gdi_lcd_get_active(&act_lcd);
    if (act_lcd != GDI_LCD_SUB_LCD_HANDLE)
    {
        UI_set_sub_LCD_graphics_context();
    }    
    gdi_layer_lock_frame_buffer();


    gdi_layer_push_clip();
    gdi_layer_reset_clip();
    gdi_image_draw(0, 0, get_image(IMG_SUBLCD_ANALOG_CLOCK_BG));
    wgui_clock_show_sub_lcd();
mmi_idle_sublcd_diplay_clockwise();
    gdi_layer_pop_clip();
    gdi_layer_unlock_frame_buffer();
    gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1);


    if (act_lcd == GDI_LCD_MAIN_LCD_HANDLE)
    {
        UI_set_main_LCD_graphics_context();
    }


StartTimer(SUBLCD_ANALOG_CLOCK_TIMER,1000,mmi_idle_sublcd_analog_clock);
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

faver_v

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值