ViewerFrame frame = new ViewerFrame(g2dImage);
frame.setVisible(true);
}
private ImageGraphics2D createErrorImage() {
Graphics2DImagePainter painter = new Graphics2DImagePainter() {
public Dimension getImageSize() {
return new Dimension(10, 10);
}
public void paint(Graphics2D g2d, Rectangle2D area) {
g2d.translate(area.getX(), area.getY());
double w = area.getWidth();
double h = area.getHeight();
//Fit in paint area
Dimension imageSize = getImageSize();
double sx = w / imageSize.getWidth();
double sy = h / imageSize.getHeight();
if (sx != 1.0 || sy != 1.0) {
g2d.scale(sx, sy);
}
g2d.setColor(Color.RED);
g2d.setStroke(new BasicStroke(0));
g2d.drawRect(0, 0, imageSize.width, imageSize.height);
g2d.drawLine(0, 0, imageSize.width, imageSize.height);
g2d.drawLine(0, imageSize.height, imageSize.width, 0);
}
};
Dimension dim = painter.getImageSize();
ImageSize size = new ImageSize();
size.setSizeInMillipoints(dim.width, dim.height);
size.setResolution(imageManager.getImageContext().getSourceResolution());
size.calcPixelsFromSize();