Package javax.media.jai

Examples of javax.media.jai.LookupTableJAI


        ParameterBlock pb = new ParameterBlock();
        pb.addSource(img);
        String opName = null;
        if (isErrorDiffusion) {
            opName = "errordiffusion";
            LookupTableJAI lut = new LookupTableJAI(new byte[] {(byte)0x00, (byte)0xff});
            pb.add(lut);
            pb.add(KernelJAI.ERROR_FILTER_FLOYD_STEINBERG);
        } else {
            opName = "ordereddither";
            //Create the color cube.
View Full Code Here


     */
    public RenderedImage create(ParameterBlock args,
                                RenderingHints hints) {
        // Get source and parameters.
        RenderedImage source = args.getRenderedSource(0);
        LookupTableJAI colorMap =
            (LookupTableJAI)args.getObjectParameter(0);
        KernelJAI errorKernel = (KernelJAI)args.getObjectParameter(1);

        // Check colorMap compatibility.
        if(colorMap.getNumBands() != 1 &&
           colorMap.getNumBands() != 3) {
            // 1 or 3 band colorMaps only.
            return null;
        } else if(colorMap.getDataType() != DataBuffer.TYPE_BYTE) {
            // byte colorMaps only
            return null;
        }

        // Check source compatibility.
        SampleModel sourceSM = source.getSampleModel();
        if(sourceSM.getDataType() != DataBuffer.TYPE_BYTE) {
            // byte source images only
            return null;
        } else if(sourceSM.getNumBands() != colorMap.getNumBands()) {
            // band counts must match
            return null;
        }

        // Get ImageLayout from RenderingHints if any.
View Full Code Here

        // Get ImageLayout from renderHints if any.
        ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
       

        RenderedImage source = paramBlock.getRenderedSource(0);
        LookupTableJAI lookupTable =
            (LookupTableJAI)paramBlock.getObjectParameter(0);
        KernelJAI kernel = (KernelJAI)paramBlock.getObjectParameter(1);

        return new ErrorDiffusionOpImage(source, renderHints, layout,
                                         lookupTable, kernel);
View Full Code Here


    /** Creates the lookup table and computes the inverse mapping. */
    private void createLUT(int ncubes) {
        if (colorMap == null) {
            colorMap = new LookupTableJAI(new byte[3][ncubes]);
        }

        byte[] rLUT = colorMap.getByteData(0);
        byte[] gLUT = colorMap.getByteData(1);
        byte[] bLUT = colorMap.getByteData(2);
View Full Code Here

        setProperty("LUT", colorMap);
        setProperty("JAI.LookupTable", colorMap);
    }

    private void createLUT() {
        colorMap = new LookupTableJAI(new byte[3][maxColorNum]);
        byte[][] map = colorMap.getByteData();
        int[] index = new int[maxColorNum];
        for (int i = 0; i < maxColorNum; i++)
            index[network[i][3]] = i;
        for (int i = 0; i < maxColorNum; i++) {
View Full Code Here

        if (!MediaLibAccessor.isMediaLibCompatible(args)) {
            return null;
        }

        /* The table should be less than or equal to 4 bands. */
        LookupTableJAI table = (LookupTableJAI)args.getObjectParameter(0);
        if (table.getNumBands() > 4 ||
            table.getDataType() == DataBuffer.TYPE_USHORT) {
            return null;
        }

        return new MlibLookupOpImage(args.getRenderedSource(0),
                                     hints, layout,
View Full Code Here

            if (newNumBands == 4) {
                icm.getAlphas(lutData[3]);
            }

            // Create the lookup table customer .
            LookupTableJAI lut = new LookupTableJAI(lutData);

            // Replace the original image with the 3-band RGB image.
            src = JAI.create("lookup", src, lut);
        }
View Full Code Here

            for(int i = 0; i < 256; i++) {
                b[i] = (byte)i;
            }
        }

        return new LookupTableJAI(data);
    }
View Full Code Here

                pb = (new ParameterBlock()).addSource(ri).add(matrix);
                ri = JAI.createRenderable("bandcombine", pb);
            }

            float contrast = paramBlock.getFloatParameter(4);
            LookupTableJAI lut = createContrastLUT(contrast, nBands);

            pb = (new ParameterBlock()).addSource(ri).add(lut);
            ri = JAI.createRenderable("lookup", pb);

            if(isPYCC) {
View Full Code Here

                    ImageUtil.clampRoundByte(binarySearch(x, yL, yH, a, b, value));
            }
        }

        // Construct the lookup table.
        lut = new LookupTableJAI(data);
    }
View Full Code Here

TOP

Related Classes of javax.media.jai.LookupTableJAI

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.