|
Hi,
I've been trying to make a plug in paint it's anchor points over the ROI
points.
I'm using a polygon Roi, like this:
**********
Polygon p = new Polygon(selx,sely,size[0]+selSize);
pRoi = new PolygonRoi(p,Roi.FREELINE);
img.setRoi(pRoi);
paintPoints();
***********
And selx and sely points to a vector of points of the selection.
But there are a few points of the selections that I store in another
ArrayList, and I wanted to highlight them.
To do this, I call the paintPoints() function, which is something like:
************************************
private void paintPoints() {
ImageCanvas ic;
ic = img.getCanvas();
Graphics g = ic.getGraphics();
g.setColor(Roi.getColor());
for(int i=0;i<anchor.size();i++){
int myx = (int) ((Point)(anchor.get(i))).getX();
int myy = (int) ((Point)(anchor.get(i))).getY();
g.drawRect( ic.screenX(myx),
ic.screenY(myy),10,10);
}
}
}
****************************
The Rectangles are drawn on the desired points, but, somewhere in the code,
the repaint function is called, and they start to flicker, giving the user a
bad sensation.
Has anyone dealed with this problem in someplugin?
If so, what's the easiest way to go around it?
Thanks for your feedback.
[]'s
|