Skip to content

Fix/indexed colorspace smask luminance and other fixes - #3

Merged
sandeepkrs merged 6 commits into
masterfrom
fix/indexed-colorspace-smask-luminance
Oct 3, 2026
Merged

sandeepkrs merged 6 commits into
masterfrom
fix/indexed-colorspace-smask-luminance

Conversation

@sandeepkrs

Copy link
Copy Markdown
Owner

No description provided.

…-component color space fallbacks

- PDImageXObject: pass interpolate directly to Bitmap.createScaledBitmap instead of inverting it
- PDImageXObject: guard applyMask against null image to prevent NullPointerException
- PDImageXObject: pass parent resources to getMask() and getSoftMask() instead of null
- PDImageXObject: expose getResources() getter
- PDColorSpace: fall back CALGRAY and SEPARATION to PDDeviceGray (1 component) instead of PDDeviceRGB (3 components) to prevent 3x vertical squashing and color noise
- Add PDColorSpaceTest and PDImageXObjectTest unit test suites
- SampledImageReader: guard JPEG fast-path with region == null, colorKey == null, and default decode check to prevent bypassing clipping, chroma masking, or decode arrays
- SampledImageReader: validate dimensions and stream length in createBitmapFromRawStream, throwing descriptive IOException on truncated/empty streams or unsupported component counts
- PDFBoxResourceLoader: throw descriptive IOException instead of throwing NullPointerException when uninitialized
- Add SampledImageReaderTest and PDFBoxResourceLoaderTest unit tests
- JPEGFactory: inspect SOF marker in byte stream to accurately detect grayscale (PDDeviceGray) and CMYK (PDDeviceCMYK) JPEGs instead of unconditionally hardcoding PDDeviceRGB
- JPEGFactory: batch alpha pixel extraction in chunked row buffers to prevent excessive heap allocations on large images
- PDImageXObject: batch getPixels and setPixels in applyMask using chunked scanlines to slash row-by-row JNI crossings by >95%
- PDDeviceGray: batch getPixels and setPixels in toRGBImage using chunked scanlines
- PDDeviceCMYK: batch getPixels and setPixels in toRGBImage using chunked scanlines
- LosslessFactory: batch getPixels in createFromRGBImage and createFromGrayImage using chunked scanlines
- Add JPEGFactoryTest for grayscale, RGB, and CMYK SOF detection
@sandeepkrs
sandeepkrs merged commit dae098b into master Oct 3, 2026
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant