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

Method paint

examples/empty/java/Example.java:29–41  ·  view source on GitHub ↗
(Canvas canvas, int width, int height)

Source from the content-addressed store, hash-verified

27 }
28
29 public void paint(Canvas canvas, int width, int height) {
30 float scale = window.getScreen().getScale();
31 canvas.clear(0xFF264653);
32 try (var paint = new Paint()) {
33 paint.setColor(0xFFe76f51);
34
35 canvas.drawRect(Rect.makeXYWH(10 * scale, 10 * scale, 10 * scale, 10 * scale), paint);
36 canvas.drawRect(Rect.makeXYWH(width - 20 * scale, 10 * scale, 10 * scale, 10 * scale), paint);
37 canvas.drawRect(Rect.makeXYWH(10 * scale, height - 20 * scale, 10 * scale, 10 * scale), paint);
38 canvas.drawRect(Rect.makeXYWH(width - 20 * scale, height - 20 * scale, 10 * scale, 10 * scale), paint);
39 canvas.drawRect(Rect.makeXYWH(width / 2 - 5 * scale, height / 2 - 5 * scale, 10 * scale, 10 * scale), paint);
40 }
41 }
42
43 @Override
44 public void accept(Event e) {

Callers 1

acceptMethod · 0.95

Calls 5

drawRectMethod · 0.80
makeXYWHMethod · 0.80
getScaleMethod · 0.45
getScreenMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected