int draw_cell(struct font *font, struct cell *c, int x, int y) { struct glyph *glyph; uint32_t *bitmap; int i; if (!font || !c) { return 1; } if (c->ch >= font->count) { glyph = font->def_glyph; } else { glyph = font->glyph[c->ch]; if (!glyph) { glyph = font->def_glyph; if (!glyph) { return 1; } } } // construct bitmap bitmap = malloc(sizeof(uint32_t) * glyph->w * glyph->h); for (i = 0; i < glyph->w * glyph->h; i++) { bitmap[i] = (glyph->value[i]) ? c->fg : c->bg; } // blit onto framebuffer fb_blit(fb, bitmap, x, y, glyph->w, glyph->h); free(bitmap); return 0; }
void gfx_glyph_draw(FB_Surface *sfc, FB_Surface *font, int x, int y, unsigned char c) { int w = font->width / 95, h = font->height; FB_Rectangle d = { x, y, w, h }; FB_Rectangle s = { x, 0, w, h }; if (c > 32) { s.x = (c - 32) * w; fb_blit(font, &s, sfc, &d, 0); } }
bool_t fb_putcode(struct fb * fb, u32_t code, u32_t fc, u32_t bc, u32_t x, u32_t y) { struct surface_t * face; bool_t ret; face = surface_alloc_from_gimage(lookup_console_font_face(code, fc, bc)); if(!face) return FALSE; ret = fb_blit(fb, face, x, y, face->w, face->h, 0, 0); surface_free(face); return ret; }
/* * scroll up */ static bool_t fbcon_scrollup(struct console * console) { struct fb_console_info * info = console->priv; struct fbcon_cell * p, * q; s32_t m, l; s32_t i; l = info->w; m = info->clen - l; p = &(info->cell[0]); q = &(info->cell[l]); for(i = 0; i < m; i++) { p->cp = q->cp; p->fc = q->fc; p->bc = q->bc; p++; q++; } while( (l--) > 0 ) { p->cp = UNICODE_SPACE; p->fc = info->fc; p->bc = info->bc; p++; } fb_blit(info->fb, &info->fb->info->surface, 0, 0, (info->w * info->fw), ((info->h - 1) * info->fh), 0, info->fh); fb_fill_rect(info->fb, info->bc, 0, ((info->h - 1) * info->fh), (info->w * info->fw), info->fh); fbcon_gotoxy(console, info->x, info->y - 1); return TRUE; }