Package java.awt.image

Examples of java.awt.image.Raster


        public void copyFrom(BufferedImage image, double gamma, Rectangle roi) {
            origin(IPL_ORIGIN_TL);

            ByteBuffer out = getByteBuffer(roi == null ? 0 : roi.y*widthStep() + roi.x);
            SampleModel sm = image.getSampleModel();
            Raster r       = image.getRaster();
            DataBuffer in  = r.getDataBuffer();
            int x = r.getSampleModelTranslateX();
            int y = r.getSampleModelTranslateY();
            int step = sm.getWidth()*sm.getNumBands();
            if (sm instanceof ComponentSampleModel) {
                step = ((ComponentSampleModel)sm).getScanlineStride();
            } else if (sm instanceof SinglePixelPackedSampleModel) {
                step = ((SinglePixelPackedSampleModel)sm).getScanlineStride();
View Full Code Here


     */
    protected void computeRect(Raster[] sources,
                               WritableRaster dest,
                               Rectangle destRect) {

        Raster source = sources[0];
        int formatTag = MediaLibAccessor.findCompatibleTag(sources, dest);

  // For PointOpImages, the srcRect and the destRect are the same.
        MediaLibAccessor srcAccessor = new MediaLibAccessor(source, destRect,
                  formatTag);
View Full Code Here

    }

    protected void computeRect(Raster[] sources,
                               WritableRaster dest,
                               Rectangle destRect) {
        Raster source = sources[0];
        Rectangle srcRect = source.getBounds();

        int formatTag = MediaLibAccessor.findCompatibleTag(sources,dest);

        MediaLibAccessor srcAccessor =
            new MediaLibAccessor(source,srcRect,formatTag);
View Full Code Here

     * @param destRect the rectangle within dest to be processed.
     */
    protected void computeRect(Raster[] sources,
                               WritableRaster dest,
                               Rectangle destRect) {
        Raster source = sources[0];
        Rectangle srcRect = mapDestRect(destRect, 0);
        int formatTag = MediaLibAccessor.findCompatibleTag(sources,dest);
        MediaLibAccessor srcAccessor =
View Full Code Here

     * @param destRect  the rectangle within this OpImage to be processed.
     */
    protected void computeRect(Raster[] sources,
                               WritableRaster dest,
                               Rectangle destRect) {
        Raster source = sources[0];
        Rectangle srcRect = mapDestRect(destRect, 0);

        int formatTag = MediaLibAccessor.findCompatibleTag(sources,dest);

        MediaLibAccessor srcAccessor =
View Full Code Here

     */
    protected void computeRect(Raster[] sources,
                               WritableRaster dest,
                               Rectangle destRect) {

        Raster source = sources[0];
        int formatTag = MediaLibAccessor.findCompatibleTag(sources, dest);

  // For PointOpImages, the srcRect and the destRect are the same.
        MediaLibAccessor srcAccessor = new MediaLibAccessor(source, destRect,
                  formatTag);
View Full Code Here

        IDATOutputStream ios = new IDATOutputStream(dataOutput, 8192);
        DeflaterOutputStream dos =
            new DeflaterOutputStream(ios, new Deflater(9));

        // Future work - don't convert entire image to a Raster
        Raster ras = image.getData();

        if (skipAlpha) {
            int numBands = ras.getNumBands() - 1;
            int[] bandList = new int[numBands];
            for (int i = 0; i < numBands; i++) {
                bandList[i] = i;
            }
            ras = ras.createChild(0, 0,
                                  ras.getWidth(), ras.getHeight(),
                                  0, 0,
                                  bandList);
        }

        if (interlace) {
View Full Code Here

                    stripRect.height = im.getHeight() - stripRect.y;
                }

    Rectangle encodedRect = stripRect.intersection(imageBounds);
                // Get a strip of data.
                Raster strip = im.getData(encodedRect);

                // Get the data array.
                byte[] bdata =
                    ((DataBufferByte)strip.getDataBuffer()).getData();

                // Get the scanline stride.
                int rowStride = variant == PBM_RAW ?
                    ((MultiPixelPackedSampleModel)strip.getSampleModel()).getScanlineStride() :
                    ((ComponentSampleModel)strip.getSampleModel()).getScanlineStride();

                if(rowStride == bytesPerRow && !isPBMInverted) {
                    // Write the entire strip at once.
                    output.write(bdata, 0, bdata.length);
                } else {
                    // Write the strip row-by-row.
                    int offset = 0;
                    for(int i = 0; i < encodedRect.height; i++) {
                        if(isPBMInverted) {
                            for(int k = 0; k < bytesPerRow; k++) {
                                invertedData[k] =
                                    (byte)(~(bdata[offset+k]&0xff));
                            }
                            output.write(invertedData, 0, bytesPerRow);
                        } else {
                            output.write(bdata, offset, bytesPerRow);
                        }
                        offset += rowStride;
                    }
                }

                // Increment the strip origin.
                stripRect.y += tileHeight;
            }

            // Write all buffered bytes and return.
            output.flush();

            return;
        }

        // Buffer for up to 8 rows of pixels
        int[] pixels = new int[8*width*numBands];

        // Also allocate a buffer to hold the data to be written to the file,
        // so we can use array writes.
        byte[] bpixels = reds == null ?
                         new byte[8*width*numBands] : new byte[8*width*3];

        // The index of the sample being written, used to
        // place a line separator after every 16th sample in
        // ASCII mode.  Not used in raw mode.
        int count = 0;

        // Process 8 rows at a time so all but the last will have
        // a multiple of 8 pixels.  This simplifies PBM_RAW encoding.
        int lastRow = minY + height;
        for (int row = minY; row < lastRow; row += 8) {
            int rows = Math.min(8, lastRow - row);
            int size = rows*width*numBands;
           
            // Grab the pixels
            Raster src = im.getData(new Rectangle(minX, row, width, rows));
            src.getPixels(minX, row, width, rows, pixels);

            // Invert bits if necessary.
            if(isPBMInverted) {
                for(int k = 0; k < size; k++) {
                    pixels[k] ^= 0x00000001;
View Full Code Here

  // Unless a Bicubic2 object is passed in as the interpolation
  if (interp instanceof InterpolationBicubic2) {
      mlibInterpType = Constants.MLIB_BICUBIC2;
  }

  Raster source = sources[0];
  Rectangle srcRect = source.getBounds();
 
        int formatTag = MediaLibAccessor.findCompatibleTag(sources, dest);

        MediaLibAccessor srcAccessor = new MediaLibAccessor(source, srcRect,
                  formatTag);
View Full Code Here

  */
    protected void computeRect(Raster[] sources,
                               WritableRaster dest,
                               Rectangle destRect) {

        Raster source = sources[0];
        Rectangle srcRect = source.getBounds();

        int formatTag = MediaLibAccessor.findCompatibleTag(sources,dest);

        MediaLibAccessor srcAccessor =
            new MediaLibAccessor(source,srcRect,formatTag);
View Full Code Here

TOP

Related Classes of java.awt.image.Raster

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.