()
| 13 | |
| 14 | public class ImageTest implements Executable { |
| 15 | @Override |
| 16 | public void execute() throws Exception { |
| 17 | try (var surface = Surface.makeRasterN32Premul(100, 100); |
| 18 | var paint = new Paint().setColor(0xFFFF0000); |
| 19 | var path = new Path().moveTo(20, 80).lineTo(50, 20).lineTo(80, 80).closePath();) |
| 20 | { |
| 21 | var canvas = surface.getCanvas(); |
| 22 | canvas.drawPath(path, paint); |
| 23 | try (var image = surface.makeImageSnapshot()) { |
| 24 | new File("target/tests/ImageTest/").mkdirs(); |
| 25 | Files.write(java.nio.file.Path.of("target/tests/ImageTest/polygon_default.png"), image.encodeToData().getBytes()); |
| 26 | Files.write(java.nio.file.Path.of("target/tests/ImageTest/polygon_jpeg_default.jpeg"), image.encodeToData(EncodedImageFormat.JPEG).getBytes()); |
| 27 | Files.write(java.nio.file.Path.of("target/tests/ImageTest/polygon_jpeg_50.jpeg"), image.encodeToData(EncodedImageFormat.JPEG, 50).getBytes()); |
| 28 | Files.write(java.nio.file.Path.of("target/tests/ImageTest/polygon_webp_default.webp"), image.encodeToData(EncodedImageFormat.WEBP).getBytes()); |
| 29 | Files.write(java.nio.file.Path.of("target/tests/ImageTest/polygon_webp_50.webp"), image.encodeToData(EncodedImageFormat.WEBP, 50).getBytes()); |
| 30 | // Files.write(java.nio.file.Path.of("target/tests/ImageTest/polygon_heif_default.heif"), image.encodeToData(EncodedImageFormat.HEIF).getBytes()); |
| 31 | // Files.write(java.nio.file.Path.of("target/tests/ImageTest/polygon_heif_50.heif"), image.encodeToData(EncodedImageFormat.HEIF, 50).getBytes()); |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | } |
nothing calls this directly
no test coverage detected