Package javax.media.jai

Examples of javax.media.jai.ParameterBlockJAI


                                                 new int[] {8,8,8}, false, false,
                                                 Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
        layout.setColorModel(cm);
        layout.setSampleModel(cm.createCompatibleSampleModel(oRenderedImg.getWidth(),oRenderedImg.getHeight()));
        RenderingHints hints = new RenderingHints(javax.media.jai.JAI.KEY_IMAGE_LAYOUT, layout);
        ParameterBlockJAI pb = new ParameterBlockJAI( "format" );
        pb.addSource( oRenderedImg );
        oRenderedImg = javax.media.jai.JAI.create( "format", pb, hints );
      } catch (IllegalArgumentException iae) {
      }
      // End increase color depth
    } // gif
View Full Code Here


   
    public static RenderedOp create(RenderedImage source0,
                                    Double scaleX,
                                    Double scaleY,
                                    RenderingHints hints)  {
        ParameterBlockJAI pb =
            new ParameterBlockJAI("Lanczos",
                                  RenderedRegistryMode.MODE_NAME);

        pb.setSource("source0", source0);

        pb.setParameter("scaleX", scaleX);
        pb.setParameter("scaleY", scaleY);

        return JAI.create("Lanczos", pb, hints);
    }
View Full Code Here

   
    public static RenderableOp createRenderable(RenderableImage source0,
                                                Double scaleX,
                                                Double scaleY,
                                                RenderingHints hints)  {
        ParameterBlockJAI pb =
            new ParameterBlockJAI("Lanczos",
                                  RenderableRegistryMode.MODE_NAME);

        pb.setSource("source0", source0);

        pb.setParameter("scaleX", scaleX);
        pb.setParameter("scaleY", scaleY);

        return JAI.createRenderable("Lanczos", pb, hints);
    }
View Full Code Here

                                                                            false, false, Transparency.OPAQUE);
        ImageLayout rgbImageLayout = new ImageLayout();
        rgbImageLayout.setSampleModel(sRGBColorModel.createCompatibleSampleModel(src.getWidth(), src.getHeight()));
        RenderingHints rgbHints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, rgbImageLayout);
        rgbHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
        ParameterBlockJAI pb = new ParameterBlockJAI("colorconvert");
        pb.addSource(src);
        pb.setParameter("colormodel", sRGBColorModel);

        return JAI.create("colorconvert", pb, rgbHints);
    }
View Full Code Here

                                                                               false, true, Transparency.OPAQUE);
            ImageLayout rgbImageLayout = new ImageLayout();
            rgbImageLayout.setSampleModel(rgbColorModel.createCompatibleSampleModel(src.getWidth(), src.getHeight()));
            RenderingHints rgbHints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, rgbImageLayout);
            rgbHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
            ParameterBlockJAI pb = new ParameterBlockJAI("colorconvert");
            pb.addSource(src);
            pb.setParameter("colormodel", rgbColorModel);

            return JAI.create("colorconvert", pb, rgbHints);
        } else {

            // get user defined color from ColorProfile data
            ColorSpace cmykColorSpace = CMMColorSpace.getInstance(src.getColorModel().getColorSpace().getType());

            ColorModel cmykColorModel = RasterFactory.createComponentColorModel(src.getSampleModel().getDataType(),
                                                                                cmykColorSpace, false, true,
                                                                                Transparency.OPAQUE);
            // replace ColorSpace by format convertor with CMYK ColorSpace
            ImageLayout cmykImageLayout = new ImageLayout();
            cmykImageLayout.setColorModel(cmykColorModel);
            RenderingHints cmykHints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, cmykImageLayout);
            cmykHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
            ParameterBlockJAI pb = new ParameterBlockJAI("format");
            pb.addSource(src);
            pb.setParameter("datatype", src.getSampleModel().getDataType());
            PlanarImage op = JAI.create("format", pb, cmykHints);

            // invert CMYK pixel value
            pb = new ParameterBlockJAI("invert");
            pb.addSource(src);
            op = JAI.create("invert", pb, cmykHints);

            // -- Convert CMYK to RGB
            ColorSpace rgbColorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB);
            ColorModel rgbColorModel = RasterFactory.createComponentColorModel(DataBuffer.TYPE_BYTE, rgbColorSpace,
                                                                               false, true, Transparency.OPAQUE);
            ImageLayout rgbImageLayout = new ImageLayout();
            rgbImageLayout.setSampleModel(rgbColorModel.createCompatibleSampleModel(op.getWidth(), op.getHeight()));
            RenderingHints rgbHints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, rgbImageLayout);
            rgbHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
            pb = new ParameterBlockJAI("colorconvert");
            pb.addSource(op);
            pb.setParameter("colormodel", rgbColorModel);

            return JAI.create("colorconvert", pb, rgbHints);
        }// endif
    }
View Full Code Here

                                    Float xScale,
                                    Float yScale,
                                    Float xTrans,
                                    Float yTrans,
                                    RenderingHints hints)  {
        ParameterBlockJAI pb =
            new ParameterBlockJAI("ImageFunction",
                                  RenderedRegistryMode.MODE_NAME);

        pb.setParameter("function", function);
        pb.setParameter("width", width);
        pb.setParameter("height", height);
        pb.setParameter("xScale", xScale);
        pb.setParameter("yScale", yScale);
        pb.setParameter("xTrans", xTrans);
        pb.setParameter("yTrans", yTrans);

        return JAI.create("ImageFunction", pb, hints);
    }
View Full Code Here

     * @return The <code>RenderedOp</code> destination.
     * @throws IllegalArgumentException if <code>source0</code> is <code>null</code>.
     */
    public static RenderedOp create(RenderedImage source0,
                                    RenderingHints hints)  {
        ParameterBlockJAI pb =
            new ParameterBlockJAI("Not",
                                  RenderedRegistryMode.MODE_NAME);

        pb.setSource("source0", source0);

        return JAI.create("Not", pb, hints);
    }
View Full Code Here

     * @return The <code>RenderableOp</code> destination.
     * @throws IllegalArgumentException if <code>source0</code> is <code>null</code>.
     */
    public static RenderableOp createRenderable(RenderableImage source0,
                                                RenderingHints hints)  {
        ParameterBlockJAI pb =
            new ParameterBlockJAI("Not",
                                  RenderableRegistryMode.MODE_NAME);

        pb.setSource("source0", source0);

        return JAI.createRenderable("Not", pb, hints);
    }
View Full Code Here

     * @throws IllegalArgumentException if <code>source1</code> is <code>null</code>.
     */
    public static RenderedOp create(RenderedImage source0,
                                    RenderedImage source1,
                                    RenderingHints hints)  {
        ParameterBlockJAI pb =
            new ParameterBlockJAI("Multiply",
                                  RenderedRegistryMode.MODE_NAME);

        pb.setSource("source0", source0);
        pb.setSource("source1", source1);

        return JAI.create("Multiply", pb, hints);
    }
View Full Code Here

     * @throws IllegalArgumentException if <code>source1</code> is <code>null</code>.
     */
    public static RenderableOp createRenderable(RenderableImage source0,
                                                RenderableImage source1,
                                                RenderingHints hints)  {
        ParameterBlockJAI pb =
            new ParameterBlockJAI("Multiply",
                                  RenderableRegistryMode.MODE_NAME);

        pb.setSource("source0", source0);
        pb.setSource("source1", source1);

        return JAI.createRenderable("Multiply", pb, hints);
    }
View Full Code Here

TOP

Related Classes of javax.media.jai.ParameterBlockJAI

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.