(String content, int size, int margin)
| 32 | } |
| 33 | |
| 34 | private static BitMatrix encode(String content, int size, int margin) throws Exception { |
| 35 | Map<EncodeHintType, Object> hints = new EnumMap<>(EncodeHintType.class); |
| 36 | hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); |
| 37 | hints.put(EncodeHintType.MARGIN, margin); |
| 38 | return new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, ResUtil.dp2px(size), ResUtil.dp2px(size), hints); |
| 39 | } |
| 40 | |
| 41 | private static int detectQuietZone(BitMatrix matrix) { |
| 42 | for (int y = 0; y < matrix.getHeight(); y++) for (int x = 0; x < matrix.getWidth(); x++) if (matrix.get(x, y)) return Math.min(x, y); |
no test coverage detected