Re: Cairo clearing problem.



Hi, Carlos

Where do you use your drawing operation? As GTK suggested (like
GtkDrawingArea), you have to do it in "expose_event":

* The "expose_event" signal to handle redrawing the contents of the widget.

Here you can have several if's:
if (something)
   draw_lines();
else
   draw_other_lines();

"something" can be a simple enum, or gboolean, which is assigned
elsewhere. By the way, after changing it, you can send signals by
yourself, to redraw your widget.

Good luck,
Vlad Volodin

2009/5/8 Developer <csavoretti clubsanjorge com ar>:
Hi all!

Well, I'm having a problem with clearing a line.

---
   Âcairo_t *cr;
   Âcr = gdk_cairo_create (widget->window);

   Âcairo_set_source_rgba (cr, 0, 0, 0, 1);

   Âstatic const double dashed[] = { 3.0 };
   Âcairo_set_line_width (cr, 1.5);
   Âcairo_set_dash (cr, dashed, 1, 0);

   Âcairo_move_to (cr, RECTANGLE_GAP, RECTANGLE_GAP);
   Âcairo_rel_line_to (cr, width - (RECTANGLE_GAP * 2), 0);
   Âcairo_rel_line_to (cr, 0, height - (RECTANGLE_GAP * 2));
   Âcairo_rel_line_to (cr, -(width - (RECTANGLE_GAP * 2)), 0);
   Âcairo_close_path (cr);
   Âcairo_stroke (cr);

   Âcairo_destroy (cr);
---

It intends to set a dotted rectangle around the
border of a GtkVBox. Then, it must be erased
without affecting the inner widgets.

I thought that having the current path
it could be used after to clear just that drawn
in this path. Is there a way to do it?

I've used gdk_window_clear (), but child widgets
in the box are cleared also, which is undesired
of course.

Any suggestion ?

Thanks in advance...

Carlos Savoretti.


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]