Re: Regarding gdk_draw_line



From: Jyothi <jyothi ncoretech com>
>
> Hi,
>
>     I am trying to draw lines on a drawing area based on the mouse
> motion event. ie. when the mouse moves on the drawing area, I just
> collect the x and y points and use gdk_draw_line to connect b/w two
> points. I do this till I get button-release event. So, everytime I get 2
> points , I draw a line . But problem I am facing is when I draw a line
> for the current 2 points , the last lines are not getting stored on the
> drawing area. It is getting erased. What should I do to retain the older
> drawn lines also.

There's a basic flaw in your thinking:

gtk uses the X model of stateless drawing. Therefore, a drawing
area doesn't "store" _anything_. You need to 1) draw only in the
expose event, and 2) draw _all_ the lines every time.

Aside from that, how you store the information about lines so it's
available at drawing time is up to you.

Ron Steinke



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