[cairo] Erasing A Line

Allen allen.saucier at cas-inc.com
Fri Jun 29 05:28:39 PDT 2007


Ivan,

this seems to be an even shorter method to draw.

1. re-drawn exposed image
2. draw new line & don't worry w/ drawing old line because it will be 
erased anyway w/ the "expose" event.

Ivan Baldo wrote:
>     Yes!
>    But if you have a background image, then almost certainly you will 
> end having a Cairo Surface for it, so what you do after the user moves 
> the mouse is this:
Ok, here I"m having to check for the event "motion move" which sends 
back oodles & oodles & signals.  But if I confine the motion_notify 
events that I'm interested in by only responding to ones that start w/ a 
button_press_event, then I think this method will work.  For the final 
line will be shown by the time the user preforms a button_release event 
and I will not have to process any further motion_notify events
>       - generate an expose event for the area occupied by the old line 
> and the new line, 2 calls to gtk_widget_queue_draw_area (it will join 
> both rectangles and generate only 1 expose event).
>       - on the expose event of the DrawingArea or Image you draw with 
> Cairo, first clip with gdk_cairo_region(cr, event->region); 
> cairo_clip(cr), then draw first the background image, then the line at 
> the place where the mouse is pointing.
>    You really don't need transparency or real layers, just draw things 
> in the correct order.
>
This is really cool.  Thanks for the info.  I really appreciate it. This 
is great!  thanks everyone!!!  You're very nice & very helpful.  I hope 
to be helpful as I get better.

-- 
Sincerely, Allen

Gene Allen Saucier, Jr
Software Engineer
EDO-CAS, Inc
Madison Research Park, Bld 111
111 Research Blvd
Madison, AL  35758
"...As for I and my house, we shall follow the Lord"  Joshua 24:15



More information about the cairo mailing list