Package com.lightcrafts.mediax.jai

Examples of com.lightcrafts.mediax.jai.PlanarImage


                // will be retained in the new CollectionImage.
                ArrayList commonNodes = new ArrayList(commonSources.size());
                it = oldRendering.iterator();
                while(it.hasNext()) {
                    RenderedOp node = (RenderedOp)it.next();
                    PlanarImage source = (PlanarImage)node.getSourceImage(0);
                    if(commonSources.contains(source)) {
                        commonNodes.add(node);
                    }
                }

                // Create a new CollectionImage.
                updatedCollection =
                    new AddConstToCollectionOpImage(newSource, newHints,
                                                    constants);

                // Remove from the new CollectionImage all nodes that
                // are common with the old CollectionImage.
                ArrayList newNodes = new ArrayList(oldRendering.size() -
                                                   commonSources.size());
                it = updatedCollection.iterator();
                while(it.hasNext()) {
                    RenderedOp node = (RenderedOp)it.next();
                    PlanarImage source = (PlanarImage)node.getSourceImage(0);
                    if(commonSources.contains(source)) {
                        it.remove();
                    }
                }
View Full Code Here


           p[0] = p[1] = p[2] = (i << (netbiasshift + 8)) / maxColorNum;
           freq[i] = intbias / maxColorNum; /* 1/maxColorNum */
           bias[i] = 0;
        }

        PlanarImage source = getSourceImage(0);
        Rectangle rect = source.getBounds();

        if (roi != null)
            rect = roi.getBounds();

        RandomIter iterator = RandomIterFactory.create(source, rect);
View Full Code Here

      }
      ROI srcROI = (ROI)property;

      // Determine the effective source bounds.
      Rectangle srcBounds = null;
      PlanarImage dst = op.getRendering();
      if(dst instanceof WarpOpImage && !((OpImage)dst).hasExtender(0)) {
    WarpOpImage warpIm = (WarpOpImage)dst;
    srcBounds =
        new Rectangle(src.getMinX() + warpIm.getLeftPadding(),
          src.getMinY() + warpIm.getTopPadding(),
View Full Code Here

            // Retrieve the Interpolation object.
            Interpolation interp = (Interpolation)pb.getObjectParameter(1);

            // Determine the effective source bounds.
            Rectangle srcBounds = null;
            PlanarImage dst = op.getRendering();
            if (dst instanceof GeometricOpImage &&
                ((GeometricOpImage)dst).getBorderExtender() == null) {
                srcBounds =
                    new Rectangle(src.getMinX() + interp.getLeftPadding(),
                                  src.getMinY() + interp.getTopPadding(),
View Full Code Here

            getTileRect(tileX, tileY).intersection(getBounds());

        //
        // Get source
        //
        PlanarImage src = getSourceImage(0);

        //
        // Determine effective source bounds.
        //
        Rectangle srcRect =
            mapDestRect(destRect, 0).intersection(src.getBounds());

        Raster[] sources = new Raster[1];
        sources[0] = src.getData(srcRect);

        //
        // Compute the destination.
        //
        computeRect(sources, dest, destRect);

        // Recycle the source tile
        if(src.overlapsMultipleTiles(srcRect)) {
            recycleTile(sources[0]);
        }

        return dest;
    }
View Full Code Here

        colorMap = null;
        this.histogramSize = upperBound;
    }

    protected synchronized void train() {
        PlanarImage source = getSourceImage(0);
        if (roi == null)
            roi = new ROIShape(source.getBounds());

        // Cycle throw all source tiles.
        int minTileX = source.getMinTileX();
        int maxTileX = source.getMaxTileX();
        int minTileY = source.getMinTileY();
        int maxTileY = source.getMaxTileY();
        int xStart = source.getMinX();
        int yStart = source.getMinY();

        histogram = new HistogramHash(histogramSize);

        while(true) {
            histogram.init();
            int oldbits = bits;
            mask = (255 << 8 - bits) & 255;
            mask = mask | (mask << 8) | (mask << 16);

            for (int y = minTileY; y <= maxTileY; y++) {
                for (int x = minTileX; x <= maxTileX; x++) {
                    // Determine the required region of this tile.
                    // (Note that getTileRect() instersects tile and
                    // image bounds.)
                    Rectangle tileRect = source.getTileRect(x, y);

                    // Process if and only if within ROI bounds.
                    if (roi.intersects(tileRect)) {

                        // If checking for skipped tiles determine
                        // whether this tile is "hit".
                        if (checkForSkippedTiles &&
                            tileRect.x >= xStart &&
                            tileRect.y >= yStart) {
                            // Determine the offset within the tile.
                            int offsetX =
                                (xPeriod - ((tileRect.x - xStart) % xPeriod)) %
                                xPeriod;
                            int offsetY =
                                (yPeriod - ((tileRect.y - yStart) % yPeriod)) %
                                yPeriod;

                            // Continue with next tile if offset
                            // is larger than either tile dimension.
                            if (offsetX >= tileRect.width ||
                                offsetY >= tileRect.height) {
                                continue;
                            }
                        }

                        // add the histogram.
                        computeHistogram(source.getData(tileRect));
                        if (histogram.isFull())
                            break;
                    }
                }
View Full Code Here

                ImageLayout il = new ImageLayout();
                il.setSampleModel(ti.getSampleModel());
                RenderingHints rh = new RenderingHints(JAI.KEY_IMAGE_LAYOUT,
                                                       il);

                PlanarImage constImage = JAI.create("constant", pb, rh);

                // Compute a complement ROI.
                ROI complementROI =
                    (new ROIShape(ti.getBounds())).subtract(roi);;

                // Fill the background.
                int maxTileY = ti.getMaxTileY();
                int maxTileX = ti.getMaxTileX();
                for(int j = ti.getMinTileY(); j <= maxTileY; j++) {
                    for(int i = ti.getMinTileX(); i <= maxTileX; i++) {
                        if(!roi.intersects(ti.getTileRect(i, j))) {
                            ti.setData(constImage.getTile(i, j),
                                       complementROI);
                        }
                    }
                }
View Full Code Here

TOP

Related Classes of com.lightcrafts.mediax.jai.PlanarImage

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.