mirror of
https://github.com/exyte/Macaw.git
synced 2024-10-26 04:49:57 +03:00
commit
29ec199cbc
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = "Macaw"
|
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.summary = "Powerful and easy-to-use vector graphics library with SVG support written in Swift."
|
||||||
|
|
||||||
s.homepage = 'https://github.com/exyte/Macaw.git'
|
s.homepage = 'https://github.com/exyte/Macaw.git'
|
||||||
|
@ -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())
|
||||||
|
|
||||||
@ -149,6 +149,7 @@ public extension Node {
|
|||||||
|
|
||||||
defer {
|
defer {
|
||||||
MGraphicsEndImageContext()
|
MGraphicsEndImageContext()
|
||||||
|
renderer.dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let img = MGraphicsGetImageFromCurrentImageContext() else {
|
guard let img = MGraphicsGetImageFromCurrentImageContext() else {
|
||||||
|
Loading…
Reference in New Issue
Block a user