Skip to content

Apply transforms to text and fix multiple issues, such as circle/ellipse transforms with gradient fills - #74

Open
erikvullings wants to merge 3 commits into
Klowner:masterfrom
erikvullings:master
Open

Apply transforms to text and fix multiple issues, such as circle/ellipse transforms with gradient fills#74
erikvullings wants to merge 3 commits into
Klowner:masterfrom
erikvullings:master

Conversation

@erikvullings

Copy link
Copy Markdown

The PR description I created explains:

Features:

  • Apply transformations to text and tspan elements, including font size
    scaling.
  • Improved handling of circles and ellipses, with warnings only for
    complex transformations.
  • Basic handling for clipPath and linearGradient elements.

Fixes:

  • Corrected the scaling logic for rectangles.
  • Improved stroke width scaling to handle both style and direct
    attributes.
  • Fixed a ValueError in the scaleMultiple function.
  • Added tests for the new functionality and updated the test suite.
  • Circles becoming invisible after applying transformations in case gradient transformations weren't transformed too

All the code is ready and tested. The circles with gradient fills now work correctly!

erik.vullings-tno added 3 commits January 4, 2026 13:43
This commit introduces a number of improvements and bug fixes to the
applytransforms extension.

Features:
- Apply transformations to text and tspan elements, including font size
  scaling.
- Improved handling of circles and ellipses, with warnings only for
  complex transformations.
- Basic handling for clipPath and linearGradient elements.

Fixes:
- Corrected the scaling logic for rectangles.
- Improved stroke width scaling to handle both style and direct
  attributes.
- Fixed a ValueError in the scaleMultiple function.
- Added tests for the new functionality and updated the test suite.
This commit fixes critical bugs where circles and ellipses with transforms
were becoming invisible or lost during transformation, especially when using
gradient fills.

Changes:
- Fixed type errors: All coordinate (cx, cy) and radius (r, rx, ry) values
  are now properly converted to strings as required by SVG specification
- Circle to ellipse conversion: Circles with non-uniform scaling are now
  correctly converted to ellipses with proper rx/ry attributes
- Automatic gradient transformation: Implemented proper transformation of
  radial and linear gradients with userSpaceOnUse coordinates:
  * Added transformGradient() method to detect and transform gradient refs
  * Added transformRadialGradient() to transform cx, cy, fx, fy, r coords
  * Added transformLinearGradient() to transform x1, y1, x2, y2 coords
  * Gradients now follow their shapes during transformation
  * Existing gradientTransform attributes are properly applied
  * CSS style attribute checked first (correct precedence over fill attr)
- Added test case for circles with gradient fills in groups
- Updated README with detailed changelog

Fixes issue where shapes with gradient fills would appear at wrong positions
or become invisible after applying transforms.

Co-authored-by: Claude (Anthropic)
jackestar added a commit to jackestar/inkscape-applytransforms that referenced this pull request Mar 29, 2026
added hypothesis to the dev requirements
removed unneeded test run_test.py (the result dont match with inkscape anyway) from PR Klowner#74
restore original test and removed additional test (don't work) from PR Klowner#74
jackestar added a commit to jackestar/inkscape-applytransforms that referenced this pull request Mar 29, 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.

1 participant