Examples of Raster


Examples of java.awt.image.Raster

     * @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

Examples of java.awt.image.Raster

     * @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

Examples of java.awt.image.Raster

     */
    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

Examples of java.awt.image.Raster

        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

Examples of java.awt.image.Raster

                    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

Examples of java.awt.image.Raster

  // 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

Examples of java.awt.image.Raster

  */
    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

Examples of java.awt.image.Raster

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

  Raster source = sources[0];

  Rectangle srcRect = mapDestRect(destRect,0);

        // Hack: derive the source format tag as if it was writing to
        // a destination with the same layout as itself.
View Full Code Here

Examples of java.awt.image.Raster

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

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

Examples of java.awt.image.Raster

     * the same.
     */
    protected void computeRect(Raster[] sources,
                               WritableRaster dest,
                               Rectangle destRect) {
        Raster source = sources[0];

        /* Find the mediaLib data tag. */
        int formatTag = MediaLibAccessor.findCompatibleTag(sources, dest);

        MediaLibAccessor srcMA =
            new MediaLibAccessor(source, source.getBounds(), formatTag);
        MediaLibAccessor dstMA =
            new MediaLibAccessor(dest, destRect, formatTag);

        mediaLibImage[] srcMLI = srcMA.getMediaLibImages();
        mediaLibImage[] dstMLI = dstMA.getMediaLibImages();

        switch (dstMA.getDataType()) {
        case DataBuffer.TYPE_BYTE:
        case DataBuffer.TYPE_USHORT:
        case DataBuffer.TYPE_SHORT:
        case DataBuffer.TYPE_INT:
            if (setBackground)
                for (int i = 0 ; i < dstMLI.length; i++) {
                    Image.PolynomialWarp2(dstMLI[i], srcMLI[i],
                                         xCoeffs, yCoeffs,
                                         destRect.x,
                                         destRect.y,
                                         source.getMinX(),
                                         source.getMinY(),
                                         preScaleX, preScaleY,
                                         postScaleX, postScaleY,
                                         filter,
                                         Constants.MLIB_EDGE_DST_NO_WRITE,
                                         intBackgroundValues);
              }
            else
                for (int i = 0 ; i < dstMLI.length; i++) {
                    Image.PolynomialWarp(dstMLI[i], srcMLI[i],
                                         xCoeffs, yCoeffs,
                                         destRect.x,
                                         destRect.y,
                                         source.getMinX(),
                                         source.getMinY(),
                                         preScaleX, preScaleY,
                                         postScaleX, postScaleY,
                                         filter,
                                         Constants.MLIB_EDGE_DST_NO_WRITE);
                    MlibUtils.clampImage(dstMLI[i], getColorModel());
                }
            break;

        case DataBuffer.TYPE_FLOAT:
        case DataBuffer.TYPE_DOUBLE:
            if (setBackground)
                for (int i = 0 ; i < dstMLI.length; i++) {
                    Image.PolynomialWarp2_Fp(dstMLI[i], srcMLI[i],
                                            xCoeffs, yCoeffs,
                                            destRect.x,
                                            destRect.y,
                                            source.getMinX(),
                                            source.getMinY(),
                                            preScaleX, preScaleY,
                                            postScaleX, postScaleY,
                                            filter,
                                            Constants.MLIB_EDGE_DST_NO_WRITE,
                                            backgroundValues);
                }
            else
                for (int i = 0 ; i < dstMLI.length; i++) {
                    Image.PolynomialWarp_Fp(dstMLI[i], srcMLI[i],
                                            xCoeffs, yCoeffs,
                                            destRect.x,
                                            destRect.y,
                                            source.getMinX(),
                                            source.getMinY(),
                                            preScaleX, preScaleY,
                                            postScaleX, postScaleY,
                                            filter,
                                            Constants.MLIB_EDGE_DST_NO_WRITE);
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.