MCPcopy Create free account
hub / github.com/HumbleUI/Skija / draw

Method draw

examples/scenes/src/FontVariationsScene.java:28–54  ·  view source on GitHub ↗
(Canvas canvas, int windowWidth, int windowHeight, float dpi, int xpos, int ypos)

Source from the content-addressed store, hash-verified

26 }
27
28 @Override
29 public void draw(Canvas canvas, int windowWidth, int windowHeight, float dpi, int xpos, int ypos) {
30 canvas.translate(24, 24);
31
32 try (var fill = new Paint().setColor(0xFFCC3333);) {
33 FontVariationAxis[] axes = _interV.getVariationAxes();
34
35 canvas.save();
36 var font = fontCache.computeIfAbsent(null, v -> new Font(_interV, 16));
37 drawLine(canvas, font, 0xFF000000);
38 canvas.restore();
39 canvas.translate((windowWidth - 48) / (axes.length + 1), 0);
40
41 for (var axis: axes) {
42 canvas.save();
43 for (int percent = 0; percent <= 100; percent += 5) {
44 var value = axis.getMinValue() + (axis.getMaxValue() - axis.getMinValue()) * percent / 100f;
45 var variation = new FontVariation(axis.getTag(), value);
46
47 font = fontCache.computeIfAbsent(variation, v -> new Font(_interV.makeClone(v), 16));
48 drawLine(canvas, font, Color.makeLerp(0xFFf72585, 0xFF4361ee, percent / 100f));
49 }
50 canvas.restore();
51 canvas.translate((windowWidth - 48) / (axes.length + 1), 0);
52 }
53 }
54 }
55}

Callers

nothing calls this directly

Calls 9

drawLineMethod · 0.95
makeLerpMethod · 0.95
getVariationAxesMethod · 0.80
saveMethod · 0.80
restoreMethod · 0.80
translateMethod · 0.45
setColorMethod · 0.45
getTagMethod · 0.45
makeCloneMethod · 0.45

Tested by

no test coverage detected