Example usage for com.itextpdf.text.pdf.qrcode BitMatrix getHeight

List of usage examples for com.itextpdf.text.pdf.qrcode BitMatrix getHeight

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf.qrcode BitMatrix getHeight.

Prototype

public int getHeight() 

Source Link

Usage

From source file:com.mui.halal.experiment.MatrixToImageWriter.java

License:Apache License

/**
 * Renders a {@link BitMatrix} as an image, where "false" bits are rendered
 * as white, and "true" bits are rendered as black.
 *//*from ww  w  . ja  v  a  2  s .c  om*/
public static BufferedImage toBufferedImage(BitMatrix 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) ? BLACK : WHITE);
        }
    }
    return image;
}