Exemplo n.º 1
0
Arquivo: main.c Projeto: gnkarn/ucglib
void solid_font_variants(ucg_t *ucg)
{
    prepare_picture(ucg);

    ucg_SetColor(ucg, 0, 250, 0, 0);
    ucg_SetColor(ucg, 1, 255, 255, 30);
    ucg_SetColor(ucg, 2, 220, 235, 10);
    ucg_SetColor(ucg, 3, 205, 0, 30);

    ucg_DrawGradientBox(ucg, ox+0, 0, 128, 64);

    ucg_SetColor(ucg, 0, 0, 0, 0);		/* draw black "Ucg" */
    ucg_SetColor(ucg, 1, 150, 220, 255);		/* light blue background */
    ucg_SetFontMode(ucg, UCG_FONT_MODE_SOLID);
    ucg_SetFontPosBaseline(ucg);

    ucg_SetFont(ucg, ucg_font_fur11_tf);
    ucg_DrawString(ucg, 3+ox, 20, 0, "fur11_tf");

    ucg_SetFont(ucg, ucg_font_fur11_hf);
    ucg_DrawString(ucg, 3+ox, 50, 0, "fur11_hf");

    ucg_SetFont(ucg, ucg_font_fur11_hr);
    ucg_DrawString(ucg, 68+ox, 50, 0, "fur11_hr");


    //pos(ucg, 42+ox, 40, 0);

    save_picture(ucg, "solid_font_variants");
}
Exemplo n.º 2
0
// Lua: ucg.drawGradientBox( self, x, y, w, h )
static int lucg_drawGradientBox( 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_DrawGradientBox( LUCG, args[0], args[1], args[2], args[3] );

    return 0;
}
Exemplo n.º 3
0
Arquivo: main.c Projeto: gnkarn/ucglib
void draw_gradient_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, 0, 0);
    ucg_SetColor(ucg, 1, 0, 255, 0);
    ucg_SetColor(ucg, 2, 255, 0, 255);
    ucg_SetColor(ucg, 3, 0, 255, 255);

    ucg_DrawGradientBox(ucg, ox+50, 30, 45, 20);

    pos(ucg, ox+50, 30,0);
    save_picture(ucg, "draw_gradient_box");
}
Exemplo n.º 4
0
void upper_pin(ucg_t *ucg, ucg_int_t x, ucg_int_t y)
{
  ucg_int_t w = 7;
  ucg_int_t h = 6;
  ucg_SetColor(ucg, 0, 212, 212, 212);
  ucg_SetColor(ucg, 1, 200, 200, 200);
  ucg_SetColor(ucg, 2, 200, 200, 200);
  ucg_SetColor(ucg, 3, 188, 188, 188);
  ucg_DrawGradientBox(ucg, x, y, w, h);

  //ucg_DrawVLine(ucg, x+w, y+1, len);
  ucg_SetColor(ucg, 0, 220, 220, 220);
  ucg_SetColor(ucg, 1, 232, 232, 232);
  ucg_DrawGradientLine(ucg, x+w, y, h, 1);
}
Exemplo n.º 5
0
Arquivo: main.c Projeto: gnkarn/ucglib
void set_font_mode_1(ucg_t *ucg)
{
    prepare_picture(ucg);

    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_DrawGradientBox(ucg, ox+0, 0, 128, 64);

    ucg_SetFontMode(ucg, UCG_FONT_MODE_TRANSPARENT);
    ucg_SetFont(ucg, ucg_font_ncenB18_tf);
    ucg_SetFontPosBaseline(ucg);
    ucg_SetColor(ucg, 0, 0, 0, 0);		/* draw black "Ucg" */
    ucg_DrawString(ucg, 40+ox, 40, 0, "Ucg");
    pos(ucg, 42+ox, 40, 0);

    save_picture(ucg, "set_font_mode_1");
}
Exemplo n.º 6
0
Arquivo: main.c Projeto: gnkarn/ucglib
void set_font_mode_2(ucg_t *ucg)
{
    prepare_picture(ucg);

    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_DrawGradientBox(ucg, ox+0, 0, 128, 64);

    ucg_SetFontMode(ucg, UCG_FONT_MODE_SOLID);
    ucg_SetFont(ucg, ucg_font_ncenB18_hr);
    ucg_SetFontPosBaseline(ucg);
    ucg_SetColor(ucg, 0, 0, 0, 0);		/* draw black "Ucg" */
    ucg_SetColor(ucg, 1, 150, 220, 255);		/* light blue background */
    ucg_DrawString(ucg, 40+ox, 40, 0, "Ucg");
    pos(ucg, 42+ox, 40, 0);

    save_picture(ucg, "set_font_mode_2");
}
Exemplo n.º 7
0
Arquivo: main.c Projeto: gnkarn/ucglib
void string_overwrite(ucg_t *ucg, int cnt)
{
    char s[40];
    int i;
    prepare_picture(ucg);

    ucg_SetColor(ucg, 0, 250, 0, 0);
    ucg_SetColor(ucg, 1, 255, 255, 30);
    ucg_SetColor(ucg, 2, 220, 235, 10);
    ucg_SetColor(ucg, 3, 205, 0, 30);

    ucg_DrawGradientBox(ucg, ox+0, 0, 128, 64);

    ucg_SetColor(ucg, 0, 0, 0, 0);		/* draw black "Ucg" */
    ucg_SetColor(ucg, 1, 150, 220, 255);		/* light blue background */
    ucg_SetFontMode(ucg, UCG_FONT_MODE_SOLID);
    ucg_SetFontPosBaseline(ucg);

    for( i = 11; i < 11+cnt; i++ )
    {
        sprintf(s, "cu12_tf %d", i);
        ucg_SetFont(ucg, ucg_font_cu12_tf);
        ucg_DrawString(ucg, 1+ox, 15, 0, s);

        sprintf(s, "cu12_hf %d", i);
        ucg_SetFont(ucg, ucg_font_cu12_hf);
        ucg_DrawString(ucg, 1+ox, 35, 0, s);

        sprintf(s, "7x14_mf %d", i);
        ucg_SetFont(ucg, ucg_font_7x14_mf);
        ucg_DrawString(ucg, 1+ox, 55, 0, s);
    }

    //pos(ucg, 42+ox, 40, 0);

    sprintf(s, "string_overwrite_%d", cnt);
    save_picture(ucg, s);
}
Exemplo n.º 8
0
void ic_body(ucg_t *ucg, ucg_int_t x, ucg_int_t y)
{
  ucg_int_t w = 4*14+4;
  ucg_int_t h = 31;
  ucg_SetColor(ucg, 0, 60, 60, 60);
  ucg_SetColor(ucg, 1, 40, 40, 40);
  ucg_SetColor(ucg, 2, 48, 48, 48);
  ucg_SetColor(ucg, 3, 30, 30, 30);
  ucg_DrawGradientBox(ucg, x, y, w, h);
  
  ucg_SetColor(ucg, 0, 255, 168, 0);
  //ucg_SetColor(ucg, 0, 225, 168, 30);
  ucg_DrawDisc(ucg, x+w-1, y+h/2-1, 7, UCG_DRAW_UPPER_LEFT|UCG_DRAW_LOWER_LEFT);

  ucg_SetColor(ucg, 0, 60, 30, 0);
  //ucg_DrawDisc(ucg, x+w-1, y+h/2+1, 7, UCG_DRAW_UPPER_LEFT|UCG_DRAW_LOWER_LEFT);

  ucg_SetColor(ucg, 0, 50, 50, 50);
  ucg_SetColor(ucg, 0, 25, 25, 25);
  ucg_DrawDisc(ucg, x+w-1, y+h/2+1, 7, UCG_DRAW_UPPER_LEFT|UCG_DRAW_LOWER_LEFT);
  
  
}
Exemplo n.º 9
0
Arquivo: main.c Projeto: 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;

}
Exemplo n.º 10
0
int main(void)
{
  ucg_int_t a,b;
  
  ucg_Init(&ucg, ucg_sdl_dev_cb, ucg_ext_none, (ucg_com_fnptr)0);
  ucg_SetFontMode(&ucg, UCG_FONT_MODE_TRANSPARENT);
  ucg_SetFont(&ucg, ucg_font_ncenB24);  
  //ucg_SetRotate90(&ucg);
  
  //ucg_SetRotate270(&ucg);  
  //ucg_SetClipRange(&ucg, 10,5,40,20);


  
  a = 2;
  b = 3;
  
  ucg_SetColor(&ucg, 0, 135*a/b,206*a/b,250*a/b);
  ucg_SetColor(&ucg, 1, 176*a/b,226*a/b,255*a/b);
  ucg_SetColor(&ucg, 2, 25*a/b,25*a/b,112*a/b);
  ucg_SetColor(&ucg, 3, 	85*a/b,26*a/b,139*a/b);
  ucg_DrawGradientBox(&ucg, 0, 0, ucg_GetWidth(&ucg)/4, ucg_GetHeight(&ucg));

  ucg_SetColor(&ucg, 1, 135*a/b,206*a/b,250*a/b);
  ucg_SetColor(&ucg, 0, 176*a/b,226*a/b,255*a/b);
  ucg_SetColor(&ucg, 3, 25*a/b,25*a/b,112*a/b);
  ucg_SetColor(&ucg, 2, 	85*a/b,26*a/b,139*a/b);
  ucg_DrawGradientBox(&ucg, ucg_GetWidth(&ucg)/4, 0, ucg_GetWidth(&ucg)/4, ucg_GetHeight(&ucg));

  ucg_SetColor(&ucg, 0, 135*a/b,206*a/b,250*a/b);
  ucg_SetColor(&ucg, 1, 176*a/b,226*a/b,255*a/b);
  ucg_SetColor(&ucg, 2, 25*a/b,25*a/b,112*a/b);
  ucg_SetColor(&ucg, 3, 	85*a/b,26*a/b,139*a/b);
  ucg_DrawGradientBox(&ucg, ucg_GetWidth(&ucg)*2/4, 0, ucg_GetWidth(&ucg)/4, ucg_GetHeight(&ucg));

  ucg_SetColor(&ucg, 1, 135*a/b,206*a/b,250*a/b);
  ucg_SetColor(&ucg, 0, 176*a/b,226*a/b,255*a/b);
  ucg_SetColor(&ucg, 3, 25*a/b,25*a/b,112*a/b);
  ucg_SetColor(&ucg, 2, 	85*a/b,26*a/b,139*a/b);
  ucg_DrawGradientBox(&ucg, ucg_GetWidth(&ucg)*3/4, 0, ucg_GetWidth(&ucg)/4, ucg_GetHeight(&ucg));
  
  
  upper_pin(&ucg, 7+0*14, 4);
  upper_pin(&ucg, 7+1*14, 4);
  upper_pin(&ucg, 7+2*14, 4);
  upper_pin(&ucg, 7+3*14, 4);
  
  ic_body(&ucg, 2, 10);

  lower_pin(&ucg, 7+0*14, 41);
  lower_pin(&ucg, 7+1*14, 41);
  lower_pin(&ucg, 7+2*14, 41);
  lower_pin(&ucg, 7+3*14, 41);

  ucg_SetColor(&ucg, 0, 135*a/b, 206*a/b, 250*a/b);
  ucg_DrawString(&ucg, 63+1, 33+1, 0, "glib");

  ucg_SetColor(&ucg, 0, 255, 168, 0);
  ucg_DrawGlyph(&ucg, 26, 38, 0, 'U');
  ucg_DrawString(&ucg, 63, 33, 0, "glib");

  ucg_SetColor(&ucg, 0, 135*a/b, 206*a/b, 250*a/b);
  ucg_SetColor(&ucg, 1, 135*a/b, 206*a/b, 250*a/b);
  ucg_SetColor(&ucg, 2, 135*a/b, 206*a/b, 250*a/b);
  ucg_SetColor(&ucg, 3, 135*a/b, 206*a/b, 250*a/b);
  ucg_DrawGradientBox(&ucg, 84+1, 42+1-6, 42, 4);

  ucg_SetColor(&ucg, 0, 255, 180, 40);
  ucg_SetColor(&ucg, 1, 235, 148, 0);
  //ucg_DrawGradientLine(&ucg, 79, 42, 20, 0);
  ucg_SetColor(&ucg, 2, 245, 158, 0);
  ucg_SetColor(&ucg, 3, 220, 138, 0);
  ucg_DrawGradientBox(&ucg, 84, 42-6, 42, 4);

  ucg_SetColor(&ucg, 0, 255, 168, 0);
  ucg_SetFont(&ucg, ucg_font_5x8);
  //ucg_SetFont(&ucg, ucg_font_courB08);
  ucg_DrawString(&ucg, 2, 54, 0, "http://");
  ucg_DrawString(&ucg, 1, 61, 0, "code.google.com/p/ucglib/");


  while( ucg_sdl_get_key() < 0 )
    ;
    
  
  return 0;
}