MCPcopy Create free account
hub / github.com/FongMi/TV / getBitmap

Method getBitmap

app/src/leanback/java/com/fongmi/android/tv/utils/QRCode.java:21–32  ·  view source on GitHub ↗
(String content, int size, int margin)

Source from the content-addressed store, hash-verified

19 private static final float MODULE_RADIUS_RATIO = 0.45f;
20
21 public static Bitmap getBitmap(String content, int size, int margin) {
22 try {
23 int foreground = Color.WHITE;
24 int finderBackground = Color.BLACK;
25 BitMatrix matrix = encode(content, size, margin);
26 int quietZone = detectQuietZone(matrix);
27 int finderSize = detectFinderPx(matrix, quietZone);
28 return render(matrix, foreground, finderBackground, quietZone, finderSize);
29 } catch (Exception e) {
30 return null;
31 }
32 }
33
34 private static BitMatrix encode(String content, int size, int margin) throws Exception {
35 Map<EncodeHintType, Object> hints = new EnumMap<>(EncodeHintType.class);

Callers 5

initViewMethod · 0.95
initViewMethod · 0.95
initViewMethod · 0.95
initViewMethod · 0.95
initViewMethod · 0.95

Calls 4

encodeMethod · 0.95
detectQuietZoneMethod · 0.95
detectFinderPxMethod · 0.95
renderMethod · 0.95

Tested by

no test coverage detected