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

Fix native image scale

This commit is contained in:
Sebastian Bott 2021-12-02 17:42:32 +01:00
parent 197903c131
commit 96e4900855

View File

@ -135,11 +135,11 @@ public extension CGAffineTransform {
public extension Node { 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 renderer = RenderUtils.createNodeRenderer(self, view: nil)
let rect = size.rect() let rect = size.rect()
MGraphicsBeginImageContextWithOptions(size.toCG(), false, 1) MGraphicsBeginImageContextWithOptions(size.toCG(), false, scale)
let ctx = MGraphicsGetCurrentContext()! let ctx = MGraphicsGetCurrentContext()!
ctx.clear(rect.toCG()) ctx.clear(rect.toCG())