Login  Register

Re: timing of image drawing

Posted by Wayne Rasband on Dec 08, 2005; 9:02pm
URL: http://imagej.273.s1.nabble.com/timing-of-image-drawing-tp3704305p3704306.html

The Graphic_Overlay plugin at

    http://rsb.info.nih.gov/ij/plugins/graphic-overlay.html

demonstrates how to add a nondestructive graphics overly to an image or
stack.

-wayne

On Dec 7, 2005, at 1:52 PM, Robert Dougherty wrote:

> I'm having trouble with a plugin that repeatedly updates
> some drawing that I'm adding to an image.? For each update,
> I call imp.draw(); to erase the old version of my added
> artwork, and then I recreate the artwork.? The problem seems
> to be that imp.draw(), which ultimately calls repaint() for
> the image canvas, seems to run asynchronously.? That is,
> imp.draw() launches a repaint process that goes on its way,
> my plugin redraws the artwork, and then the still-running
> imp.draw() erases part of it.? This creates an annoying
> flicker effect on some computers.? Sun's API suggests that
> Swing has double buffering, which might be related, but it
> seems like overkill. Is there an easy way to redraw the
> graphics from the image data that is blocking?? I think this
> issue has come up before, but I was not able to find it in
> the archives.
> ?
> imp.draw();
>
> for (int j = 0; j < rows; j++){
>
> ??????????? for (int i = 0; i < columns; i++){
>
> ??????????????????????? int ind = i + columns*j;
>
> ??????????????????????? int diam =
> (int)(ic.getMagnification()*diameter);
>
> ?
> g.drawOval(ic.screenX(x[ind]),ic.screenX(y[ind]),diam,diam);
>
> }
>
> }