Skip to content

Conversation

@swhitty
Copy link
Owner

@swhitty swhitty commented Feb 23, 2025

Adds some helper methods to apply common transformations to instances of SVG:

  • size: sets the current size of the SVG scaling it as required
  • scale: increases the ideal rendered size of the image
  • translate: shift the rendered image without adjusting the size.
  • expand: add (or remove) padding around the image increasing the overall size.
let svg = SVG(name: "fish.svg")!  // 100x100 
    .expand(left: 10, right: 10)  // 120x100
    .scale(2)                     // 240x200

let image = svg.rasterize()       // 240x200

@codecov
Copy link

codecov bot commented Feb 23, 2025

Codecov Report

Attention: Patch coverage is 61.86441% with 45 lines in your changes missing coverage. Please review.

Project coverage is 83.99%. Comparing base (172c636) to head (dbeb76f).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
SwiftDraw/CommandLine+Process.swift 0.00% 19 Missing ⚠️
SwiftDraw/SVG+Deprecated.swift 0.00% 15 Missing ⚠️
SwiftDraw/SVG.swift 89.47% 6 Missing ⚠️
SwiftDraw/SVG+CoreGraphics.swift 72.22% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #71      +/-   ##
==========================================
- Coverage   84.58%   83.99%   -0.59%     
==========================================
  Files          81       82       +1     
  Lines        7251     7322      +71     
==========================================
+ Hits         6133     6150      +17     
- Misses       1118     1172      +54     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@swhitty swhitty merged commit 9bbc820 into main Feb 23, 2025
16 of 19 checks passed
@swhitty swhitty deleted the SVG+Transform branch February 23, 2025 10:19
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