Package javax.media.jai

Examples of javax.media.jai.RenderedImageAdapter


                ri = new RawImage(f);
            } catch (PhotovaultException ex) {
                fail( ex.getMessage() );
            }

            PlanarImage thumbImage = new RenderedImageAdapter( ri.getRenderedImage( 200, 200, true ) );

            JPEGEncodeParam encodeParam = new JPEGEncodeParam();
            ImageEncoder encoder = ImageCodec.createImageEncoder("JPEG", os,
                    encodeParam);
            try {
                encoder.encode( thumbImage );
                os.close();
                // origImage.dispose();
                thumbImage.dispose();
            } catch (Exception e) {
                fail( "Error writing thumbnail: " + e.getMessage() );
            }
        } catch (FileNotFoundException ex) {
            ex.printStackTrace();
View Full Code Here


                             TODO: JAI seems to have problems in doing convolutions
                             for large image tiles. Split image to reasonably sized
                             tiles as a workaround for this.
                             */
                            ri = new TiledImage( ri, 256, 256 );
                            image =  new RenderedImageAdapter( ri );
                            originalSampleModel = image.getSampleModel();
                            originalColorModel = image.getColorModel();
                            final float[] DEFAULT_KERNEL_1D = {0.25f,0.5f,0.25f};
                            ParameterBlock pb = new ParameterBlock();
                            KernelJAI kernel = new KernelJAI(DEFAULT_KERNEL_1D.length,
View Full Code Here

            g2.drawImage(ret, 0, 0, null);
            g2.dispose();
            ret = scratchImage;
        }

        return new RenderedImageAdapter(ret);
    }
View Full Code Here

        } else if (images[index] instanceof PlanarImage) {
            return ((PlanarImage) images[index]).getAsBufferedImage();
        } else if (images[index] instanceof WritableRenderedImage) {
            return new WritableRenderedImageAdapter((WritableRenderedImage) images[index]).getAsBufferedImage();
        } else {
            return new RenderedImageAdapter(images[index]).getAsBufferedImage();
        }
    }
View Full Code Here

        if (images[index] instanceof PlanarImage) {
            return (PlanarImage) images[index];
        } else if (images[index] instanceof BufferedImage) {
            return PlanarImage.wrapRenderedImage(images[index]);
        } else {
            return new RenderedImageAdapter(images[index]);
        }
    }
View Full Code Here

   * @param input absolute file path for image file
   * @return a BufferedImage instance for source image file
   * @throws FormatIOException
   */
  public BufferedImage open(String input) throws FormatIOException {
    RenderedImageAdapter aid = null;
    try {
      ImageDecoder enc = ImageCodec.createImageDecoder("PNM", new File(input), null);
      aid = new RenderedImageAdapter(enc.decodeAsRenderedImage());
    } catch (IOException e) {
      return null;
    }
    return aid.getAsBufferedImage();
  }
View Full Code Here

   * @param input an InputStream consisting of an image bitstream
   * @return a BufferedImage instance for source image InputStream
   * @throws FormatIOException
   */
  public BufferedImage open(InputStream input) throws FormatIOException {
    RenderedImageAdapter aid = null;
    try {
      ImageDecoder enc = ImageCodec.createImageDecoder("PNM", input, null);
      aid = new RenderedImageAdapter(enc.decodeAsRenderedImage());
    } catch (IOException e) {
      return null;
    }
    return aid.getAsBufferedImage();
  }
View Full Code Here

        sampleModel, colorModel);
    DataBufferFloat dataBuffer = new DataBufferFloat(theData, len);
    Raster raster = RasterFactory.createWritableRaster(sampleModel,
        dataBuffer, origin);
    tiledImage.setData(raster);
    RenderedImageAdapter img = new RenderedImageAdapter(
        (RenderedImage) tiledImage);
    return img;
  }
View Full Code Here

        Color save = g2D.getColor();
        g2D.setColor(backGroundcolor);
        g2D.fillRect(0, 0, emptyImage.getWidth(), emptyImage.getHeight());
        g2D.setColor(save);
        if (outputTransparentColor!=null)
            emptyImage = new RenderedImageAdapter(
                    ImageUtilities.maskColor(outputTransparentColor,emptyImage)).getAsBufferedImage();
        return emptyImage;
    }
View Full Code Here

        cdFeq[b] = new float[numBins];
        for (int i = 0; i < numBins; i++) {
          cdFeq[b][i] = (float) (i + 1) / (float) (numBins);
        }
      }
      final RenderedImageAdapter adaptedResult = new RenderedImageAdapter(
          result);
      adaptedResult.setProperty(
          "histogram",
          histogram);
      result = JAI.create(
          "matchcdf",
          adaptedResult,
View Full Code Here

TOP

Related Classes of javax.media.jai.RenderedImageAdapter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.