int main() { GUI* g=NULL; WIDGET* pic=NULL; g=init_gui(); create_main_window(g,"Example GUI"); set_main_size(g,500,500); build_labs(g); build_buts(g); build_check(g); build_radio(g); build_text(g); build_misc(g); pic=create_picture(g,"pic.xpm",10,300); add_to_main(g,pic); show_main(g); while(gui_running(g)){ usleep(250000); } destroy_gui(g); return 0; }
void compositor_extrude_text(GF_Node *node, GF_TraverseState *tr_state, GF_Mesh *mesh, MFVec3f *thespine, Fixed creaseAngle, Bool begin_cap, Bool end_cap, MFRotation *spine_ori, MFVec2f *spine_scale, Bool txAlongSpine) { u32 i, count; Fixed min_cx, min_cy, width_cx, width_cy; TextStack *st = (TextStack *) gf_node_get_private(node); /*rebuild text node*/ if (gf_node_dirty_get(node)) { ParentNode2D *parent = tr_state->parent; tr_state->parent = NULL; text_clean_paths(tr_state->visual->compositor, st); drawable_reset_path(st->graph); gf_node_dirty_clear(node, 0); build_text(st, (M_Text *)node, tr_state); tr_state->parent = parent; } min_cx = st->bounds.x; min_cy = st->bounds.y - st->bounds.height; width_cx = st->bounds.width; width_cy = st->bounds.height; mesh_reset(mesh); count = gf_list_count(st->spans); for (i=0; i<count; i++) { GF_TextSpan *span = (GF_TextSpan *)gf_list_get(st->spans, i); GF_Path *span_path = gf_font_span_create_path(span); mesh_extrude_path_ext(mesh, span_path, thespine, creaseAngle, min_cx, min_cy, width_cx, width_cy, begin_cap, end_cap, spine_ori, spine_scale, txAlongSpine); gf_path_del(span_path); } mesh_update_bounds(mesh); gf_mesh_build_aabbtree(mesh); }
void Text::draw(clan::Canvas &canvas, const clan::Rect &rect) { int out_draw_offset; std::string text = build_text(canvas, rect.get_width(), scroller_xoffset, out_draw_offset); int ypos = rect.bottom - ((rect.get_height() - font_metrics.get_ascent())/2); // Remove the next line to observe how the clipping works canvas.set_cliprect(rect); font.draw_text(canvas, rect.left - out_draw_offset, ypos, text); canvas.reset_cliprect(); }
static void text_check_changes(GF_Node *node, TextStack *stack, GF_TraverseState *tr_state) { if (gf_node_dirty_get(node) || tr_state->visual->compositor->reset_fonts) { text_clean_paths(tr_state->visual->compositor, stack); build_text(stack, (M_Text*)node, tr_state); gf_node_dirty_clear(node, 0); drawable_mark_modified(stack->graph, tr_state); } if (tr_state->visual->compositor->edited_text && (tr_state->visual->compositor->focus_node==node)) { drawable_mark_modified(stack->graph, tr_state); tr_state->visual->has_text_edit = 1; if (!stack->bounds.width) stack->bounds.width = INT2FIX(1)/100; if (!stack->bounds.height) stack->bounds.height = INT2FIX(1)/100; } }