Changeset 1039 for libcaca/trunk
- Timestamp:
- Sep 17, 2006, 2:02:31 AM (16 years ago)
- Location:
- libcaca/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca/driver_gl.c
r1028 r1039 570 570 uint8_t *glyph32 = calloc(16*16*4, 1); 571 571 572 cucul_render_glyph(dp->drv.p->f, c, 573 glyph8, dp->drv.p->font_width, dp->drv.p->font_height); 574 572 cucul_render_glyph(dp->drv.p->f, c, glyph8, dp->drv.p->font_width); 575 573 576 574 /* Convert resulting 8bbp glyph to 32bits, 16x16*/ … … 604 602 uint8_t *glyph32 = calloc(16*16*4, 1); 605 603 606 cucul_render_glyph(dp->drv.p->f, c, 607 glyph8, dp->drv.p->font_width, dp->drv.p->font_height); 608 604 cucul_render_glyph(dp->drv.p->f, c, glyph8, dp->drv.p->font_width); 609 605 610 606 /* Convert resulting 8bbp glyph to 32bits, 16x16*/ -
libcaca/trunk/cucul/cucul.h
r1024 r1039 209 209 int cucul_render_canvas(cucul_canvas_t *, cucul_font_t *, void *, 210 210 unsigned int, unsigned int, unsigned int); 211 int cucul_render_glyph(cucul_font_t *, unsigned int, void *, 212 unsigned int, unsigned int); 211 int cucul_render_glyph(cucul_font_t *, unsigned int, void *, unsigned int); 213 212 int cucul_free_font(cucul_font_t *); 214 213 /* @} */ -
libcaca/trunk/cucul/font.c
r1024 r1039 448 448 /** \brief Render the given character onto given buffer 449 449 * 450 * This function renders the given character on an image buffer using a specific 451 * font. The pixel format is fixed (8 bits per pixel). 452 * 453 * The required buffer width can be computed using 454 * cucul_get_canvas_width() and cucul_get_font_width(). The required 455 * height can be computed using cucul_get_canvas_height() and 456 * cucul_get_font_height(). 457 * 458 * Glyphs that do not fit in the image buffer are currently not rendered at 459 * all. They may be cropped instead in future versions. 450 * This function renders the given character on an image buffer using a 451 * specific font. The pixel format is fixed (8 bits per pixel). 452 * 453 * The required buffer size can be computed using cucul_get_font_width() 454 * and cucul_get_font_height(). 460 455 * 461 456 * This function never fails. … … 464 459 * \param ch The character to render 465 460 * \param buf The image buffer 466 * \param width The width (in pixels) of the image buffer 467 * \param height The height (in pixels) of the image buffer 468 * \return This function return 1 if glyph is succesfully renderer, 0 otherwise 469 */ 470 int cucul_render_glyph(cucul_font_t *f, unsigned int ch, void *buffer, 471 unsigned int width, unsigned int height) 472 { 473 unsigned int b; 461 * \param pitch The pitch of the image buffer 462 * \return This function always returns 0. 463 */ 464 int cucul_render_glyph(cucul_font_t *f, unsigned int ch, void *buf, 465 unsigned int stride) 466 { 467 unsigned int b, y; 474 468 struct glyph_info *g; 475 uint8_t *glyph = buffer; 476 477 469 uint8_t *glyph; 478 470 479 471 /* Find the Unicode block where our glyph lies */ … … 493 485 if(b == f->header.blocks) 494 486 return 0; 487 488 if(f->header.bpp != 8) 489 glyph = malloc(f->header.width * f->header.height); 495 490 496 491 g = &f->glyph_list[f->block_list[b].index … … 516 511 break; 517 512 } 518 return 1; 519 } 520 521 513 514 /* Step 2: render glyph */ 515 for(y = 0; y < g->height; y++) 516 memcpy((uint8_t*)buf + y * stride, glyph + y * g->width, g->width); 517 518 if(f->header.bpp != 8) 519 free(glyph); 520 521 return 0; 522 } 522 523 523 524 /*
Note: See TracChangeset
for help on using the changeset viewer.