void gfx_writepixel( struct image *img, int x, int y, struct color *col ) { Pixel *pixel; if( !img ) return; if( !img->im_pixels ) return; if( !gfx_withinbounds( img, x, y ) ) return; pixel=&(img->im_pixels[xytoff(img,x,y)]); gfx_putpixel( pixel, col ); }
/** * @brief Draw one character from the built-in font * * @ingroup graphics */ void font_draw_char(gfx_surface *surface, unsigned char c, int x, int y, uint32_t color) { uint i,j; uint line; // draw this char into a buffer for (i = 0; i < FONT_Y; i++) { line = FONT[c * FONT_Y + i]; for (j = 0; j < FONT_X; j++) { if (line & 0x1) gfx_putpixel(surface, x + j, y + i, color); line = line >> 1; } } gfx_flush_rows(surface, y, y + FONT_Y); }
void gfx_rectfill( struct image *img, int x1, int y1, int x2, int y2, struct color *col ) { int row; //, rgb; long off, end; Pixel *pixel; if( !img ) return; if( !img->im_pixels ) return; for( row=y1 ; row<y2 ; row++ ) { off=(row*img->im_width)+x1; end=off+x2-x1; for( ; off<end; off++ ) { pixel=&(img->im_pixels[off]); gfx_putpixel( pixel, col ); } } }