SVGKExporterNSImage.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. General-purpose exporter from loaded-SVGKImage object into a new, rasterised NSImage.
  3. Uses the default color format from UIGraphicsBeginImageContextWithOptions(...)
  4. */
  5. #import "SVGKDefine.h"
  6. #if SVGKIT_MAC
  7. #import <Foundation/Foundation.h>
  8. #import "SVGKImage.h"
  9. @interface SVGKExporterNSImage : NSObject
  10. /**
  11. Higher-performance version of .NSImage property (the property uses this method, but you can tweak the parameters for better performance / worse accuracy)
  12. NB: you can get BETTER performance using the exportNSDataAntiAliased: version of this method, becuase you bypass Apple's slow code for making NSImage objects
  13. Delegates to exportAsNSImage:... antiAliased:TRUE curveFlatnessFactor:1.0 interpolationQuality:kCGInterpolationDefault]
  14. */
  15. +(NSImage*) exportAsNSImage:(SVGKImage*) image;
  16. /**
  17. Higher-performance version of .NSImage property (the property uses this method, but you can tweak the parameters for better performance / worse accuracy)
  18. NB: you can get BETTER performance using the exportNSDataAntiAliased: version of this method, becuase you bypass Apple's slow code for making NSImage objects
  19. @param shouldAntialias = Apple defaults to TRUE, but turn it off for small speed boost
  20. @param multiplyFlatness = how many pixels a curve can be flattened by (Apple's internal setting) to make it faster to render but less accurate
  21. @param interpolationQuality = Apple internal setting, c.f. Apple docs for CGInterpolationQuality
  22. */
  23. +(NSImage*) exportAsNSImage:(SVGKImage*) image antiAliased:(BOOL) shouldAntialias curveFlatnessFactor:(CGFloat) multiplyFlatness interpolationQuality:(CGInterpolationQuality) interpolationQuality;
  24. @end
  25. #endif /* SVGKIT_MAC */