@Override public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int off, int scanSize) { LOGGER.debug("Storing row {} of {} ({}%)", new Object[] {y, height, ((double) y / height) * 100.0}); if (y >= (yy + hh)) { imageComplete(0); return; } else if (y < yy) return; try { tiles.add(pixels, x, y, w, h); } catch (CodecException e) { LOGGER.debug("", e); } catch (IOException e) { LOGGER.debug("", e); } }
public byte[] getScanline(int y) { try { return tiles.get(0, y, consumer.getWidth(), 1); } catch (CodecException e) { LOGGER.debug("", e); } catch (IOException e) { LOGGER.debug("", e); } return null; }
@Override public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, int scanSize) { LOGGER.debug("Storing row {} of {} ({}%)", new Object[] {y, (yy + hh), ((double) y / (yy + hh)) * 100.0}); if (y >= (yy + hh)) { imageComplete(0); return; } else if (y < yy) return; try { tiles.add(pixels, x, y, w, h); } catch (CodecException e) { LOGGER.debug("", e); } catch (IOException e) { LOGGER.debug("", e); } }
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) { } }