[cairo] Erasing A Line
Allen
allen.saucier at cas-inc.com
Thu Jun 28 06:18:21 PDT 2007
Hi Ivan,
Thanks for the hints. & yes, I use Gtkmm. I was thinking of "layers"
or "surfaces" but being so new I don't really know how to use the
effectively. I'm checkout the "examples" right now.
But it sounds like, from what you have said, that I use 1 surface for
the Background (bg) image, and the "apply" another surface for drawing
on, which would need to be "clear" or really transparent. Then I draw
on the transparency.
Is this correct?
So, more questions! Does anyone have any code that uses surfaces as
layers that I might use?
Thanks everyone! I appreciate your help.
Ivan Baldo wrote:
> Hello!
>
> El 27/06/07 17:44, Allen escribió:
>> Could someone possibly tell me how to erase a line once I've drawn
>> it?
> Do you use GTK?
> What you can do in GTK is to create an expose event that refreshes the
> part where the line was before and the part where the line is now, so
> when you draw, the part where there is no line you draw a background
> and the part where there is a line you draw the background and the line.
> In GTK every expose event (a redraw of some part or all the picture)
> is a new Cairo context, so for persistence you can have Cairo surfaces
> (created with cairo_surface_create_similar()) to draw background or
> persistent things and the dynamic things (that line that follows
> mouse) you draw them on the fly.
>
>> I've tried to determine the "background" color of my Drawing area
>> widget - it's not white but WILL be a picture eventually - and the
>> Cairo context info does not show me how to get the background color
>> before drawing on it.
>>
> So you may start to support that background, instead of asking Cairo
> to read its contents -> you manage its contents, so you have a
> background surface and draw things over it, to clear something, just
> redraw the part you want to clear.
> You may think of it as different "layers".
>
>> Thanks so much. I really appreciate this.
>>
>>
> You are welcome!!!
> Hope this helps, don't hesitate to ask again or bring more information!
> Goodbye.
>
--
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