Package com.lightcrafts.mediax.jai.operator

Examples of com.lightcrafts.mediax.jai.operator.ColorQuantizerType


        RenderedImage source = paramBlock.getRenderedSource(0);

        ImageLayout layout = renderHints == null ? null :
            (ImageLayout)renderHints.get(JAI.KEY_IMAGE_LAYOUT);

        ColorQuantizerType algorithm =
            (ColorQuantizerType)paramBlock.getObjectParameter(0);
        int maxColorNum = paramBlock.getIntParameter(1);
        int upperBound = paramBlock.getIntParameter(2);
        ROI roi= (ROI)paramBlock.getObjectParameter(3);
        int xPeriod = paramBlock.getIntParameter(4);
        int yPeriod = paramBlock.getIntParameter(5);

        // check if 3-band byte-type image
  SampleModel sm = source.getSampleModel();
        if (sm.getNumBands() != && sm.getDataType() == DataBuffer.TYPE_BYTE)
            throw new IllegalArgumentException("ColorQuantizerRIF0");

        if (algorithm.equals(ColorQuantizerDescriptor.NEUQUANT))
            return new NeuQuantOpImage(source, (Map)renderHints, layout,
                                        maxColorNum, upperBound, roi,
                                        xPeriod, yPeriod);

        if (algorithm.equals(ColorQuantizerDescriptor.OCTTREE))
            return new OctTreeOpImage(source, (Map)renderHints, layout,
                                        maxColorNum, upperBound, roi,
                                        xPeriod, yPeriod);
        else
            return new MedianCutOpImage(source, (Map)renderHints, layout,
View Full Code Here

TOP

Related Classes of com.lightcrafts.mediax.jai.operator.ColorQuantizerType

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.