Class ScreenshotHelper
java.lang.Object
dev.engine.graphics.ScreenshotHelper
Saves RGBA8 framebuffer data as PNG. Backend-agnostic.
-
Method Summary
Modifier and TypeMethodDescriptionstatic doublediffPercentage(byte[] a, byte[] b, int threshold) Returns the percentage of pixels that differ by more than the given threshold.static intmaxDifference(byte[] a, byte[] b) Compares two RGBA8 framebuffers pixel-by-pixel.static voidSaves RGBA8 byte array as a PNG file.
-
Method Details
-
save
Saves RGBA8 byte array as a PNG file. Alpha is forced to opaque.- Throws:
IOException
-
maxDifference
public static int maxDifference(byte[] a, byte[] b) Compares two RGBA8 framebuffers pixel-by-pixel. Returns the maximum per-channel difference across all pixels. -
diffPercentage
public static double diffPercentage(byte[] a, byte[] b, int threshold) Returns the percentage of pixels that differ by more than the given threshold.
-