clinuxgtkcairo

Clear cairo text in gtk_window


I'm have a trouble with a cairo text. I write some lines in a gtk_window:

cr = gdk_cairo_create(window->window);
        cairo_set_source_rgb(cr, 255, 255, 255);
        cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
        cairo_set_font_size(cr, 14.0);

        cairo_move_to(cr, 90.0, 85.0);
        cairo_show_text(cr, "Terror");
        cairo_set_font_size(cr, 12.0);
        cairo_set_source_rgb(cr, 30, 254, 145);
        cairo_move_to(cr, 90.0, 105.0);
        cairo_show_text(cr, "Underdogs");
        cairo_move_to(cr, 90.0, 120.0);
        cairo_show_text(cr, "Disziplin");
        cairo_destroy(cr);

The problem is that this text should be dynamic, but if I call more than one time the function that writes the text, lines is overlapped.

Is there any method that flushes the previous text?

Thanks!


Solution

  • You have to overwrite the text with the background color :)