void draw_icon(struct icon *icon) { int i, j; bmphandle_t bh; if (icon->mode) { bh = bmp_open(icon->name); if (bh == NULL) { perror("bmp_open"); return; } for (i=icon->y; i<icon->y+bmp_height(bh); i++) for (j=icon->x; j<icon->x+bmp_width(bh); j++) *(myfb->fb + i*myfb->fbvar.xres +j) = makepixel(bmp_getpixel(bh, j-icon->x, i-icon->y)); bmp_close(bh); } else { drow_rect(icon->x, icon->y, icon->x + icon->w, icon->y + icon->h, icon->color); put_string_center(icon->x + icon->w/2, icon->y + icon->h/2, icon->name, icon->color); } }
void display_shooting_info() // called from debug task { if (lv) return; #ifdef FEATURE_FLEXINFO // from flexinfo.c info_print_screen(); #endif // the following is stuff not yet ported to flexinfo #ifdef FEATURE_LCD_SENSOR_REMOTE display_lcd_remote_icon(555, 460); #endif // hack for Rebel cameras to display intermediate ISOs iso_refresh_display(); display_trap_focus_info(); #ifdef STROBO_READY_AND_WE_CAN_USE_IT int col_field = bmp_getpixel(20,10); if (flash_info.mode==STROBO_FLASH_MODE_MANUAL) { uint32_t fntl = FONT(FONT_LARGE, COLOR_YELLOW, col_field); fnt = FONT(FONT_SMALL, COLOR_CYAN, col_field); bmp_printf(fnt, 488, 188, "A"); bmp_printf(fntl, 498, 185, "%3d", 1 << flash_info.group_a_output); bmp_printf(fnt, 556, 188, "B"); bmp_printf(fntl, 564, 185, "%3d", 1 << flash_info.group_b_output ); bmp_printf(fnt, 624, 188, "C"); bmp_printf(fntl, 632, 185, "%3d", 1 << flash_info.group_c_output); bmp_fill(col_bg,486,212,212,6); } #endif }
//for libgd2 < 2.99.999 gdImagePtr gdImageCreateFromBmpPtr(int size, void *data) { gdImagePtr ret; bmphandle_t bh; int h, w, i, j; struct bgrpixel r; int color; bh = bmp_open(data, size); if (bh == NULL) return NULL; h = bmp_height(bh); w = bmp_width(bh); ret = gdImageCreateTrueColor(w, h); for (i = 0; i < w; i++) { for (j = 0; j < h; j++) { r = bmp_getpixel(bh, i, j); color = gdImageColorResolve(ret, r.r, r.g, r.b); gdImageSetPixel(ret, i, j, color); } } bmp_close(bh); return ret; }