Пример #1
0
// Lua: ucg.setFontPosTop( self )
static int lucg_setFontPosTop( lua_State *L )
{
    lucg_userdata_t *lud;

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

    ucg_SetFontPosTop( LUCG );

    return 0;
}
Пример #2
0
void draw_text_top(ucg_t *ucg)
{
    prepare_picture(ucg);

    ucg_SetFont(ucg, ucg_font_ncenB18_tf);
    ucg_SetFontPosTop(ucg);
    ucg_SetColor(ucg, 0, 0, 0, 255);		/* draw blue "baseline" */
    ucg_DrawHLine(ucg, 45+ox, 30, ucg_GetStrWidth(ucg, "Ucg"));
    ucg_SetColor(ucg, 0, 255, 255, 255);		/* draw white "Ucg" */
    ucg_DrawString(ucg, 45+ox, 30, 0, "Ucg");
    pos(ucg, 45+ox, 30, 0);

    save_picture(ucg, "draw_text_top");
}
Пример #3
0
/*
  pos = 1 above
  pos = 0
  pos = -1 below
*/
void hrule(ucg_t *ucg, ucg_int_t x, ucg_int_t y, ucg_int_t len, int is_below)
{
    char s[10];
    ucg_int_t o = rule_offset;
    ucg_int_t w;

    if ( is_below )
    {
        ucg_SetFontPosTop(ucg);
        o  = -o;
    }
    else
    {
        ucg_SetFontPosBottom(ucg);
    }

    prepare_measure(ucg);
    ucg_DrawHLine(ucg, x, y-o, len);
    ucg_DrawVLine(ucg, x, y-1-o, 3);
    ucg_DrawVLine(ucg, x+len-1, y-1-o, 3);
    sprintf(s, "%d", len);
    w = ucg_GetStrWidth(ucg, s);
    ucg_DrawString(ucg, x + len/2 - w/2, y-o+1, 0, s);
}