我正在尝试使用 Google 的 Java zxing 库编写彩色二维码。它适用于此示例,它似乎使用了 ARGB 颜色。
不幸的是,我必须在我的应用程序中使用 HTML/Hex 值作为颜色,所以我试图弄清楚如何构建或转换它。
我已经构建了一个 RGB 颜色并使用 alpha 值作为其前缀。但是,虽然 RGB 值可能高达 255 - 3 位,但 MatrixToImageWriter 中的参数似乎只适用于 8 位。这意味着每种颜色只有两位数。
这个“MatrixToImageConfig(-10223615,-1)”有什么样的价值?有人可以向我解释那些颜色值或给我一个如何计算 HTML 的例子吗?
谢谢你!
QRCodeWriter qrCodeWriter = new QRCodeWriter();
BitMatrix bitMatrix = qrCodeWriter.encode(createQRCodeContent, BarcodeFormat.QR_CODE, createQRCodeSize, createQRCodeSize);
// Color
MatrixToImageConfig conf = new MatrixToImageConfig(-10223615,-1);
BufferedImage qrcode = MatrixToImageWriter.toBufferedImage(bitMatrix, conf);
File qrfile = new File (targetPath);
ImageIO.write(qrcode, "png", qrfile);
德玛西亚99
相关分类