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

Method paintImpl

examples/dashboard/java/PanelTheme.java:22–64  ·  view source on GitHub ↗
(Canvas canvas, int width, int height, float scale)

Source from the content-addressed store, hash-verified

20 }
21
22 @Override
23 public void paintImpl(Canvas canvas, int width, int height, float scale) {
24 try (var paint = new Paint()) {
25 // sRGB row
26 paint.setColor(0xFFFFFFFF);
27 canvas.drawString("sRGB", Example.PADDING, Example.PADDING * 2, Example.FONT12, paint);
28 float x = width / 2 + Example.PADDING / 2;
29 Color4f[] colors = {
30 new Color4f(1, 0, 0, 1), // red
31 new Color4f(0, 1, 0, 1), // green
32 new Color4f(0, 0, 1, 1), // blue
33 new Color4f(1, 1, 0, 1), // yellow
34 new Color4f(1, 0, 1, 1), // magenta
35 new Color4f(0, 1, 1, 1) // cyan
36 };
37 for (int i = 0; i < colors.length; i++) {
38 paint.setColor4f(colors[i], ColorSpace.getSRGB());
39 canvas.drawRect(Rect.makeXYWH(x + i * Example.PADDING * 2, Example.PADDING * 0.5f, Example.PADDING * 2, Example.PADDING * 2), paint);
40 }
41
42 // Display P3 row
43 paint.setColor(0xFFFFFFFF);
44 canvas.drawString("Display P3", Example.PADDING, Example.PADDING * 4, Example.FONT12, paint);
45 x = width / 2 + Example.PADDING / 2;
46 for (int i = 0; i < colors.length; i++) {
47 paint.setColor4f(colors[i], ColorSpace.getDisplayP3());
48 canvas.drawRect(Rect.makeXYWH(x + i * Example.PADDING * 2, Example.PADDING * 2.5f, Example.PADDING * 2, Example.PADDING * 2), paint);
49 }
50
51 paint.setColor(0xFFFFFFFF);
52 canvas.drawString("isHighContrast", Example.PADDING, Example.PADDING * 6, Example.FONT12, paint);
53 canvas.drawString("" + Theme.isHighContrast(), width / 2 + Example.PADDING / 2, Example.PADDING * 6, Example.FONT12, paint);
54
55 canvas.drawString("isDark", Example.PADDING, Example.PADDING * 8, Example.FONT12, paint);
56 canvas.drawString("" + Theme.isDark(), width / 2 + Example.PADDING / 2, Example.PADDING * 8, Example.FONT12, paint);
57
58 canvas.drawString("isInverted", Example.PADDING, Example.PADDING * 10, Example.FONT12, paint);
59 canvas.drawString("" + Theme.isInverted(), width / 2 + Example.PADDING / 2, Example.PADDING * 10, Example.FONT12, paint);
60
61 canvas.drawString("zOrder", Example.PADDING, Example.PADDING * 12, Example.FONT12, paint);
62 canvas.drawString("" + window.getZOrder(), width / 2 + Example.PADDING / 2, Example.PADDING * 12, Example.FONT12, paint);
63 }
64 }
65}

Callers

nothing calls this directly

Calls 6

isHighContrastMethod · 0.95
isDarkMethod · 0.95
isInvertedMethod · 0.95
drawRectMethod · 0.80
makeXYWHMethod · 0.80
getZOrderMethod · 0.45

Tested by

no test coverage detected