Re: "Animation" problems



"Felix E. Klee" wrote:
Here is the code that I use for the updates (its in gtk-- but should be
readable for everyone who knows gtk+):

    rect.x = 0; rect.y = 0; rect.width = 640; rect.height = 480;
    Gdk_GC gc = drawingArea->get_style()->get_white_gc();
    pixmap->draw_rectangle(gc, true, rect.x, rect.x, rect.width,
rect.height);
    gc = drawingArea->get_style()->get_black_gc();
    for (int i = 1; i <= N; ++i)
        pixmap->draw_line(gc, 320 + (int)(x[i-1] * 10.), (i-1) * 640 / N,
                          320 + (int)(x[i] * 10.), i * 640 / N);
    win->draw_pixmap(gc, *pixmap, 0, 0,
                     rect.x, rect.y, rect.width, rect.height);
    drawingArea->draw(&rect);

Am I doing something wrong or is this problem unavoidable?

I removed the line
    win->draw_pixmap(gc, *pixmap, 0, 0,
                     rect.x, rect.y, rect.width, rect.height);
because draw_pixmap is also called in drawingarea->on_expose_event(...)
which seems to be triggered by drawingArea->draw(). Now, the "animation"
looks much better. Perhaps that finally solved the problem.

TIA,

Felix





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