readColorModelOnly = pColorModelOnly; producer.startProduction(consumer); // Note: If single-thread (synchronous), this call will block
public void imageComplete(int pStatus) { fetching = false; if (producer != null) { producer.removeConsumer(this); } switch (pStatus) { case ImageConsumer.IMAGEERROR: consumerException = new ImageConversionException("ImageConsumer.IMAGEERROR"); break; } synchronized (BufferedImageFactory.this) { BufferedImageFactory.this.notifyAll(); } }
/** * Create a {@link java.awt.image.BufferedImage} from the given source * image producer. If the source is an animated GIF, it will only return * the first frame. * * @param prod The source imageproducer to create buffered image from * @return A complete buffered image representation of this image */ public static BufferedImage createBufferedImage(ImageProducer prod) { ImageGenerator gen = new ImageGenerator(); prod.startProduction(gen); BufferedImage img = gen.getImage(); // Remove the consumer to stop the animated GIF code going in to // an endless production loop. prod.removeConsumer(gen); return img; } }
public void initialize(RandomAccessInputStream in, int y, int h, int imageWidth) { this.in = in; tiles = new TileCache(y, h); preprocess(this.in); try { Toolkit toolkit = Toolkit.getDefaultToolkit(); byte[] data = new byte[this.in.available()]; this.in.readFully(data); Image image = toolkit.createImage(data); ImageProducer producer = image.getSource(); consumer = new TileConsumer(producer, y, h); producer.startProduction(consumer); while (producer.isConsumer(consumer)); } catch (IOException e) { } }
/** * Create a {@link java.awt.image.BufferedImage} from the given source * image. If the source image is already a buffered image it will * immediately return with the parameter as the return value. * * @param img The source image to create buffered image from * @return A complete buffered image representation of this image */ public static BufferedImage createBufferedImage(Image img) { if(img instanceof BufferedImage) return (BufferedImage)img; ImageProducer prod = img.getSource(); ImageGenerator gen = new ImageGenerator(); prod.startProduction(gen); BufferedImage ret_val = gen.getImage(); // Remove the consumer to stop the animated GIF code going in to // an endless production loop. prod.removeConsumer(gen); return ret_val; }
producer.startProduction(consumer); while (producer.isConsumer(consumer)) { /* Loop over image consumers */}
public synchronized void encode() throws IOException { encoding = true; iox = null; producer.startProduction(this); while (encoding) try { wait(); } catch (InterruptedException e) {} if (iox != null) throw iox; }
@Override public void imageComplete(final int status) { producer.removeConsumer(this); }
producer.startProduction(consumer); while (producer.isConsumer(consumer)) { /* Loop over image consumers */}
public synchronized void encode() throws IOException { encoding = true; iox = null; producer.startProduction(this); while (encoding) try { wait(); } catch (InterruptedException e) { } if (iox != null) throw iox; }
@Override public void imageComplete(int status) { producer.removeConsumer(this); }
public synchronized void encode() throws IOException { encoding = true; iox = null; producer.startProduction(this); while (encoding) try { wait(); } catch (InterruptedException e) { } if (iox != null) throw iox; }
@Override public void imageComplete(final int status) { producer.removeConsumer(this); }
public synchronized void encode() throws IOException { encoding = true; iox = null; producer.startProduction(this); while (encoding) try { wait(); } catch (InterruptedException e) { } if (iox != null) throw iox; }
/** {@code ImageConsumer} implementation, do not invoke */ public void imageComplete(int pStatus) { mFetching = false; if (mProducer != null) { mProducer.removeConsumer(this); } switch (pStatus) { case IMAGEERROR: new Error().printStackTrace(); mError = true; break; } synchronized (BufferedImageFactory.this) { BufferedImageFactory.this.notifyAll(); } }
public synchronized void encode() throws IOException { encoding = true; iox = null; producer.startProduction(this); while (encoding) try { wait(); } catch (InterruptedException e) { } if (iox != null) throw iox; }
public void imageComplete(int pStatus) { fetching = false; if (producer != null) { producer.removeConsumer(this); } switch (pStatus) { case ImageConsumer.IMAGEERROR: consumerException = new ImageConversionException("ImageConsumer.IMAGEERROR"); break; } synchronized (BufferedImageFactory.this) { BufferedImageFactory.this.notifyAll(); } }
public synchronized void encode() throws IOException { encoding = true; iox = null; producer.startProduction(this); while (encoding) try { wait(); } catch (InterruptedException e) { } if (iox != null) throw iox; }
public void imageComplete(int completionStatus) { if (debug) { System.err.println("imageComplete(): "); if ((completionStatus == IMAGEABORTED)) System.err.println("\tIMAGEABORTED"); if ((completionStatus == IMAGEERROR)) System.err.println("\tIMAGEERROR"); if ((completionStatus == SINGLEFRAMEDONE)) System.err.println("\tSINGLEFRAMEDONE"); if ((completionStatus == STATICIMAGEDONE)) System.err.println("\tSTATICIMAGEDONE"); } producer.removeConsumer(this); status = completionStatus; finished = true; unblock(); fireChangeListeners(); }
public synchronized void encode() throws IOException { encoding = true; iox = null; producer.startProduction(this); while (encoding) try { wait(); } catch (InterruptedException e) { } if (iox != null) throw iox; }