コード例 #1
0
ファイル: splash_page.c プロジェクト: DeviationTX/deviation
void PAGE_SplashInit(int page)
{
    (void)page;
    if(Transmitter.splash_delay == 0) {
        PAGE_ChangeByID(PAGEID_MAIN, 0);
        return;
    }
    PAGE_SetActionCB(_action_cb);
    u16 w, h;
    LCD_ImageDimensions(SPLASH_FILE, &w, &h);
    //GUI_CreateImageOffset(&gui->splash_image, 15, 10, w-offset, h-5, offset, 0, SPLASH_FILE, NULL, NULL);
    if( w < LCD_WIDTH - 1 && h < LCD_HEIGHT - LINE_HEIGHT - 3)
    	GUI_CreateImageOffset(&gui->splash_image, (LCD_WIDTH-w)/2, (LCD_HEIGHT-h-LINE_HEIGHT)/2, w, h, 0, 0, SPLASH_FILE, NULL, NULL);
    GUI_CreateLabelBox(&gui->version, 0, LCD_HEIGHT - LINE_HEIGHT - 1 , LCD_WIDTH, LINE_HEIGHT, &TINY_FONT, NULL, NULL, DeviationVersion);
}
コード例 #2
0
ファイル: image.c プロジェクト: supermk2/Deviation
void _GUI_ChangeImage(struct guiImage *image, const char *file, u16 x_off, u16 y_off, u8 replace)
{
    guiObject_t *obj = (guiObject_t *)image;
    //Use a CRC for comparison because the filename may change without the pointer changing
    u32 crc = Crc(file, strlen(file));
    if (image->file != file || image->crc != crc || image->x_off != x_off || image->y_off != y_off) {
        if (replace) {
            // draw background where the old picture was bigger
            struct guiBox *box = &obj->box;
            u16 w, h;
            LCD_ImageDimensions(file, &w, &h);
            if (h < box->height) GUI_DrawBackground(box->x, box->y + h, box->width, box->height - h);    // remove lower left part of old image
            if (w < box->width) GUI_DrawBackground(box->x + w, box->y, box->width - w, h < box->height ? h : box->height);    // remove upper right part of old image
            box->width = w;
            box->height = h;
        }
        image->crc = crc;
        image->file = file;
        image->x_off = x_off;
        image->y_off = y_off;
        OBJ_SET_TRANSPARENT(obj, LCD_ImageIsTransparent(file));
        OBJ_SET_DIRTY(obj, 1);
    }
}