MCPcopy Create free account
hub / github.com/HumbleUI/JWM / paintImpl

Method paintImpl

examples/dashboard/java/PanelTouch.java:41–61  ·  view source on GitHub ↗
(Canvas canvas, int width, int height, float scale)

Source from the content-addressed store, hash-verified

39 }
40
41 @Override
42 public void paintImpl(Canvas canvas, int width, int height, float scale) {
43 if (touches.isEmpty()) return;
44
45 var capHeight = Example.FONT12.getMetrics().getCapHeight();
46 var padding = (int) 8 * scale;
47
48 try (var bg = new Paint().setColor(0x40FFFFFF);
49 var fg = new Paint().setColor(0xFF000000)) {
50 for (var touch : touches.entrySet()) {
51 final int id = touch.getKey();
52 final Point pos = touch.getValue();
53 final float x = pos.getX() * width;
54 final float y = pos.getY() * height;
55 canvas.drawCircle(x, y, radius, bg);
56 try (var line = TextLine.make(String.valueOf(id), Example.FONT12)) {
57 canvas.drawTextLine(line, x - line.getWidth()/2, y + capHeight/2, fg);
58 }
59 }
60 }
61 }
62}

Callers

nothing calls this directly

Calls 2

makeMethod · 0.80
getWidthMethod · 0.65

Tested by

no test coverage detected