MCPcopy Create free account
hub / github.com/JetBrains/skija / BitmapScene

Method BitmapScene

examples/scenes/src/BitmapScene.java:9–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7 private List<Pair<Path, Integer>> shapes = new ArrayList<>(100);
8
9 public BitmapScene() {
10 var random = new Random(0);
11 for (int i = 0; i < 100; ++i) {
12 var path = new Path();
13
14 switch (random.nextInt(4)) {
15 case 0:
16 path.addRect(Rect.makeXYWH(-0.5f, -0.5f, 1, 1));
17 break;
18 case 1:
19 path.addCircle(0, 0, 0.5f);
20 break;
21 case 2:
22 path.moveTo(0, -0.5f).lineTo(0.5f, 0.36f).lineTo(-0.5f, 0.36f).closePath();
23 break;
24 case 3:
25 path.addRRect(RRect.makeXYWH(-0.6f, -0.4f, 1.2f, 0.8f, 0.4f));
26 break;
27 }
28
29 path.transform(Matrix33.makeRotate(random.nextInt(360)));
30 path.transform(Matrix33.makeScale(10 + random.nextInt(250)));
31 path.transform(Matrix33.makeTranslate(random.nextInt(1920), random.nextInt(1080)));
32
33 int color = 0xFF000000 | random.nextInt(0xFFFFFF);
34
35 shapes.add(new Pair<>(path, color));
36 }
37 }
38
39 private void drawGray(Canvas canvas, IRect target, float dpi) {
40 try (Bitmap bitmap = new Bitmap();) {

Callers

nothing calls this directly

Calls 12

addRectMethod · 0.95
makeXYWHMethod · 0.95
addCircleMethod · 0.95
moveToMethod · 0.95
addRRectMethod · 0.95
makeXYWHMethod · 0.95
transformMethod · 0.95
makeRotateMethod · 0.95
makeScaleMethod · 0.95
makeTranslateMethod · 0.95
closePathMethod · 0.80
lineToMethod · 0.80

Tested by

no test coverage detected