RE: Gtkmm draw line with mouse events



On 15 July 2014, quoth Gurjot Singh:
I meant that, taking an example that I showed earlier, when I call the
on_point_cb() it draws the point like defined and when I call the next
function on_line_cb(), the line is drawn but the previously drawn point
is wiped clean.
IDK maybe this is because I am using queue_draw() which re-draws the
entire widget. But if I understand it correctly, like you suggested that
cairo context is already equipped with clip region and I don't have to
explicitly define this clip_rectangle.

Like most GUI frameworks, drawing is not persistent.  When your
application-layer callbacks are called to add a line or a box or whatever to
the drawing model, you must internally store that (presumably you're doing
that anyway if you want to be able to load or save drawings).  When the
on_draw callback is called, you must assume the canvas is blank and redraw
everything that needs to be visible based on your previous storage.




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