Package java.awt.image

Examples of java.awt.image.Raster


                               WritableRaster dest,
                               Rectangle destRect) {

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

        Raster source = sources[0];

        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:

      // computing medialibtable and calc for integral type and call
      if (mlibInterpTableI==null){
          InterpolationTable jtable = (InterpolationTable)interp;
          mlibInterpTableI =
      new mediaLibImageInterpTable(Constants.MLIB_INT,
                 jtable.getWidth(),
                 jtable.getHeight(),
                 jtable.getLeftPadding(),
                 jtable.getTopPadding(),
                 jtable.getSubsampleBitsH(),
                 jtable.getSubsampleBitsV(),
                 jtable.getPrecisionBits(),
                 jtable.getHorizontalTableData(),
                 jtable.getVerticalTableData());

      }

            if (setBackground)
          for (int i = 0 ; i < dstMLI.length; i++) {
              Image.GridWarpTable2(dstMLI[i], srcMLI[i],
           xWarpPos, yWarpPos,
                                         source.getMinX(),
                                         source.getMinY(),
                                         xStart - destRect.x,
                                         xStep, xNumCells,
                                         yStart - destRect.y,
                                         yStep, yNumCells,
                                         mlibInterpTableI,
                                         Constants.MLIB_EDGE_DST_NO_WRITE,
                                         intBackgroundValues);
          }
            else
          for (int i = 0 ; i < dstMLI.length; i++) {
              Image.GridWarpTable(dstMLI[i], srcMLI[i],
          xWarpPos, yWarpPos,
                                        source.getMinX(),
                                        source.getMinY(),
                                        xStart - destRect.x,
                                        xStep, xNumCells,
                                        yStart - destRect.y,
                                        yStep, yNumCells,
                                        mlibInterpTableI,
                                        Constants.MLIB_EDGE_DST_NO_WRITE);
                    MlibUtils.clampImage(dstMLI[i], getColorModel());
          }

            break;

        case DataBuffer.TYPE_FLOAT:
      if (mlibInterpTableF==null){
          InterpolationTable jtable = (InterpolationTable)interp;
          mlibInterpTableF =
        new mediaLibImageInterpTable(Constants.MLIB_FLOAT,
                                             jtable.getWidth(),
                                             jtable.getHeight(),
                                             jtable.getLeftPadding(),
                                             jtable.getTopPadding(),
                                             jtable.getSubsampleBitsH(),
                                             jtable.getSubsampleBitsV(),
                                             jtable.getPrecisionBits(),
                                             jtable.getHorizontalTableDataFloat(),
                                             jtable.getVerticalTableDataFloat());

      }

            if (setBackground)
                for (int i = 0 ; i < dstMLI.length; i++) {
                    Image.GridWarpTable2_Fp(dstMLI[i], srcMLI[i],
                                            xWarpPos, yWarpPos,
                                            source.getMinX(),
                                            source.getMinY(),
                                            xStart - destRect.x,
                                            xStep, xNumCells,
                                            yStart - destRect.y,
                                            yStep, yNumCells,
                                            mlibInterpTableF,
                                            Constants.MLIB_EDGE_DST_NO_WRITE,
                                            backgroundValues);
                }
            else
                for (int i = 0 ; i < dstMLI.length; i++) {
                    Image.GridWarpTable_Fp(dstMLI[i], srcMLI[i],
                                           xWarpPos, yWarpPos,
                                           source.getMinX(),
                                           source.getMinY(),
                                           xStart - destRect.x,
                                           xStep, xNumCells,
                                           yStart - destRect.y,
                                           yStep, yNumCells,
                                           mlibInterpTableF,
                                           Constants.MLIB_EDGE_DST_NO_WRITE);
                }
            break;

        case DataBuffer.TYPE_DOUBLE:
        if (mlibInterpTableD == null){
          InterpolationTable jtable = (InterpolationTable)interp;
          mlibInterpTableD =
      new mediaLibImageInterpTable(Constants.MLIB_DOUBLE,
                                             jtable.getWidth(),
                                             jtable.getHeight(),
                                             jtable.getLeftPadding(),
                                             jtable.getTopPadding(),
                                             jtable.getSubsampleBitsH(),
                                             jtable.getSubsampleBitsV(),
                                             jtable.getPrecisionBits(),
                                             jtable.getHorizontalTableDataDouble(),
                                             jtable.getVerticalTableDataDouble());
      }

            if (setBackground)
                for (int i = 0 ; i < dstMLI.length; i++) {
                    Image.GridWarpTable2_Fp(dstMLI[i], srcMLI[i],
                                            xWarpPos, yWarpPos,
                                            source.getMinX(),
                                            source.getMinY(),
                                            xStart - destRect.x,
                                            xStep, xNumCells,
                                            yStart - destRect.y,
                                            yStep, yNumCells,
                                            mlibInterpTableD,
                                            Constants.MLIB_EDGE_DST_NO_WRITE,
                                            backgroundValues);
                }
            else
                for (int i = 0 ; i < dstMLI.length; i++) {
                    Image.GridWarpTable_Fp(dstMLI[i], srcMLI[i],
                                           xWarpPos, yWarpPos,
                                           source.getMinX(),
                                           source.getMinY(),
                                           xStart - destRect.x,
                                           xStep, xNumCells,
                                           yStart - destRect.y,
                                           yStep, yNumCells,
                                           mlibInterpTableD,
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];

        switch (source.getSampleModel().getDataType()) {
        case DataBuffer.TYPE_BYTE:
        case DataBuffer.TYPE_SHORT:
        case DataBuffer.TYPE_USHORT:
        case DataBuffer.TYPE_INT:
            byteLoop2x2(source, dest, destRect);
View Full Code Here

    public boolean computesUniqueTiles() {
        return areDataCopied;
    }

    public Raster computeTile(int tileX, int tileY) {
        Raster tile = getSourceImage(0).getTile(tileX, tileY);

        if(areDataCopied) {
            // Copy the data as there is no concrete ColorModel for
            // a SinglePixelPackedSampleModel with numBands < 3.
            tile = tile.createChild(tile.getMinX(), tile.getMinY(),
                                    tile.getWidth(), tile.getHeight(),
                                    tile.getMinX(), tile.getMinY(),
                                    bandIndices);
            WritableRaster raster = createTile(tileX, tileY);
            raster.setRect(tile);

            return raster;
        } else {
            // Simply return a child of the corresponding source tile.
            return tile.createChild(tile.getMinX(), tile.getMinY(),
                                    tile.getWidth(), tile.getHeight(),
                                    tile.getMinX(), tile.getMinY(),
                                    bandIndices);
        }
    }
View Full Code Here

        // Compute the image.
        computeImage(rasterSources, dest, destRect);

        for (int i = 0; i < numSources; i++) {
            Raster sourceData = rasterSources[i];
            if(sourceData != null) {
                PlanarImage source = getSourceImage(i);

                // Recycle the source tile
                if(source.overlapsMultipleTiles(sourceData.getBounds())) {
                    recycleTile(sourceData);
                }
            }
        }
View Full Code Here

      * Serialize the <code>RasterState</code>.
      *
      * @param out The <code>ObjectOutputStream</code>.
      */
    private void writeObject(ObjectOutputStream out) throws IOException {
        Raster raster = (Raster)theObject;
        Raster r;

        if (raster.getParent() != null) {
            // Use the child ratser to create another Raster
            // containing data for the requested bounds but which does
            // not share the SampleModel and DataBuffer of the parent.
            // Fix : 4631478
            r = raster.createCompatibleWritableRaster(raster.getBounds());
            ((WritableRaster)r).setRect(raster);
        } else {
            r = raster;
        }

        out.writeInt(r.getWidth());
        out.writeInt(r.getHeight());
        out.writeObject(SerializerFactory.getState(r.getSampleModel(), null));
        out.writeObject(SerializerFactory.getState(r.getDataBuffer(), null));
        out.writeObject(new Point(r.getMinX(), r.getMinY()));
    }
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

     * current <code>TiledImageGraphics</code> object.
     *
     * @return A <code>Graphics2D</code> object.
     */
    private Graphics2D getBogusGraphics2D(boolean shouldCopyState) {
        Raster r =  tiledImage.getTile(tileXMinimum, tileYMinimum);
        WritableRaster wr = r.createCompatibleWritableRaster(1, 1);
        BufferedImage bi =
            new BufferedImage(colorModel, wr,
                              colorModel.isAlphaPremultiplied(), properties);

        Graphics2D bogusG2D = bi.createGraphics();
View Full Code Here

        InterpolationTable jtable = (InterpolationTable)interp;

        // The Medialib InterpolationTable class equivalent
        mediaLibImageInterpTable mlibInterpTable;

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

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.