Re: Re-drawing GtkDrawingArea surface on motion-notify-event



On Sun, 2017-03-19 at 22:12 +0000, Marcin Kolny wrote:
I'd like to write very simple application for drawing lines.

You can restrict all drawing operations to a rectangle enclosing your
line. For each move with button pressed, fill that rectangle with
background color and then draw the line with foreground color. Or, you
may save the old line start and end points and paint that old line with
background color before drawing the new line. I think there is not much
benefit for using an temporary surface for this use case.

For more complicated graphics it can become a bit slow indeed -- I once
tried it for my schematics editor -- there I used a bounding box for
all the graphical elements, when one element is moved, I had to draw
its background and then all other elements overlapping with that
background element. Using OpenGl may be faster and easier, because you
can fast just redraw all. I think GTK3 now has a gl-area widget. The
problem with Gl is that it is basically more for drawing triangles than
for drawing lines... 


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