Examples of PDFunction


Examples of org.apache.pdfbox.pdmodel.common.function.PDFunction

            }
            else if (colorspace instanceof PDSeparation)
            {
                PDSeparation csSeparation = (PDSeparation)colorspace;
                int numberOfComponents = csSeparation.getAlternateColorSpace().getNumberOfComponents();
                PDFunction tintTransformFunc = csSeparation.getTintTransform();
                COSArray decode = getDecode();
                // we have to invert the tint-values,
                // if the Decode array exists and consists of (1,0)
                boolean invert = decode != null && decode.getInt(0) == 1;
                // TODO add interpolation for other decode values then 1,0
                int maxValue = (int)Math.pow(2,bpc) - 1;
                // destination array
                byte[] mappedData = new byte[width*height*numberOfComponents];
                int rowLength = width*numberOfComponents;
                float[] input = new float[1];
                for ( int i = 0; i < height; i++ )
                {
                    int rowOffset = i * rowLength;
                    for (int j = 0; j < width; j++)
                    {
                        // scale tint values to a range of 0...1
                        int value = (array[ i * width + j ] + 256) % 256;
                        if (invert)
                        {
                            input[0] = 1-(value / maxValue);
                        }
                        else
                        {
                            input[0] =  value / maxValue;
                        }
                        float[] mappedColor = tintTransformFunc.eval(input);
                        int columnOffset = j * numberOfComponents;
                        for ( int k = 0; k < numberOfComponents; k++ )
                        {
                            // redo scaling for every single color value
                            float mappedValue = mappedColor[k];
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.function.PDFunction

     * @return COSArray with the color components
     * @throws IOException If the tint function is not supported
     */
    public COSArray calculateColorValues(List<COSBase> tintValues) throws IOException
    {
        PDFunction tintTransform = getTintTransform();
        COSArray tint = new COSArray();
        tint.addAll(tintValues);
        return tintTransform.eval(tint);
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.function.PDFunction

            }
            else if (colorspace instanceof PDSeparation)
            {
                PDSeparation csSeparation = (PDSeparation)colorspace;
                int numberOfComponents = csSeparation.getAlternateColorSpace().getNumberOfComponents();
                PDFunction tintTransformFunc = csSeparation.getTintTransform();
                COSArray decode = getDecode();
                // we have to invert the tint-values,
                // if the Decode array exists and consists of (1,0)
                boolean invert = decode != null && decode.getInt(0) == 1;
                // TODO add interpolation for other decode values then 1,0
                int maxValue = (int)Math.pow(2,bpc) - 1;
                // destination array
                byte[] mappedData = new byte[width*height*numberOfComponents];
                int rowLength = width*numberOfComponents;
                float[] input = new float[1];
                for ( int i = 0; i < height; i++ )
                {
                    int rowOffset = i * rowLength;
                    for (int j = 0; j < width; j++)
                    {
                        // scale tint values to a range of 0...1
                        int value = (array[ i * width + j ] + 256) % 256;
                        if (invert)
                        {
                            input[0] = 1-(value / maxValue);
                        }
                        else
                        {
                            input[0] =  value / maxValue;
                        }
                        float[] mappedColor = tintTransformFunc.eval(input);
                        int columnOffset = j * numberOfComponents;
                        for ( int k = 0; k < numberOfComponents; k++ )
                        {
                            // redo scaling for every single color value
                            float mappedValue = mappedColor[k];
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.function.PDFunction

     * @return COSArray with the color components
     * @throws IOException If the tint function is not supported
     */
    public COSArray calculateColorValues(List<COSBase> tintValues) throws IOException
    {
        PDFunction tintTransform = getTintTransform();
        COSArray tint = new COSArray();
        tint.addAll(tintValues);
        return tintTransform.eval(tint);
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.function.PDFunction

            }
            else if (colorspace instanceof PDSeparation)
            {
                PDSeparation csSeparation = (PDSeparation)colorspace;
                int numberOfComponents = csSeparation.getAlternateColorSpace().getNumberOfComponents();
                PDFunction tintTransformFunc = csSeparation.getTintTransform();
                COSArray decode = getDecode();
                // we have to invert the tint-values,
                // if the Decode array exists and consists of (1,0)
                boolean invert = decode != null && decode.getInt(0) == 1;
                // TODO add interpolation for other decode values then 1,0
                int maxValue = (int)Math.pow(2,bpc) - 1;
                // destination array
                byte[] mappedData = new byte[width*height*numberOfComponents];
                int rowLength = width*numberOfComponents;
                float[] input = new float[1];
                for ( int i = 0; i < height; i++ )
                {
                    int rowOffset = i * rowLength;
                    for (int j = 0; j < width; j++)
                    {
                        // scale tint values to a range of 0...1
                        int value = (array[ i * width + j ] + 256) % 256;
                        if (invert)
                        {
                            input[0] = 1-(value / maxValue);
                        }
                        else
                        {
                            input[0] =  value / maxValue;
                        }
                        float[] mappedColor = tintTransformFunc.eval(input);
                        int columnOffset = j * numberOfComponents;
                        for ( int k = 0; k < numberOfComponents; k++ )
                        {
                            // redo scaling for every single color value
                            float mappedValue = mappedColor[k];
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.function.PDFunction

     * @return COSArray with the color components
     * @throws IOException If the tint function is not supported
     */
    public COSArray calculateColorValues(COSBase tintValue) throws IOException
    {
        PDFunction tintTransform = getTintTransform();
        COSArray tint = new COSArray();
        tint.add(tintValue);
        return tintTransform.eval(tint);
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.function.PDFunction

            }
            else if (colorspace instanceof PDSeparation)
            {
                PDSeparation csSeparation = (PDSeparation)colorspace;
                int numberOfComponents = csSeparation.getAlternateColorSpace().getNumberOfComponents();
                PDFunction tintTransformFunc = csSeparation.getTintTransform();
                COSArray decode = getDecode();
                // we have to invert the tint-values,
                // if the Decode array exists and consists of (1,0)
                boolean invert = decode != null && decode.getInt(0) == 1;
                // TODO add interpolation for other decode values then 1,0
                int maxValue = (int)Math.pow(2,bpc) - 1;
                // destination array
                byte[] mappedData = new byte[width*height*numberOfComponents];
                int rowLength = width*numberOfComponents;
                float[] input = new float[1];
                for ( int i = 0; i < height; i++ )
                {
                    int rowOffset = i * rowLength;
                    for (int j = 0; j < width; j++)
                    {
                        // scale tint values to a range of 0...1
                        int value = (array[ i * width + j ] + 256) % 256;
                        if (invert)
                        {
                            input[0] = 1-(value / maxValue);
                        }
                        else
                        {
                            input[0] =  value / maxValue;
                        }
                        float[] mappedColor = tintTransformFunc.eval(input);
                        int columnOffset = j * numberOfComponents;
                        for ( int k = 0; k < numberOfComponents; k++ )
                        {
                            // redo scaling for every single color value
                            float mappedValue = mappedColor[k];
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.function.PDFunction

            }
            else if (colorspace instanceof PDSeparation)
            {
                PDSeparation csSeparation = (PDSeparation)colorspace;
                int numberOfComponents = csSeparation.getAlternateColorSpace().getNumberOfComponents();
                PDFunction tintTransformFunc = csSeparation.getTintTransform();
                COSArray decode = getDecode();
                // we have to invert the tint-values,
                // if the Decode array exists and consists of (1,0)
                boolean invert = decode != null && decode.getInt(0) == 1;
                // TODO add interpolation for other decode values then 1,0
                int maxValue = (int)Math.pow(2,bpc) - 1;
                // destination array
                byte[] mappedData = new byte[width*height*numberOfComponents];
                int rowLength = width*numberOfComponents;
                float[] input = new float[1];
                for ( int i = 0; i < height; i++ )
                {
                    int rowOffset = i * rowLength;
                    for (int j = 0; j < width; j++)
                    {
                        // scale tint values to a range of 0...1
                        int value = (array[ i * width + j ] + 256) % 256;
                        if (invert)
                        {
                            input[0] = 1-(value / maxValue);
                        }
                        else
                        {
                            input[0] =  value / maxValue;
                        }
                        float[] mappedColor = tintTransformFunc.eval(input);
                        int columnOffset = j * numberOfComponents;
                        for ( int k = 0; k < numberOfComponents; k++ )
                        {
                            // redo scaling for every single color value
                            float mappedValue = mappedColor[k];
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.function.PDFunction

     * @return COSArray with the color components
     * @throws IOException If the tint function is not supported
     */
    public COSArray calculateColorValues(COSBase tintValue) throws IOException
    {
        PDFunction tintTransform = getTintTransform();
        if(tintTransform instanceof PDFunctionType4)
        {
            log.warn("Unsupported tint transformation type: "+tintTransform.getClass().getName()
                    + " in "+getClass().getName()+".getColorValues()"
                    + " using color black instead.");
            int numberOfComponents = getAlternateColorSpace().getNumberOfComponents();
            // To get black as color:
            // 0.0f is used for the single value(s) if the colorspace is gray or RGB based
            // 1.0f is used for the single value if the colorspace is CMYK based
            float colorValue = numberOfComponents == 4 ? 1.0f : 0.0f;
            COSArray retval = new COSArray();
            for (int i=0;i<numberOfComponents;i++)
            {
                retval.add(new COSFloat(colorValue));
            }
            return retval;
        }
        else
        {
            COSArray tint = new COSArray();
            tint.add(tintValue);
            return tintTransform.eval(tint);
        }
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.function.PDFunction

     * @return COSArray with the color components
     * @throws IOException If the tint function is not supported
     */
    public COSArray calculateColorValues(List<COSBase> tintValues) throws IOException
    {
        PDFunction tintTransform = getTintTransform();
        if(tintTransform instanceof PDFunctionType4)
        {
            log.warn("Unsupported tint transformation type: "+tintTransform.getClass().getName()
                    + " in "+getClass().getName()+".getColorValues()"
                    + " using color black instead.");
            int numberOfComponents = getAlternateColorSpace().getNumberOfComponents();
            // To get black as color:
            // 0.0f is used for the single value(s) if the colorspace is gray or RGB based
            // 1.0f is used for the single value if the colorspace is CMYK based
            float colorValue = numberOfComponents == 4 ? 1.0f : 0.0f;
            COSArray retval = new COSArray();
            for (int i=0;i<numberOfComponents;i++)
            {
                retval.add(new COSFloat(colorValue));
            }
            return retval;
        }
        else
        {
            COSArray tint = new COSArray();
            tint.addAll(tintValues);
            return tintTransform.eval(tint);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.