Example #1
0
File: main.c Project: gnkarn/ucglib
void prepare_picture(ucg_t *ucg)
{
    tga_init(128,64);
    ucg_Init(ucg, &ucg_dev_tga, ucg_ext_none, (ucg_com_fnptr)0);
    ucg_SetFontMode(ucg, UCG_FONT_MODE_TRANSPARENT);
    ucg_SetMaxClipRange(ucg);
    ucg_SetColor(ucg, 0, 0, 0, 0);
    ucg_DrawBox(ucg, ox, 0, 128, 64);
}
Example #2
0
File: main.c Project: gnkarn/ucglib
void draw_box(ucg_t *ucg)
{
    prepare_picture(ucg);
    hrule(ucg, ox+50, 30, 45, 0);
    vrule(ucg, ox+50+45-1, 30, 20, 1);
    ucg_SetColor(ucg, 0, 255, 255, 255);

    ucg_DrawBox(ucg, ox+50, 30, 45, 20);
    pos(ucg, ox+50, 30,0);
    save_picture(ucg, "draw_box");
}
Example #3
0
// Lua: ucg.drawBox( self, x, y, w, h )
static int lucg_drawBox( lua_State *L )
{
    lucg_userdata_t *lud;

    if ((lud = get_lud( L )) == NULL)
        return 0;

    ucg_int_t args[4];
    lucg_get_int_args( L, 2, 4, args );

    ucg_DrawBox( LUCG, args[0], args[1], args[2], args[3] );

    return 0;
}
Example #4
0
File: main.c Project: gnkarn/ucglib
void set_clip_range(ucg_t *ucg)
{
    prepare_picture(ucg);

    ucg_SetFontPosBaseline(ucg);
    ucg_SetFont(ucg, ucg_font_ncenB18_tf);
    ucg_SetColor(ucg, 0, 255, 255, 255);		/* draw white A */
    ucg_DrawGlyph(ucg, 50, 40, 0, 'A');
    ucg_SetClipRange(ucg, 57, 20, 30, 15);	/* restrict area */
    ucg_SetColor(ucg, 0, 0, 0, 127);
    ucg_DrawBox(ucg, 0, 0, 128, 64);		/* fill the restricted area with dark blue */
    ucg_SetColor(ucg, 0, 0, 0, 255);
    ucg_DrawGlyph(ucg, 50, 40, 0, 'A');	/* draw light blue A */

    hrule(ucg, ox+57, 20, 30, 0);
    vrule(ucg, ox+57+30, 20, 15, 1);
    pos(ucg, ox+50, 40, 0);
    save_picture(ucg, "set_clip_range");
}
Example #5
0
File: main.c Project: gnkarn/ucglib
int main(void)
{

    tga_init(128,64);
    ucg_Init(&ucg, &ucg_dev_tga, ucg_ext_none, (ucg_com_fnptr)0);
    ucg_SetFontMode(&ucg, UCG_FONT_MODE_TRANSPARENT);

    ucg_SetColor(&ucg, 0, 0, 0, 0);
    ucg_DrawBox(&ucg, 0, 0, 128, 64);



    ucg_SetFont(&ucg, ucg_font_ncenB18_tf);

    ucg_SetColor(&ucg, 0, 0, 0, 255);
    ucg_DrawPixel(&ucg, 70,20);
    ucg_SetColor(&ucg, 0, 255, 0, 0);

    //ucg_SetFontPosBottom(&ucg);
    /*
    ucg_DrawGlyph(&ucg, 70, 20, 0, 'A');
    ucg_DrawGlyph(&ucg, 70, 20, 1, 'A');
    ucg_DrawGlyph(&ucg, 70, 20, 2, 'A');
    ucg_DrawGlyph(&ucg, 70, 20, 3, 'A');

    ucg_SetColor(&ucg, 0, 255, 255, 255);

    vrule(&ucg, 30, 0, 20, 1);
    vrule(&ucg, 30, 0, 20, 0);
    */
    //pos(&ucg, 70, 20, 0);

    //hrule(&ucg, 0, 20, 70, 1);
    //hrule(&ucg, 0, 20, 70, 0);


    ucg_SetColor(&ucg, 0, 255, 0, 0);
    ucg_SetColor(&ucg, 1, 0, 255, 0);
    ucg_SetColor(&ucg, 2, 255, 0, 255);
    ucg_SetColor(&ucg, 3, 0, 255, 255);

    ucg_DrawGradientLine(&ucg, 10, 40, 100, 0);

    ucg_DrawGradientBox(&ucg, 10, 43, 100, 20);


    tga_save("test.tga");

    draw_pixel(&ucg);
    draw_hline(&ucg);
    draw_vline(&ucg);
    set_clip_range(&ucg);
    draw_text_baseline(&ucg);
    draw_text_bottom(&ucg);
    draw_text_top(&ucg);
    draw_text_center(&ucg);
    draw_text_ascent_descent(&ucg);
    draw_text_dir1(&ucg);
    draw_box(&ucg);
    draw_frame(&ucg);
    draw_rbox(&ucg);
    draw_rframe(&ucg);
    draw_gradient_box(&ucg);
    draw_gradient_line(&ucg);
    draw_disc(&ucg);
    draw_circle(&ucg);
    draw_triangle(&ucg);
    set_scale2x2(&ucg);
    set_font_mode_1(&ucg);
    set_font_mode_2(&ucg);
    solid_font_variants(&ucg);
    string_overwrite(&ucg, 1);
    string_overwrite(&ucg, 5);
    string_overwrite(&ucg, 10);
    return 0;

}