Package com.lowagie.text

Examples of com.lowagie.text.LwgImage


        }
        return null;
    }
   
    private LwgImage indexedModel(byte bdata[], int bpc, int paletteEntries) throws BadElementException {
        LwgImage 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


            }
            else
            {
               PdfName name;
               PageResources prs = getPageResources();
               LwgImage maskImage = image.getImageMask();
               if (maskImage != null)
               {
                  name = writer.addDirectImageSimple(maskImage);
                  prs.addXObject(name, writer.getImageReference(name));
               }
View Full Code Here

            template.showText(text);
            template.endText();
            template.setWidth(width);
            template.setHeight(size + 2);
            // make an LwgImage object from the template
            LwgImage img = LwgImage.getInstance(template);
            img.setRotationDegrees(90);
            LwgPdfPTable table = new LwgPdfPTable(3);
            table.setWidthPercentage(100);
            table.getDefaultCell().setHorizontalAlignment(LwgElement.ALIGN_CENTER);
            table.getDefaultCell().setVerticalAlignment(LwgElement.ALIGN_MIDDLE);
            LwgPdfPCell cell = new LwgPdfPCell(img);
View Full Code Here

     */   
    public static LwgImage getImage(URL url) throws IOException {
        InputStream is = null;
        try {
            is = url.openStream();
            LwgImage img = getImage(is);
            img.setUrl(url);
            return img;
        }
        finally {
            if (is != null) {
                is.close();
View Full Code Here

     * @throws IOException on error
     * @return the image
     */   
    public static LwgImage getImage(byte data[]) throws IOException {
        ByteArrayInputStream is = new ByteArrayInputStream(data);
        LwgImage img = getImage(is);
        img.setOriginalData(data);
        return img;
    }
View Full Code Here

            if ((colorType & 4) != 0)
                --components;
            int bpc = bitDepth;
            if (bpc == 16)
                bpc = 8;
            LwgImage img;
            if (image != null) {
                if (colorType == 3)
                    img = new ImgRaw(width, height, components, bpc, image);
                else
                    img = LwgImage.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));
                decodeparms.put(PdfName.COLORS, new PdfNumber((colorType == 3 || (colorType & 2) == 0) ? 1 : 3));
                additional.put(PdfName.DECODEPARMS, decodeparms);
            }
            if (additional.get(PdfName.COLORSPACE) == null)
                additional.put(PdfName.COLORSPACE, getColorspace());
            if (intent != null)
                additional.put(PdfName.INTENT, intent);
            if (additional.size() > 0)
                img.setAdditional(additional);
            if (icc_profile != null)
                img.tagICC(icc_profile);
            if (palShades) {
                LwgImage im2 = LwgImage.getInstance(width, height, 1, 8, smask);
                im2.makeMask();
                img.setImageMask(im2);
            }
            if (genBWMask) {
                LwgImage im2 = LwgImage.getInstance(width, height, 1, 1, smask);
                im2.makeMask();
                img.setImageMask(im2);
            }
            img.setDpi(dpiX, dpiY);
            img.setXYRatio(XYRatio);
            img.setOriginalType(LwgImage.ORIGINAL_PNG);
View Full Code Here

TOP

Related Classes of com.lowagie.text.LwgImage

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.