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

Method main

examples/bitmap/src/RenderToBitmap.java:6–30  ·  view source on GitHub ↗
(String [] args)

Source from the content-addressed store, hash-verified

4
5public class RenderToBitmap {
6 public static void main(String [] args) throws Exception {
7 var surface = Surface.makeRasterN32Premul(640, 360);
8 var canvas = surface.getCanvas();
9
10 canvas.clear(0xFFFFFFFF);
11
12 canvas.drawTriangles(new Point[] {
13 new Point(320, 70),
14 new Point(194, 287),
15 new Point(446, 287)
16 },
17 new int[] { 0xFFFF0000, 0xFF00FF00, 0xFF0000FF },
18 new Paint());
19
20 Path path = new Path().moveTo(253, 216)
21 .cubicTo(283, 163.5f, 358, 163.5f, 388, 216)
22 .cubicTo(358, 268.5f, 283, 268.5f, 253, 216)
23 .closePath();
24 canvas.drawPath(path, new Paint().setColor(0xFFFFFFFF));
25
26 canvas.drawCircle(320, 217, 16, new Paint().setColor(0xFF000000));
27
28 byte[] pngBytes = surface.makeImageSnapshot().encodeToData().getBytes();
29 java.nio.file.Files.write(java.nio.file.Path.of("output.png"), pngBytes);
30 }
31}

Callers

nothing calls this directly

Calls 14

makeRasterN32PremulMethod · 0.95
getCanvasMethod · 0.80
clearMethod · 0.80
drawTrianglesMethod · 0.80
closePathMethod · 0.80
cubicToMethod · 0.80
moveToMethod · 0.80
drawCircleMethod · 0.80
getBytesMethod · 0.80
encodeToDataMethod · 0.80
makeImageSnapshotMethod · 0.80
writeMethod · 0.80

Tested by

no test coverage detected