package com.ffii.core.utils

import com.google.zxing.BarcodeFormat
import java.awt.image.BufferedImage
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;

open class QrCodeUtil {
    companion object {
        fun generateQRCodeImage(barcodeText: String?): BufferedImage {
            val barcodeWriter = QRCodeWriter()
            val bitMatrix: BitMatrix = barcodeWriter.encode(barcodeText, BarcodeFormat.QR_CODE, 250, 250)
            val img: BufferedImage = MatrixToImageWriter.toBufferedImage(bitMatrix)
            return img
        }
    }
}