List of usage examples for com.itextpdf.text.pdf.qrcode ByteMatrix getHeight
public int getHeight()
From source file:com.mui.certificate.core.HalalCertification.java
License:Apache License
private BufferedImage convertToImage(ByteMatrix matrix, int scale) { BufferedImage buffImage = new BufferedImage(matrix.getHeight() * scale, matrix.getWidth() * scale, BufferedImage.TYPE_INT_ARGB); for (int i = 0; i < matrix.getHeight(); ++i) { for (int j = 0; j < matrix.getWidth(); ++j) { for (int iscale = 0; iscale < scale; ++iscale) { for (int jscale = 0; jscale < scale; ++jscale) { buffImage.setRGB(j * scale + jscale, i * scale + iscale, matrix.get(j, i) == 0 ? WHITE : BLACK); }//from ww w .j a v a 2 s . c om } } } return buffImage; }
From source file:com.mui.halal.experiment.MatrixToImageWriter.java
License:Apache License
/** * Renders a {@link ByteMatrix} as an image, as a * {@link BufferedImage}. The byte values are construed as (unsigned) * luminance values, in theory.//from w w w .ja v a 2 s .c o m * However, anything but 0 will be rendered as white, and 0 will be * rendered as black. */ public static BufferedImage toBufferedImage(ByteMatrix matrix) { int width = matrix.getWidth(); int height = matrix.getHeight(); BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { image.setRGB(x, y, matrix.get(x, y) == 0 ? WHITE : BLACK); } } return image; }