public static Rectangle getDestinationBounds(Graphics2D g2d) { BufferedImage bi = getDestination(g2d); if (bi != null) { return new Rectangle(0, 0, bi.getWidth(), bi.getHeight()); } GraphicsConfiguration gc = g2d.getDeviceConfiguration(); if (gc == null) { return null; } // We are going to a BufferedImage but no hint was provided // so we can't determine the destination bounds. if (gc.getDevice().getType() == GraphicsDevice.TYPE_IMAGE_BUFFER) { return null; } // This is a JDK 1.3ism, so we will just return null... // return gc.getBounds(); return null; }
public static Rectangle getDestinationBounds(Graphics2D g2d) { BufferedImage bi = getDestination(g2d); if (bi != null) { return new Rectangle(0, 0, bi.getWidth(), bi.getHeight()); } GraphicsConfiguration gc = g2d.getDeviceConfiguration(); if (gc == null) { return null; } // We are going to a BufferedImage but no hint was provided // so we can't determine the destination bounds. if (gc.getDevice().getType() == GraphicsDevice.TYPE_IMAGE_BUFFER) { return null; } // This is a JDK 1.3ism, so we will just return null... // return gc.getBounds(); return null; }
public static Rectangle getDestinationBounds(Graphics2D g2d) { BufferedImage bi = getDestination(g2d); if (bi != null) { return new Rectangle(0, 0, bi.getWidth(), bi.getHeight()); } GraphicsConfiguration gc = g2d.getDeviceConfiguration(); if (gc == null) { return null; } // We are going to a BufferedImage but no hint was provided // so we can't determine the destination bounds. if (gc.getDevice().getType() == GraphicsDevice.TYPE_IMAGE_BUFFER) { return null; } // This is a JDK 1.3ism, so we will just return null... // return gc.getBounds(); return null; }
public static ColorModel getDestinationColorModel(Graphics2D g2d) { BufferedImage bi = getDestination(g2d); if (bi != null) { return bi.getColorModel(); } GraphicsConfiguration gc = g2d.getDeviceConfiguration(); if (gc == null) { return null; // Can't tell } // We are going to a BufferedImage but no hint was provided // so we can't determine the destination Color Model. if (gc.getDevice().getType() == GraphicsDevice.TYPE_IMAGE_BUFFER) { if (g2d.getRenderingHint(RenderingHintsKeyExt.KEY_TRANSCODING) == RenderingHintsKeyExt.VALUE_TRANSCODING_PRINTING) return sRGB_Unpre; // System.out.println("CM: " + gc.getColorModel()); // System.out.println("CS: " + gc.getColorModel().getColorSpace()); return null; } return gc.getColorModel(); }
public static ColorModel getDestinationColorModel(Graphics2D g2d) { BufferedImage bi = getDestination(g2d); if (bi != null) { return bi.getColorModel(); } GraphicsConfiguration gc = g2d.getDeviceConfiguration(); if (gc == null) { return null; // Can't tell } // We are going to a BufferedImage but no hint was provided // so we can't determine the destination Color Model. if (gc.getDevice().getType() == GraphicsDevice.TYPE_IMAGE_BUFFER) { if (g2d.getRenderingHint(RenderingHintsKeyExt.KEY_TRANSCODING) == RenderingHintsKeyExt.VALUE_TRANSCODING_PRINTING) return sRGB_Unpre; // System.out.println("CM: " + gc.getColorModel()); // System.out.println("CS: " + gc.getColorModel().getColorSpace()); return null; } return gc.getColorModel(); }
public static ColorModel getDestinationColorModel(Graphics2D g2d) { BufferedImage bi = getDestination(g2d); if (bi != null) { return bi.getColorModel(); } GraphicsConfiguration gc = g2d.getDeviceConfiguration(); if (gc == null) { return null; // Can't tell } // We are going to a BufferedImage but no hint was provided // so we can't determine the destination Color Model. if (gc.getDevice().getType() == GraphicsDevice.TYPE_IMAGE_BUFFER) { if (g2d.getRenderingHint(RenderingHintsKeyExt.KEY_TRANSCODING) == RenderingHintsKeyExt.VALUE_TRANSCODING_PRINTING) return sRGB_Unpre; // System.out.println("CM: " + gc.getColorModel()); // System.out.println("CS: " + gc.getColorModel().getColorSpace()); return null; } return gc.getColorModel(); }