From 96e4900855af0423b595cff0b4c4f49805b527ef Mon Sep 17 00:00:00 2001 From: Sebastian Bott Date: Thu, 2 Dec 2021 17:42:32 +0100 Subject: [PATCH] Fix native image scale --- Source/utils/CGMappings.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/utils/CGMappings.swift b/Source/utils/CGMappings.swift index 92a89c6d..d2f247f7 100644 --- a/Source/utils/CGMappings.swift +++ b/Source/utils/CGMappings.swift @@ -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())