I have some code that if you add the the resizeCanvas(int,int) method of
ImageCanvas, the Image will automatically enlarge to fit the window. There
is one if statement in it, add this else if to it:
else if( width >= 256 && height >= 256 )
{
//TODO: this is how you resize the image by dragging, its having
some problems though
//todo, figure out how to get rig of the border around the
image....
double widthIncrease = ((double)width)/256d;
double heightIncrease = ((double)height)/256d;
double increase =
widthIncrease>heightIncrease?heightIncrease:widthIncrease;
setDrawingSize( width, height );
setMagnification( increase );
repaint();
}
I hard coded the default size of my images, you could just derive these
values from the ImagePlus. May not help you in a plugin unless you can
override the resizeCanvas method in ImageCanvas.
I think you could also do this with window listeners on the ImageWindow
class.
On 2/13/07, Tony Shepherd <
[hidden email]> wrote:
>
> The problem is I can change the canvas but not the window. If I go:
>
> imp.getWindow.getCanvas.setMagnification(2.0);
>
> imp.updateAndDraw(); ( ... OR imp.updateAndRepaintWindow();)
>
> then the magnified canvas is displayed inside a 'normal sized' window, i.e
> .
> you just see the top-left portion of the bigger image and you have to drag
> the window from the bottom right corner to see the rest of it.
>