Examples of PDColorSpace


Examples of org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace

        ByteArrayOutputStream os = new ByteArrayOutputStream();
        removeAllFiltersButDCT(os);
        os.close();
        byte[] img = os.toByteArray();
       
        PDColorSpace cs = getColorSpace();
        try
        {
            if (cs instanceof PDDeviceCMYK
                    || (cs instanceof PDICCBased && cs.getNumberOfComponents() == 4))
            {
                // JPEGs may contain CMYK, YCbCr or YCCK decoded image data
                int transform = getApp14AdobeTransform(img);
                // create BufferedImage based on the converted color values
                if (transform == 0)
                {
                    bi = convertCMYK2RGB(readImage(img), cs);
                }
                else if (transform == 1)
                {
                    // TODO YCbCr
                }
                else if (transform == 2)
                {
                    bi = convertYCCK2RGB(readImage(img));
                }
            }
            else if (cs instanceof PDSeparation)
            {
                // create BufferedImage based on the converted color values
                bi = processTintTransformation(readImage(img),
                        ((PDSeparation)cs).getTintTransform(), cs.getJavaColorSpace());
            }
            else if (cs instanceof PDDeviceN)
            {
                // create BufferedImage based on the converted color values
                bi = processTintTransformation(readImage(img),
                        ((PDDeviceN)cs).getTintTransform(), cs.getJavaColorSpace());
            }
            else
            {
                ByteArrayInputStream bai = new ByteArrayInputStream(img);
                bi = ImageIO.read(bai);
View Full Code Here

Examples of org.pdfbox.pdmodel.graphics.color.PDColorSpace

     * @param arguments List
     * @throws IOException If an error occurs while processing the font.
     */
    public void process(PDFOperator operator, List arguments) throws IOException
    {
        PDColorSpace cs = PDDeviceCMYK.INSTANCE;
        PDColorSpaceInstance colorInstance = context.getGraphicsState().getNonStrokingColorSpace();
        colorInstance.setColorSpace( cs );
        float[] values = new float[4];
        for( int i=0; i<arguments.size(); i++ )
        {
View Full Code Here

Examples of org.pdfbox.pdmodel.graphics.color.PDColorSpace

    public void process(PDFOperator operator, List arguments) throws IOException
    {
        //(PDF 1.1) Set color space for stroking operations
        COSName name = (COSName)arguments.get( 0 );
        Map colorSpaces = context.getColorSpaces();
        PDColorSpace cs = null;
        if( colorSpaces != null )
        {
            cs = (PDColorSpace)colorSpaces.get( name.getName() );
        }
        if( cs == null )
        {
            cs = PDColorSpaceFactory.createColorSpace( name );
        }
        PDColorSpaceInstance colorInstance = context.getGraphicsState().getStrokingColorSpace();
        colorInstance.setColorSpace( cs );
        int numComponents = cs.getNumberOfComponents();
        float[] values = EMPTY_FLOAT_ARRAY;
        if( numComponents >= 0 )
        {
            values = new float[numComponents];
            for( int i=0; i<numComponents; i++ )
View Full Code Here

Examples of org.pdfbox.pdmodel.graphics.color.PDColorSpace

     * @param arguments List
     * @throws IOException If an error occurs while processing the font.
     */
    public void process(PDFOperator operator, List arguments) throws IOException
    {
        PDColorSpace cs = PDDeviceRGB.INSTANCE;
        PDColorSpaceInstance colorInstance = context.getGraphicsState().getNonStrokingColorSpace();
        colorInstance.setColorSpace( cs );
        float[] values = new float[3];
        for( int i=0; i<arguments.size(); i++ )
        {
View Full Code Here

Examples of org.pdfbox.pdmodel.graphics.color.PDColorSpace

        return image;
         */
       
       
        //verify again pci32.pdf before changing below
        PDColorSpace pcs = params.getColorSpace();
        ColorModel colorModel = null;
        if(pcs != null)
        {
            colorModel =
                params.getColorSpace().createColorModel(
View Full Code Here

Examples of org.pdfbox.pdmodel.graphics.color.PDColorSpace

        //        (COSInteger) stream.getStream().getDictionary().getDictionaryObject(COSName.LENGTH);
        //byte[] array = new byte[stream.getFilteredStream().];
        byte[] array = getPDStream().getByteArray();

//      Get the ColorModel right
        PDColorSpace colorspace = getColorSpace();
        ColorModel cm = colorspace.createColorModel( bpc );
        WritableRaster raster = cm.createCompatibleWritableRaster( width, height );
        //DataBufferByte buffer = (DataBufferByte)raster.getDataBuffer();
        DataBufferByte buffer = (DataBufferByte)raster.getDataBuffer();
        byte[] bufferData = buffer.getData();
        //System.arraycopy( array, 0, bufferData, 0, array.length );
View Full Code Here

Examples of org.pdfbox.pdmodel.graphics.color.PDColorSpace

     * @throws IOException If there is an error getting the colorspace.
     */
    public PDColorSpace getColorSpace() throws IOException
    {
        COSBase cs = getCOSStream().getDictionaryObject( new String[]{ "CS", "ColorSpace" } );
        PDColorSpace retval = null;
        if( cs != null )
        {
            retval = PDColorSpaceFactory.createColorSpace( cs );
        }
        else
View Full Code Here

Examples of org.pdfbox.pdmodel.graphics.color.PDColorSpace

     * @throws IOException If there is an error getting the colorspace.
     */
    public PDColorSpace getColorSpace() throws IOException
    {
        COSBase cs = getCOSObject( "CS", "ColorSpace" );
        PDColorSpace retval = null;
        if( cs != null )
        {
            retval = PDColorSpaceFactory.createColorSpace( cs );
        }
        return retval;
View Full Code Here

Examples of org.pdfbox.pdmodel.graphics.color.PDColorSpace

     * @param arguments List
     * @throws IOException If an error occurs while processing the font.
     */
    public void process(PDFOperator operator, List arguments) throws IOException
    {
        PDColorSpace cs = PDDeviceRGB.INSTANCE;
        PDColorSpaceInstance colorInstance = context.getGraphicsState().getStrokingColorSpace();
        colorInstance.setColorSpace( cs );
        float[] values = new float[3];
        for( int i=0; i<arguments.size(); i++ )
        {
View Full Code Here

Examples of org.pdfbox.pdmodel.graphics.color.PDColorSpace

     */
    public void process(PDFOperator operator, List arguments) throws IOException
    {
//      (PDF 1.1) Set color space for stroking operations
        COSName name = (COSName)arguments.get( 0 );
        PDColorSpace cs = null;
        Map colorSpaces = context.getColorSpaces();
        if( colorSpaces != null )
        {
             cs = (PDColorSpace)colorSpaces.get( name.getName() );
        }
        if( cs == null )
        {
            cs = PDColorSpaceFactory.createColorSpace( name );
        }
        PDColorSpaceInstance colorInstance = context.getGraphicsState().getNonStrokingColorSpace();
        colorInstance.setColorSpace( cs );
        int numComponents = cs.getNumberOfComponents();
        float[] values = EMPTY_FLOAT_ARRAY;
        if( numComponents >= 0 )
        {
            values = new float[numComponents];
            for( int i=0; i<numComponents; i++ )
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.