1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-07-14 16:30:34 +03:00

Merge pull request #781 from hotbott/master

Native Image Scale
This commit is contained in:
Yuri Strot 2022-04-21 16:59:18 +07:00 committed by GitHub
commit 29ec199cbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "Macaw"
s.version = "0.9.9"
s.version = "0.9.10"
s.summary = "Powerful and easy-to-use vector graphics library with SVG support written in Swift."
s.homepage = 'https://github.com/exyte/Macaw.git'

View File

@ -135,11 +135,11 @@ public extension CGAffineTransform {
public extension Node {
func toNativeImage(size: Size, layout: ContentLayout = .of()) throws -> MImage {
func toNativeImage(size: Size, layout: ContentLayout = .of(), scale: CGFloat = 0.0) throws -> MImage {
let renderer = RenderUtils.createNodeRenderer(self, view: nil)
let rect = size.rect()
MGraphicsBeginImageContextWithOptions(size.toCG(), false, 1)
MGraphicsBeginImageContextWithOptions(size.toCG(), false, scale)
let ctx = MGraphicsGetCurrentContext()!
ctx.clear(rect.toCG())
@ -149,6 +149,7 @@ public extension Node {
defer {
MGraphicsEndImageContext()
renderer.dispose()
}
guard let img = MGraphicsGetImageFromCurrentImageContext() else {