Skip to content

Support blend mode and better handling of transparency group XObjects#64

Merged
BobLd merged 2 commits intoBobLd:masterfrom
PsykerUdot:support-blendmode
Feb 11, 2026
Merged

Support blend mode and better handling of transparency group XObjects#64
BobLd merged 2 commits intoBobLd:masterfrom
PsykerUdot:support-blendmode

Conversation

@PsykerUdot
Copy link
Copy Markdown
Contributor

@PsykerUdot PsykerUdot commented Feb 10, 2026

This pull request introduces several improvements and refactorings, focusing on blend mode support and better handling of transparency group XObjects (transparency groups are not yet implemented though).

  • Extended the SKPaintCache to cache paints based on blend mode, removed the separate antialiasing paint fields, and updated all usages to pass blend mode explicitly. This enables correct rendering with different blend modes and improves paint reuse.
  • Transparency group XObject is rendered to separate Skia layer, as such XObjects are required to be rendered to parent layer as a whole. PR Make extended graphics states stacked too UglyToad/PdfPig#1246 is required to properly handle some cases (see this sample document).
  • Removed hacky IsAnnotationBelowText logic, as Highlight annotation normally has explicit appearence stream and blend modes are supported now.
  • [Breaking change] Made SkiaStreamProcessor no more responsible for background color. Modified the GetPageAsSKBitmap method to accept an optional background color, defaulting to white in tests and PNG export, and updated test helpers accordingly.
  • createEmptyDiffImage method is fixed, so it doesn't dispose returned bitmap (this caused AccessViolationException when running tests).
  • Reference images are updated, as few PDF are rendered more correctly now (at least comparing to other PDF renderers).
  • Test sample is added.

Comment thread UglyToad.PdfPig.Rendering.Skia/SkiaStreamProcessor.Image.cs
Comment thread UglyToad.PdfPig.Rendering.Skia/PdfPigExtensions.cs
@BobLd
Copy link
Copy Markdown
Owner

BobLd commented Feb 11, 2026

@PsykerUdot thanks a lot for the great work here!! this is a major contribution

I submitted a comment, keep me posted.

I will update PdfPig with the latest pre-release and check 68-1990-01_A_1.png again

Thanks again!

Comment thread UglyToad.PdfPig.Rendering.Skia/SkiaStreamProcessor.cs
@BobLd BobLd merged commit a8aa8a2 into BobLd:master Feb 11, 2026
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.

2 participants