Package com.volantis.map.ics.imageprocessor.convertor

Examples of com.volantis.map.ics.imageprocessor.convertor.ImageConvertorException


            // convert to indexed (expensive operation)

            try {
                dstImage = ImageUtils.dither(src, params, expectedMapSize);
            } catch (MissingParameterException e) {
                throw new ImageConvertorException(e);
            }
            if (!isColor()) {
                // then push through the optimized route for grey scale and palette
                // size increase (won't do anything but convert to greyscale in this
                // case)
View Full Code Here


            try {
                dst = JAI.create("lookup", src, lut);
            } catch (Exception e) {
                LOGGER.error("jai-operation-failure", "lookup");
                throw new ImageConvertorException(e);
            }
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Converted from indexed to RGB");
                ImageLogger.log(dst);
            }
        } else
        if (cm instanceof ComponentColorModel &&
            cm.getNumColorComponents() == 1) {
            //Transform image with one colour component into image with three
            //components.
            int[] bandIndices;

            //If we have no alpha data we should extend only colour components.
            if (cm.getNumColorComponents() == cm.getNumComponents()) {
                bandIndices = new int[]{
                    0, //Put the colour data into R(first) component
                    0, //Put the colour data into G(second) component
                    0};//Put the colour data into B(third) component
            } else {
                //In other case we should keep alpha data.
                bandIndices = new int[]{
                    0, //Put the colour data into R(first) component
                    0, //Put the colour data into G(second) component
                    0, //Put the colour data into B(third) component
                    1};//Put the alpha data into A(fourth) component
            }
            //Construct the ParameterBlock.
            ParameterBlock parameters = new ParameterBlock();
            parameters.addSource(src);
            parameters.add(bandIndices);

            try {
                dst = JAI.create("bandSelect", parameters);
            } catch (Exception e) {
                LOGGER.error("jai-operation-failure", "bandSelect");
                throw new ImageConvertorException(e);
            }
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Number of colour components extended");
                ImageLogger.log(dst);
            }
View Full Code Here

TOP

Related Classes of com.volantis.map.ics.imageprocessor.convertor.ImageConvertorException

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.