Skip to content

Add span methods to PdfFunction, Shading and ColorSpaceDetails #1301

Merged
BobLd merged 1 commit into
UglyToad:masterfrom
BobLd:feature/optimisations-shading
May 22, 2026
Merged

Add span methods to PdfFunction, Shading and ColorSpaceDetails #1301
BobLd merged 1 commit into
UglyToad:masterfrom
BobLd:feature/optimisations-shading

Conversation

@BobLd

@BobLd BobLd commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Introduces allocation-free Eval(ReadOnlySpan<double>, Span<double>) on PdfFunction and Shading plus GetRgb(ReadOnlySpan<double>, out r, out g, out b) on ColorSpaceDetails; the legacy double[] Eval / IColor GetColor surface is preserved by routing through a virtual wrapper sized by a new MaxOutputComponentCount.

PdfFunctions now caches the numeric arrays once at construction.

Type 0's RInterpol becomes a readonly ref struct that writes each recursion level into a caller-supplied slice of a single scratch span, so the sample interpolation no longer allocates a new double[] at every depth.

ColorSpaceDetails fans GetRgb out across Device / Cal / Lab / Indexed / Separation / DeviceN / ICCBased, with a shared GetRgbViaTint helper for the alternate-space hop, and the Cal/Lab Span Transform overrides now hoist their per-pixel stackalloc out of the loop.

@BobLd BobLd force-pushed the feature/optimisations-shading branch 3 times, most recently from b2a91ac to 70cebca Compare May 22, 2026 13:06
@BobLd BobLd changed the title Feature/optimisations shading Add span methods to PdfFunction, Shading and ColorSpaceDetails May 22, 2026
@BobLd BobLd force-pushed the feature/optimisations-shading branch from 6984628 to 5791d6f Compare May 22, 2026 13:42
@BobLd BobLd marked this pull request as ready for review May 22, 2026 13:45
@BobLd BobLd merged commit 638f287 into UglyToad:master May 22, 2026
2 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