MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / get

Method get

src/plugins/system/android/com/foxdebug/system/Ui.java:40–70  ·  view source on GitHub ↗
(
      Context context,
      String code,
      int size,
      int color
    )

Source from the content-addressed store, hash-verified

38 private static final String FONT_PATH = "font/icon.ttf";
39
40 public static Bitmap get(
41 Context context,
42 String code,
43 int size,
44 int color
45 ) {
46 if (paint == null) {
47 paint = new Paint();
48 paint.setAntiAlias(true);
49 paint.setTypeface(
50 Typeface.createFromAsset(context.getAssets(), FONT_PATH)
51 );
52 paint.setTextAlign(Paint.Align.CENTER);
53 }
54
55 paint.setTextSize(size);
56 paint.setColor(color);
57
58 float baseline = -paint.ascent();
59 int width = (int) paint.measureText(code, 0, code.length());
60 int height = (int) (baseline + paint.descent());
61 Bitmap bitmap = Bitmap.createBitmap(
62 width,
63 height,
64 Bitmap.Config.ARGB_8888
65 );
66 Canvas canvas = new Canvas(bitmap);
67
68 canvas.drawText(code, width / 2, baseline, paint);
69 return bitmap;
70 }
71
72 public static Bitmap get(
73 Context context,

Callers 15

QuickToolsFunction · 0.45
fontManager.jsFile · 0.45
PluginIncludeFunction · 0.45
customTheme.jsFile · 0.45
plugins.jsFile · 0.45
renderFunction · 0.45
getInstalledPluginsFunction · 0.45
onInstallFunction · 0.45
onUninstallFunction · 0.45
onToggleEnabledFunction · 0.45
renderAppThemesFunction · 0.45

Calls 1

setColorMethod · 0.80

Tested by

no test coverage detected