Package com.lightcrafts.mediax.jai

Examples of com.lightcrafts.mediax.jai.RenderedOp$TCL


                size.width - insets.left - insets.right,
                size.height - insets.top - insets.bottom
            );
        }
        else {
            RenderedOp op = AffineDescriptor.create(
                image, getTransform(), null, null, null
            );
            g.drawRenderedImage(op, new AffineTransform());
        }
    }
View Full Code Here


            String path = "resources/resize.png";
            URL url = CropOverlay.class.getResource(path);
            RenderedImage resourceImage = ImageIO.read(url);
            int cx = resourceImage.getWidth() / 2;
            int cy = resourceImage.getHeight() / 2;
            RenderedOp rotatedImage = RotateDescriptor.create(
                resourceImage,
                (float) cx, (float) cy, (float) angle,
                Interpolation.getInstance(Interpolation.INTERP_BICUBIC),
                null, null
            );
            Point hot = new Point(cx, cy);
            Toolkit toolkit = Toolkit.getDefaultToolkit();
            BufferedImage buffer = rotatedImage.getAsBufferedImage();
            Cursor cursor = toolkit.createCustomCursor(buffer, hot, "resize");

            RecentCursorAngle = angle;
            RecentCursor = cursor;
View Full Code Here

        double[][] t = new double[3][4]; // for BC, last column si going to be zero
        for (int i = 0; i < 3; i++)
            for (int j = 0; j < 3; j++)
                t[i][j] = b[i][j];

        RenderedOp cargb = JAI.create("BandCombine", image, t, null);

        if (tint != 0)
            return tintCast(cargb, tint, lightness);
        else
            return cargb;
View Full Code Here

                              Object opNode) {
        validate(name, opNode);

        if(opNode instanceof RenderedOp &&
           name.equalsIgnoreCase("roi")) {
            RenderedOp op = (RenderedOp)opNode;

            ParameterBlock pb = op.getParameterBlock();

            // Retrieve the rendered source image and its ROI.
            PlanarImage src = (PlanarImage)pb.getRenderedSource(0);
            Object property = src.getProperty("ROI");
            if (property == null ||
View Full Code Here

                hints = new RenderingHints(JAI.KEY_BORDER_EXTENDER, extender);
            } else {
                hints.put(JAI.KEY_BORDER_EXTENDER, extender);
            }
                                  
            RenderedOp filter = new RenderedOp("convolve", pb, hints);

            // Add the subsampling operation.
            pb = new ParameterBlock();
            pb.addSource(filter);
            pb.add(new Float(0.5F)).add(new Float(0.5F));
            pb.add(new Float(0.0F)).add(new Float(0.0F));
            pb.add(Interpolation.getInstance(Interpolation.INTERP_NEAREST));
            RenderedOp downSampler = new RenderedOp("scale", pb, null);
            args.set(downSampler, 0);
        }

        // Verify the generic integrity of the arguments and set defaults.
        if(!super.validateParameters(args, msg)) {
View Full Code Here

                              Object opNode) {
        validate(name, opNode);

        if(opNode instanceof RenderedOp &&
           name.equalsIgnoreCase("roi")) {
            RenderedOp op = (RenderedOp)opNode;

            ParameterBlock pb = op.getParameterBlock();

            // Retrieve the rendered source image and its ROI.
            RenderedImage src = (RenderedImage)pb.getRenderedSource(0);
            Object property = src.getProperty("ROI");
            if (property == null ||
                property.equals(java.awt.Image.UndefinedProperty) ||
                !(property instanceof ROI)) {
                return java.awt.Image.UndefinedProperty;
            }
            ROI srcROI = (ROI)property;

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

            // 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(),
                                  src.getWidth() - interp.getWidth() + 1,
                                  src.getHeight() - interp.getHeight() + 1);
            } else {
                srcBounds = new Rectangle(src.getMinX(),
            src.getMinY(),
            src.getWidth(),
            src.getHeight());
            }

            // Set the nearest neighbor interpolation object.
            Interpolation interpNN = interp instanceof InterpolationNearest ?
                interp :
                Interpolation.getInstance(Interpolation.INTERP_NEAREST);

            // Retrieve the operation parameters.
            float sv = pb.getFloatParameter(0);
            EnumeratedParameter shearDir =
                (EnumeratedParameter)pb.getObjectParameter(1);
            float tx = pb.getFloatParameter(2);
            float ty = pb.getFloatParameter(3);

            // Create an equivalent transform.
            AffineTransform transform =
                new AffineTransform(1.0,
                                    shearDir == ShearDescriptor.SHEAR_VERTICAL ? sv : 0,
                                    shearDir == ShearDescriptor.SHEAR_HORIZONTAL ? sv : 0,
                                    1.0,
                                    shearDir == ShearDescriptor.SHEAR_HORIZONTAL ? tx : 0,
                                    shearDir == ShearDescriptor.SHEAR_VERTICAL ? ty : 0);

            // Create the sheared ROI.
            ROI dstROI = srcROI.transform(transform);

            // Retrieve the destination bounds.
            Rectangle dstBounds = op.getBounds();

            // If necessary, clip the sheared ROI to the destination bounds.
            if(!dstBounds.contains(dstROI.getBounds())) {
                dstROI = dstROI.intersect(new ROIShape(dstBounds));
            }
View Full Code Here

                              Object opNode) {
        validate(name, opNode);

        if(opNode instanceof RenderedOp &&
           name.equalsIgnoreCase("roi")) {
            RenderedOp op = (RenderedOp)opNode;

            ParameterBlock pb = op.getParameterBlock();

            // Retrieve the rendered source image and its ROI.
            RenderedImage src = pb.getRenderedSource(0);
            Object property = src.getProperty("ROI");
            if (property == null ||
                property.equals(java.awt.Image.UndefinedProperty) ||
                !(property instanceof ROI)) {
                return java.awt.Image.UndefinedProperty;
            }
            ROI srcROI = (ROI)property;

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

            // 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(),
                                  src.getWidth() - interp.getWidth() + 1,
                                  src.getHeight() - interp.getHeight() + 1);
            } else {
                srcBounds = new Rectangle(src.getMinX(),
            src.getMinY(),
            src.getWidth(),
            src.getHeight());
            }

            // If necessary, clip the ROI to the effective source bounds.
            if(!srcBounds.contains(srcROI.getBounds())) {
                srcROI = srcROI.intersect(new ROIShape(srcBounds));
            }

            // Retrieve the translation values.
            float tx = pb.getFloatParameter(0);
            float ty = pb.getFloatParameter(1);

            // Create a transform representing the translation.
            AffineTransform transform =
                AffineTransform.getTranslateInstance((double) tx,
                                                     (double) ty);
            // Create the translated ROI.
            ROI dstROI = srcROI.transform(transform);

            // Retrieve the destination bounds.
            Rectangle dstBounds = op.getBounds();

            // If necessary, clip the warped ROI to the destination bounds.
            if(!dstBounds.contains(dstROI.getBounds())) {
                dstROI = dstROI.intersect(new ROIShape(dstBounds));
            }
View Full Code Here

                              Object opNode) {
        validate(name, opNode);

        if(opNode instanceof RenderedOp &&
           name.equalsIgnoreCase("roi")) {
            RenderedOp op = (RenderedOp)opNode;

            ParameterBlock pb = op.getParameterBlock();

            // Retrieve the rendered source image and its ROI.
            RenderedImage src = pb.getRenderedSource(0);
            Object property = src.getProperty("ROI");
            if (property == null ||
                property.equals(java.awt.Image.UndefinedProperty) ||
                !(property instanceof ROI)) {
                return java.awt.Image.UndefinedProperty;
            }
            ROI srcROI = (ROI)property;

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

            // 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(),
                                  src.getWidth() - interp.getWidth() + 1,
                                  src.getHeight() - interp.getHeight() + 1);
            } else {
                srcBounds = new Rectangle(src.getMinX(),
            src.getMinY(),
            src.getWidth(),
            src.getHeight());
            }

            // If necessary, clip the ROI to the effective source bounds.
            if(!srcBounds.contains(srcROI.getBounds())) {
                srcROI = srcROI.intersect(new ROIShape(srcBounds));
            }

            // Retrieve the scale factors and translation values.
            float sx = pb.getFloatParameter(0);
            float sy = pb.getFloatParameter(1);
            float tx = pb.getFloatParameter(2);
            float ty = pb.getFloatParameter(3);

            // Create an equivalent transform.
            AffineTransform transform =
                new AffineTransform(sx, 0.0, 0.0, sy, tx, ty);

            // Create the scaled ROI.
            ROI dstROI = srcROI.transform(transform);

            // Retrieve the destination bounds.
            Rectangle dstBounds = op.getBounds();

            // If necessary, clip the warped ROI to the destination bounds.
            if(!dstBounds.contains(dstROI.getBounds())) {
                dstROI = dstROI.intersect(new ROIShape(dstBounds));
            }
View Full Code Here

    } else {
        RenderedImage ri = (RenderedImage)ai;
        replacedSrcs.add(new SerializableRenderedImage(ri));
    }
      } else if (obj instanceof RenderedOp){
    RenderedOp rop = (RenderedOp)obj;
    replacedSrcs.add(new SerializableRenderedImage(
            (RenderedImage)rop.getRendering()));
      } else if (obj instanceof Serializable) {
    replacedSrcs.add(obj);
      } else if (obj instanceof RenderedImage) {
    RenderedImage ri = (RenderedImage)obj;
    replacedSrcs.add(new SerializableRenderedImage(ri));
View Full Code Here

                                             paramBlock, msg)) {
                    throw new IllegalArgumentException(msg.toString());
                }

                // Create the rendered operation node.
                rendering = new RenderedOp(registry, operationName,
                                           paramBlock, renderHints);
            }

            // Return the rendering if possible.
            if(rendering != null) {
View Full Code Here

TOP

Related Classes of com.lightcrafts.mediax.jai.RenderedOp$TCL

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.