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

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

Introduction

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

Prototype

public boolean get(int x, int y) 

Source Link

Document

Gets the requested bit, where true means black.

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.
 *//*  w  w w.  j a  v a2  s.com*/
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;
}