in Source/Charts/Utils/Platform+Graphics.swift [137:153]
func NSUIGraphicsGetImageFromCurrentImageContext() -> NSUIImage?
{
if !imageContextStack.isEmpty
{
guard let ctx = NSUIGraphicsGetCurrentContext()
else { return nil }
let scale = imageContextStack.last!
if let theCGImage = ctx.makeImage()
{
let size = CGSize(width: CGFloat(ctx.width) / scale, height: CGFloat(ctx.height) / scale)
let image = NSImage(cgImage: theCGImage, size: size)
return image
}
}
return nil
}