BufferedImage bitmap = ImageIO.read( inputStream ); WaitingImageObserver wia = new WaitingImageObserver( bitmap ); wia.waitImageLoaded();
BufferedImage bitmap = ImageIO.read( inputStream ); WaitingImageObserver wia = new WaitingImageObserver( bitmap ); wia.waitImageLoaded();
BufferedImage bitmap = ImageIO.read( inputStream ); WaitingImageObserver wia = new WaitingImageObserver( bitmap ); wia.waitImageLoaded();
public Dimension getPreferredSize() { final WaitingImageObserver obs = new WaitingImageObserver( image ); obs.waitImageLoaded(); return new Dimension( image.getWidth( null ), image.getHeight( null ) ); }
public void draw( final Graphics2D graphics2D, final Rectangle2D bounds ) { final WaitingImageObserver obs = new WaitingImageObserver( image ); obs.waitImageLoaded(); graphics2D.drawImage( image, 0, 0, image.getWidth( null ), image.getHeight( null ), null ); }
/** * Creates a new ImageReference without an assigned URL for the Image. This image reference will not be loadable and * cannot be used to embedd the original rawdata of the image into the generated content. * * @param img * the image for this reference. * @throws NullPointerException * if the image is null. * @throws java.io.IOException * if an IOError occured while loading the image. */ public DefaultImageReference( final Image img ) throws IOException { if ( img == null ) { throw new NullPointerException(); } this.image = img; final WaitingImageObserver obs = new WaitingImageObserver( image ); obs.waitImageLoaded(); if ( obs.isError() ) { throw new IOException( "Failed to load the image. ImageObserver signaled an error." ); } this.width = image.getWidth( null ); this.height = image.getHeight( null ); }
final WaitingImageObserver obs = new WaitingImageObserver( ret ); while ( g2.drawImage( ret, 0, 0, w, h, null ) == false ) { obs.waitImageLoaded();
private int clipAndEncodeImage( final Image image, final long width, final long height, final double deviceScaleFactor ) throws UnsupportedEncoderException, IOException { final int imageWidth = (int) StrictGeomUtility.toExternalValue( width ); final int imageHeight = (int) StrictGeomUtility.toExternalValue( height ); // first clip. final BufferedImage bi = ImageUtils.createTransparentImage( imageWidth, imageHeight ); final Graphics2D graphics = (Graphics2D) bi.getGraphics(); graphics.scale( deviceScaleFactor, deviceScaleFactor ); if ( image instanceof BufferedImage ) { if ( graphics.drawImage( image, null, null ) == false ) { logger.debug( "Failed to render the image. This should not happen for BufferedImages" ); // NON-NLS } } else { final WaitingImageObserver obs = new WaitingImageObserver( image ); obs.waitImageLoaded(); while ( graphics.drawImage( image, null, obs ) == false ) { obs.waitImageLoaded(); if ( obs.isError() ) { logger.warn( "Error while loading the image during the rendering." ); // NON-NLS break; } } } graphics.dispose(); final byte[] data = RenderUtility.encodeImage( bi ); return printerBase.getWorkbook().addPicture( data, Workbook.PICTURE_TYPE_PNG ); }
public DefaultImageReference( final Resource imageResource ) throws ResourceException { if ( imageResource == null ) { throw new NullPointerException(); } final Object o = imageResource.getResource(); if ( o instanceof Image == false ) { throw new ResourceException( "ImageResource does not contain a java.awt.Image object." ); } final ResourceKey resKey = imageResource.getSource(); final Object identifier = resKey.getIdentifier(); if ( identifier instanceof URL ) { this.url = (URL) identifier; } this.resourceKey = resKey; this.image = (Image) o; final WaitingImageObserver obs = new WaitingImageObserver( image ); obs.waitImageLoaded(); if ( obs.isError() ) { throw new ResourceException( "Failed to load the image. ImageObserver signaled an error." ); } this.width = image.getWidth( null ); this.height = image.getHeight( null ); }
public static void encodeImage( final OutputStream outputStream, final Image image, final String mimeType, final float quality, final boolean alpha ) throws UnsupportedEncoderException, IOException { final WaitingImageObserver obs = new WaitingImageObserver( image ); obs.waitImageLoaded(); final ImageEncoder imageEncoder = ImageEncoderRegistry.getInstance().createEncoder( mimeType ); if ( imageEncoder == null ) { throw new UnsupportedEncoderException( "The encoder for mime-type '" + mimeType + "' is not available" ); } imageEncoder.encodeImage( image, outputStream, quality, alpha ); }
final WaitingImageObserver obs = new WaitingImageObserver( image ); obs.waitImageLoaded(); final int imageWidth = image.getWidth( obs );
WaitingImageObserver obs = new WaitingImageObserver( image ); obs.waitImageLoaded(); final int imageWidth = image.getWidth( obs ); RenderUtility.scaleImage( image, clipWidth, clipHeight, RenderingHints.VALUE_INTERPOLATION_BICUBIC, true ); content.getContent().setContentCached( image ); obs = new WaitingImageObserver( image ); obs.waitImageLoaded(); scaleTransform = null;
final WaitingImageObserver obs = new WaitingImageObserver( image ); obs.waitImageLoaded();