Examples of PDRange


Examples of org.apache.pdfbox.pdmodel.common.PDRange

     *
     * @return The decode parameter range or null if none is set.
     */
    public PDRange getDecodeForParameter(int paramNum)
    {
        PDRange retval = null;
        COSArray decodeValues = getDecodeValues();
        if (decodeValues != null && decodeValues.size() >= paramNum * 2 + 1)
        {
            retval = new PDRange(decodeValues, paramNum);
        }
        return retval;
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.PDRange

        //c1,max,..., cn, min, cn,max].
        //
        // see p344
        COSArray decode = (COSArray) cosDictionary.getDictionaryObject(COSName.DECODE);
        LOG.debug("decode: " + decode);
        PDRange rangeX = shadingType5.getDecodeForParameter(0);
        PDRange rangeY = shadingType5.getDecodeForParameter(1);
        LOG.debug("rangeX: " + rangeX.getMin() + ", " + rangeX.getMax());
        LOG.debug("rangeY: " + rangeY.getMin() + ", " + rangeY.getMax());

        PDRange[] colRangeTab = new PDRange[numberOfColorComponents];
        for (int i = 0; i < numberOfColorComponents; ++i)
        {
            colRangeTab[i] = shadingType5.getDecodeForParameter(2 + i);
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.PDRange

        //c1,max,..., cn, min, cn,max].
        //
        // see p344
        COSArray decode = (COSArray) cosDictionary.getDictionaryObject(COSName.DECODE);
        LOG.debug("decode: " + decode);
        PDRange rangeX = shadingType4.getDecodeForParameter(0);
        PDRange rangeY = shadingType4.getDecodeForParameter(1);
        LOG.debug("rangeX: " + rangeX.getMin() + ", " + rangeX.getMax());
        LOG.debug("rangeY: " + rangeY.getMin() + ", " + rangeY.getMax());

        PDRange[] colRangeTab = new PDRange[numberOfColorComponents];
        for (int i = 0; i < numberOfColorComponents; ++i)
        {
            colRangeTab[i] = shadingType4.getDecodeForParameter(2 + i);
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.PDRange

    {
        //This function is known as a "stitching" function. Based on the input, it decides which child function to call.
        //See PDF Reference section 3.9.3.
        PDFunction function = null;
        float x = ((COSNumber)input.get(0)).floatValue();
        PDRange domain = getDomainForInput(1);
        // clip input value to domain
        x = clipToRange(x, domain.getMin(), domain.getMax());

        float[] boundsValues = getBounds().toFloatArray();
        int boundsSize = boundsValues.length;
        if (boundsSize == 0 || x < boundsValues[0])
        {
            function = PDFunction.create(getFunctions().get(0));
            PDRange encode = getEncodeForParameter(0);
            if (boundsSize == 0)
            {
                x = interpolate(x, domain.getMin(), domain.getMax(), encode.getMin(), encode.getMax());
            }
            else
            {
                x = interpolate(x, domain.getMin(), boundsValues[0], encode.getMin(), encode.getMax());
            }
        }
        else
        {
            for (int i=0; i<boundsSize-1; i++)
            {
                if ( x >= boundsValues[i] && x < boundsValues[i+1] )
                {
                    function = PDFunction.create(getFunctions().get(i+1));
                    PDRange encode = getEncodeForParameter(i+1);
                    x = interpolate(x, boundsValues[i], boundsValues[i+1], encode.getMin(), encode.getMax());
                    break;
                }
            }
            if(function==null) //must be in last partition
            {
                function = PDFunction.create(getFunctions().get(boundsSize+1));
                PDRange encode = getEncodeForParameter(boundsSize+1);
                x = interpolate(x, boundsValues[boundsSize-1], domain.getMax(), encode.getMin(), encode.getMax());
            }
        }
        COSArray functionValues = new COSArray();
        functionValues.add(new COSFloat(x));
        COSArray functionResult = function.eval(functionValues);
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.PDRange

     * @return The encode parameter range or null if none is set.
     */
    private PDRange getEncodeForParameter(int n)
    {
        COSArray encodeValues = getEncode();
        return new PDRange( encodeValues, n );
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.PDRange

     *
     * @return The decode parameter range or null if none is set.
     */
    public PDRange getDecodeForParameter( int paramNum )
    {
        PDRange retval = null;
        COSArray decodeValues = getDecodeValues();
        if( decodeValues != null && decodeValues.size() >= paramNum*2+1 )
        {
            retval = new PDRange(decodeValues, paramNum );
        }
        return retval;
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.PDRange

     *
     * @return The decode parameter range or null if none is set.
     */
    public PDRange getDecodeForParameter( int paramNum )
    {
        PDRange retval = null;
        COSArray decodeValues = getDecodeValues();
        if( decodeValues != null && decodeValues.size() >= paramNum*2+1 )
        {
            retval = new PDRange(decodeValues, paramNum );
        }
        return retval;
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.PDRange

        //This function is known as a "stitching" function. Based on the input, it decides which child function to call.
        // All functions in the array are 1-value-input functions
        //See PDF Reference section 3.9.3.
        PDFunction function = null;
        float x = input[0];
        PDRange domain = getDomainForInput(0);
        // clip input value to domain
        x = clipToRange(x, domain.getMin(), domain.getMax());

        COSArray functionsArray = getFunctions();
        int numberOfFunctions = functionsArray.size();
        // This doesn't make sense but it may happen ...
        if (numberOfFunctions == 1)
        {
            function = PDFunction.create(functionsArray.get(0));
            PDRange encRange = getEncodeForParameter(0);
            x = interpolate(x, domain.getMin(), domain.getMax(), encRange.getMin(), encRange.getMax());
        }
        else
        {
            float[] boundsValues = getBounds().toFloatArray();
            int boundsSize = boundsValues.length;
            // create a combined array containing the domain and the bounds values
            // domain.min, bounds[0], bounds[1], ...., bounds[boundsSize-1], domain.max
            float[] partitionValues = new float[boundsSize+2];
            int partitionValuesSize = partitionValues.length;
            partitionValues[0] = domain.getMin();
            partitionValues[partitionValuesSize-1] = domain.getMax();
            System.arraycopy(boundsValues, 0, partitionValues, 1, boundsSize);
            // find the partition
            for (int i=0; i < partitionValuesSize-1; i++)
            {
                if ( x >= partitionValues[i] &&
                        (x < partitionValues[i+1] || (i == partitionValuesSize - 2 && x == partitionValues[i+1])))
                {
                    function = PDFunction.create(functionsArray.get(i));
                    PDRange encRange = getEncodeForParameter(i);
                    x = interpolate(x, partitionValues[i], partitionValues[i+1], encRange.getMin(), encRange.getMax());
                    break;
                }
            }
        }
        float[] functionValues = new float[]{x};
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.PDRange

     * @return The encode parameter range or null if none is set.
     */
    private PDRange getEncodeForParameter(int n)
    {
        COSArray encodeValues = getEncode();
        return new PDRange( encodeValues, n );
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.PDRange

     * @return The range for this component.
     */
    public PDRange getRangeForOutput(int n)
    {
        COSArray rangeValues = getRangeValues();
        return new PDRange( rangeValues, n );
    }
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.