Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
linear-gradient(),radial-gradient()and theirrepeating-variants forbackground-imageand thebackgroundshorthand. Closes #1912.Gradients are written as native PDF shadings, so the output stays vector. Transparent stops use a soft mask.
Changes
Cpdf::gradient()paints a shading over the current clipping area.Adapter\CPDF::gradient()fills a rectangle with it.Css\Gradientparses a value and resolves it for a box. Angles, sides and corners, circle and ellipse sizes and positions,calc()stops, color hints,currentcolorand alpha are supported.Limitations
background-size,-positionand-repeatare ignored. The gradient always covers the whole box.conic-gradient(), no vendor-prefixed syntax.method_exists(), so theCanvasinterface is unchanged. Other backends still paint the background color.Tests
Unit tests for parsing, resolution and the Cpdf output, plus four output tests. The reference PDFs were generated with dompdf, like the existing ones.
Disclaimer:
Most of the code was written by AI (Claude) and reviewed / tested by me.