// Lua: ucg.setClipRange( self, x, y, w, h ) static int lucg_setClipRange( 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_SetClipRange( LUCG, args[0], args[1], args[2], args[3] ); return 0; }
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"); }