Package com.itextpdf.text

Examples of com.itextpdf.text.ImgRaw


                    img = Image.getInstance(w, h, false, Image.CCITTG4,
                        photometric == TIFFConstants.PHOTOMETRIC_MINISBLACK ? Image.CCITT_BLACKIS1 : 0, g4.close());
                }
                else {
                    zip.close();
                    img = new ImgRaw(w, h, samplePerPixel - extraSamples, bitsPerSample, stream.toByteArray());
                    img.setDeflated(true);
                }
            }
            img.setDpi(dpiX, dpiY);
            if (compression != TIFFConstants.COMPRESSION_OJPEG && compression != TIFFConstants.COMPRESSION_JPEG) {
View Full Code Here


            case VERSION_2_24_BIT:
                // no compression
                bdata = new byte[width * height * 3];
                read24Bit(bdata);
                return new ImgRaw(width, height, 3, 8, bdata);

            case VERSION_3_1_BIT:
                // 1-bit images cannot be compressed.
                return read1Bit(4);

            case VERSION_3_4_BIT:
                switch((int)compression) {
                    case BI_RGB:
                        return read4Bit(4);

                    case BI_RLE4:
                        return readRLE4();

                    default:
                        throw new
                        RuntimeException("Invalid compression specified for BMP file.");
                }

            case VERSION_3_8_BIT:
                switch((int)compression) {
                    case BI_RGB:
                        return read8Bit(4);

                    case BI_RLE8:
                        return readRLE8();

                    default:
                        throw new
                        RuntimeException("Invalid compression specified for BMP file.");
                }

            case VERSION_3_24_BIT:
                // 24-bit images are not compressed
                bdata = new byte[width * height * 3];
                read24Bit(bdata);
                return new ImgRaw(width, height, 3, 8, bdata);

            case VERSION_3_NT_16_BIT:
                return read1632Bit(false);

            case VERSION_3_NT_32_BIT:
                return read1632Bit(true);

            case VERSION_4_1_BIT:
                return read1Bit(4);

            case VERSION_4_4_BIT:
                switch((int)compression) {

                    case BI_RGB:
                        return read4Bit(4);

                    case BI_RLE4:
                        return readRLE4();

                    default:
                        throw new
                        RuntimeException("Invalid compression specified for BMP file.");
                }

            case VERSION_4_8_BIT:
                switch((int)compression) {

                    case BI_RGB:
                        return read8Bit(4);

                    case BI_RLE8:
                        return readRLE8();

                    default:
                        throw new
                        RuntimeException("Invalid compression specified for BMP file.");
                }

            case VERSION_4_16_BIT:
                return read1632Bit(false);

            case VERSION_4_24_BIT:
                bdata = new byte[width * height * 3];
                read24Bit(bdata);
                return new ImgRaw(width, height, 3, 8, bdata);

            case VERSION_4_32_BIT:
                return read1632Bit(true);
        }
        return null;
View Full Code Here

        }
        return null;
    }

    private Image indexedModel(byte bdata[], int bpc, int paletteEntries) throws BadElementException {
        Image img = new ImgRaw(width, height, 1, bpc, bdata);
        PdfArray colorspace = new PdfArray();
        colorspace.add(PdfName.INDEXED);
        colorspace.add(PdfName.DEVICERGB);
        byte np[] = getPalette(paletteEntries);
        int len = np.length;
        colorspace.add(new PdfNumber(len / 3 - 1));
        colorspace.add(new PdfString(np));
        PdfDictionary ad = new PdfDictionary();
        ad.put(PdfName.COLORSPACE, colorspace);
        img.setAdditional(ad);
        return img;
    }
View Full Code Here

                for (int m=0; m<padding; m++) {
                    inputStream.read();
                }
            }
        }
        return new ImgRaw(width, height, 3, 8, bdata);
    }
View Full Code Here

            case VERSION_2_24_BIT:
                // no compression
                bdata = new byte[width * height * 3];
                read24Bit(bdata);
                return new ImgRaw(width, height, 3, 8, bdata);

            case VERSION_3_1_BIT:
                // 1-bit images cannot be compressed.
                return read1Bit(4);

            case VERSION_3_4_BIT:
                switch((int)compression) {
                    case BI_RGB:
                        return read4Bit(4);

                    case BI_RLE4:
                        return readRLE4();

                    default:
                        throw new
                        RuntimeException("Invalid compression specified for BMP file.");
                }

            case VERSION_3_8_BIT:
                switch((int)compression) {
                    case BI_RGB:
                        return read8Bit(4);

                    case BI_RLE8:
                        return readRLE8();

                    default:
                        throw new
                        RuntimeException("Invalid compression specified for BMP file.");
                }

            case VERSION_3_24_BIT:
                // 24-bit images are not compressed
                bdata = new byte[width * height * 3];
                read24Bit(bdata);
                return new ImgRaw(width, height, 3, 8, bdata);

            case VERSION_3_NT_16_BIT:
                return read1632Bit(false);

            case VERSION_3_NT_32_BIT:
                return read1632Bit(true);

            case VERSION_4_1_BIT:
                return read1Bit(4);

            case VERSION_4_4_BIT:
                switch((int)compression) {

                    case BI_RGB:
                        return read4Bit(4);

                    case BI_RLE4:
                        return readRLE4();

                    default:
                        throw new
                        RuntimeException("Invalid compression specified for BMP file.");
                }

            case VERSION_4_8_BIT:
                switch((int)compression) {

                    case BI_RGB:
                        return read8Bit(4);

                    case BI_RLE8:
                        return readRLE8();

                    default:
                        throw new
                        RuntimeException("Invalid compression specified for BMP file.");
                }

            case VERSION_4_16_BIT:
                return read1632Bit(false);

            case VERSION_4_24_BIT:
                bdata = new byte[width * height * 3];
                read24Bit(bdata);
                return new ImgRaw(width, height, 3, 8, bdata);

            case VERSION_4_32_BIT:
                return read1632Bit(true);
        }
        return null;
View Full Code Here

        }
        return null;
    }

    private Image indexedModel(byte bdata[], int bpc, int paletteEntries) throws BadElementException {
        Image img = new ImgRaw(width, height, 1, bpc, bdata);
        PdfArray colorspace = new PdfArray();
        colorspace.add(PdfName.INDEXED);
        colorspace.add(PdfName.DEVICERGB);
        byte np[] = getPalette(paletteEntries);
        int len = np.length;
        colorspace.add(new PdfNumber(len / 3 - 1));
        colorspace.add(new PdfString(np));
        PdfDictionary ad = new PdfDictionary();
        ad.put(PdfName.COLORSPACE, colorspace);
        img.setAdditional(ad);
        return img;
    }
View Full Code Here

                for (int m=0; m<padding; m++) {
                    inputStream.read();
                }
            }
        }
        return new ImgRaw(width, height, 3, 8, bdata);
    }
View Full Code Here

        if (!skipZero)
            skip();

        Image img = null;
        try {
            img = new ImgRaw(iw, ih, 1, m_bpc, m_out);
            PdfArray colorspace = new PdfArray();
            colorspace.add(PdfName.INDEXED);
            colorspace.add(PdfName.DEVICERGB);
            int len = m_curr_table.length;
            colorspace.add(new PdfNumber(len / 3 - 1));
View Full Code Here

                    img = Image.getInstance(w, h, false, Image.CCITTG4,
                        photometric == TIFFConstants.PHOTOMETRIC_MINISBLACK ? Image.CCITT_BLACKIS1 : 0, g4.close());
                }
                else {
                    zip.close();
                    img = new ImgRaw(w, h, samplePerPixel - extraSamples, bitsPerSample, stream.toByteArray());
                    img.setDeflated(true);
                }
            }
            img.setDpi(dpiX, dpiY);
            if (compression != TIFFConstants.COMPRESSION_OJPEG && compression != TIFFConstants.COMPRESSION_JPEG) {
View Full Code Here

            if (bpc == 16)
                bpc = 8;
            Image img;
            if (image != null) {
                if (colorType == 3)
                    img = new ImgRaw(width, height, components, bpc, image);
                else
                    img = Image.getInstance(width, height, components, bpc, image);
            }
            else {
                img = new ImgRaw(width, height, components, bpc, idat.toByteArray());
                img.setDeflated(true);
                PdfDictionary decodeparms = new PdfDictionary();
                decodeparms.put(PdfName.BITSPERCOMPONENT, new PdfNumber(bitDepth));
                decodeparms.put(PdfName.PREDICTOR, new PdfNumber(15));
                decodeparms.put(PdfName.COLUMNS, new PdfNumber(width));
View Full Code Here

TOP

Related Classes of com.itextpdf.text.ImgRaw

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.