Hello,
I'm extending a GUI for marking up images with a zoom feature. I got the graphics transformed by applying an Affinetransform to the graphics object like so in the paintComponent method:
AffineTransform transform = new AffineTransform();
g2d.setTransform(transform);
This worked ok and scaled the images but when I tried to use the marking tool to draw polygons around the items of interest the mouse click points were also translated and weren't the actual points that the user clicked.
So I've been trying to only scale the image with the transform and not the rest of the things being drawn with the following code :
AffineTransform transform = new AffineTransform();
op = new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR);
scaledImage = op.filter(scaledImage, null);
This gives me an ImagingOpException because it cant transform the source image.
scaledImage is a BufferedImage that has been transformed from an Image using the code I found here.
The conversion to a bufferedImage seems to go without any errors and the image is drawn initially. The problem comes at the line of code where I apply the filter.
This is really doing my head in, I'm fairly new to Java Swing so it's probably something stupid on my part.
Sorry for the long post, i would hugely appreciate any tips or advice :)
Thank you