I've been working on generating QR code and showing it on the screen. Now I'm able to generate it using Zxing library that gives me a BitMatrix that returns a boolean on x and y values that if that coordinate needs to be black or white. Now I'm able to successfully generate and show the QR code using the code below:
String charset = "UTF-8";
Map<EncodeHintType, ErrorCorrectionLevel> hintMap = new HashMap<>();
hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
BitMatrix matrix = new QRCodeWriter().encode(new String(url.getBytes(charset), charset), BarcodeFormat.QR_CODE, (int) context.getResources().getDimension(R.dimen.qr_square), (int) context.getResources().getDimension(R.dimen.qr_square), hintMap);
Bitmap bitmap = Bitmap.createBitmap(matrix.getWidth(), matrix.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();
paint.setColor(Color.BLACK);
for (int y = 0; y < matrix.getHeight(); y++) {
for (int x = 0; x < matrix.getWidth(); x++) {
if (!overlayRect.contains(x, y))
canvas.drawPoint(x, y, paint);
}
}
qrImageView.setImageBitmap(bitmap);
But now the designer wants the entire QR code to have rounded corners. I tried a few things but haven't been able to successfully generate a rounded corners QR code. Any help will be highly appreciated. TIA