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

Method base

tests/java/ImageTest.java:21–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19 }
20
21 public void base() throws Exception {
22 try (var surface = Surface.makeRaster(ImageInfo.makeN32Premul(100, 100));
23 var paint = new Paint().setColor(0xFFFF0000);
24 var path = new PathBuilder().moveTo(20, 80).lineTo(50, 20).lineTo(80, 80).closePath().build();)
25 {
26 var canvas = surface.getCanvas();
27 canvas.drawPath(path, paint);
28 try (var image = surface.makeImageSnapshot()) {
29 var dir = "target/tests/ImageTest/";
30 new File(dir).mkdirs();
31 Files.write(Path.of(dir, "polygon_default.png"), EncoderPNG.encode(image).getBytes());
32 Files.write(Path.of(dir, "polygon_default_none_1.png"), EncoderPNG.encode(image, EncodePNGOptions.DEFAULT.withFlags(EncodePNGFilterFlag.NONE).withZlibLevel(1)).getBytes());
33 Files.write(Path.of(dir, "polygon_jpeg_default.jpeg"), EncoderJPEG.encode(image).getBytes());
34 Files.write(Path.of(dir, "polygon_jpeg_50.jpeg"), EncoderJPEG.encode(image, EncodeJPEGOptions.DEFAULT.withQuality(50)).getBytes());
35 Files.write(Path.of(dir, "polygon_webp_default.webp"), EncoderWEBP.encode(image).getBytes());
36 Files.write(Path.of(dir, "polygon_webp_50.webp"), EncoderWEBP.encode(image,EncodeWEBPOptions.DEFAULT.withQuality(50)).getBytes());
37 Files.write(Path.of(dir, "polygon_webp_lossless.webp"), EncoderWEBP.encode(image,EncodeWEBPOptions.DEFAULT.withCompressionMode(EncodeWEBPCompressionMode.LOSSLESS)).getBytes());
38 }
39 }
40 }
41
42 public void makeSubset() throws Exception {
43 try (var surface = Surface.makeRaster(ImageInfo.makeN32Premul(100, 80))) {

Callers

nothing calls this directly

Calls 15

makeRasterMethod · 0.95
makeN32PremulMethod · 0.95
encodeMethod · 0.95
encodeMethod · 0.95
encodeMethod · 0.95
closePathMethod · 0.80
lineToMethod · 0.80
moveToMethod · 0.80
getCanvasMethod · 0.80
makeImageSnapshotMethod · 0.80
writeMethod · 0.80
getBytesMethod · 0.80

Tested by

no test coverage detected