package dev.photosync.core.thumbnail;

/**
 * A tiny decoded bitmap -- at most 32x32 -- in 0xAARRGGBB order.
 *
 * <p>Deliberately not a Minecraft {@code NativeImage}: this module has no
 * graphics dependencies, and the version adapters are the ones that know how to
 * turn a pixel array into a texture on their Minecraft version.
 */
public record ThumbImage(int width, int height, int[] argb) {

    public ThumbImage {
        argb = argb.clone();
    }

    public int pixel(int x, int y) {
        return argb[y * width + x];
    }

    /** A defensive copy, because callers hand this straight to native buffers. */
    @Override
    public int[] argb() {
        return argb.clone();
    }
}
