/** Gets an <CODE>Image</CODE> with the barcode. A successful call to the method <CODE>generate()</CODE> * before calling this method is required. * @return the barcode <CODE>Image</CODE> * @throws BadElementException on error */ public Image createImage() throws BadElementException { if (image == null) return null; byte g4[] = CCITTG4Encoder.compress(image, width + 2 * ws, height + 2 * ws); return Image.getInstance(width + 2 * ws, height + 2 * ws, false, Image.CCITTG4, 0, g4, null); }
/** * Gets an <CODE>Image</CODE> with the barcode. * * @return the barcode <CODE>Image</CODE> * @throws BadElementException on error */ public Image getImage() throws BadElementException { byte[] b = getBitMatrix(); byte g4[] = CCITTG4Encoder.compress(b, bm.getWidth(), bm.getHeight()); return Image.getInstance(bm.getWidth(), bm.getHeight(), false, Image.CCITTG4, Image.CCITT_BLACKIS1, g4, null); }
/** * Gets an instance of an Image in raw mode. * * @param width * the width of the image in pixels * @param height * the height of the image in pixels * @param components * 1,3 or 4 for GrayScale, RGB and CMYK * @param data * the image data * @param bpc * bits per component * @param transparency * transparency information in the Mask format of the image * dictionary * @return an object of type <CODE>ImgRaw</CODE> * @throws BadElementException * on error */ public static Image getInstance(int width, int height, int components, int bpc, byte data[], int transparency[]) throws BadElementException { if (transparency != null && transparency.length != components * 2) throw new BadElementException( "Transparency length must be equal to (componentes * 2)"); if (components == 1 && bpc == 1) { byte g4[] = CCITTG4Encoder.compress(data, width, height); return Image.getInstance(width, height, false, Image.CCITTG4, Image.CCITT_BLACKIS1, g4, transparency); } Image img = new ImgRaw(width, height, components, bpc, data); img.transparency = transparency; return img; }
/** Gets an <CODE>Image</CODE> with the barcode. The image will have to be * scaled in the Y direction by <CODE>yHeight</CODE>for the barcode * to have the right printing aspect. * @return the barcode <CODE>Image</CODE> * @throws BadElementException on error */ public Image getImage() throws BadElementException { paintCode(); byte g4[] = CCITTG4Encoder.compress(outBits, bitColumns, codeRows); return Image.getInstance(bitColumns, codeRows, false, Image.CCITTG4, (options & PDF417_INVERT_BITMAP) == 0 ? 0 : Image.CCITT_BLACKIS1, g4, null); }