Add aspect-preserving opaque image fitting

This commit is contained in:
2026-11-07 17:12:00 +01:00
parent bb90b2c060
commit 2620a17c64
3 changed files with 76 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
# Opaque image fitting
`ImageScaler.fitOpaque(source, maxWidth, maxHeight, background)` returns an
independent RGB BufferedImage. It fits within positive bounds without enlargement,
keeps aspect ratio to the nearest pixel (minimum one pixel per dimension), and
composites transparent pixels onto the supplied opaque AWT Color. Bilinear
interpolation is used. The source is unchanged and graphics resources are released.
This operation is independent of file format and wire encoding. Callers own image
decoding, any source subsampling, and target quantization. Existing PNG scaling
methods retain their original behavior.
`ImageScalerTest` verifies fitting, no enlargement, transparent/partial-alpha
composition, narrow images, source preservation, and invalid bounds.