SVGKExporterNSData.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. General-purpose exporter from loaded-SVGKImage object into an NSData byte-array.
  3. Uses the default color format from [SVGKImage+CGContext newCGContextAutosizedToFit] (currently RGBA / CGColorSpaceCreateDeviceRGB)
  4. */
  5. #import <Foundation/Foundation.h>
  6. #import "SVGKImage.h"
  7. @interface SVGKExporterNSData : NSObject
  8. /**
  9. Highest-performance version of .UIImage property (this minimizes memory usage and can lead to large speed-ups e.g. when using SVG images as textures with OpenGLES)
  10. Delegates to [ exportAsNSData:... flipYaxis:TRUE]
  11. */
  12. +(NSData*) exportAsNSData:(SVGKImage*) image;
  13. /**
  14. Highest-performance version of .UIImage property (this minimizes memory usage and can lead to large speed-ups e.g. when using SVG images as textures with OpenGLES)
  15. Delegates to exportAsNSData:... antiAliased:TRUE curveFlatnessFactor:1.0 interpolationQuality:kCGInterpolationDefault flipYaxis:...]
  16. */
  17. +(NSData*) exportAsNSData:(SVGKImage*) image flipYaxis:(BOOL) flipYaxis;
  18. /**
  19. Highest-performance version of .UIImage property (this minimizes memory usage and can lead to large speed-ups e.g. when using SVG images as textures with OpenGLES)
  20. NB: we could probably achieve get even higher performance in OpenGL by sidestepping NSData entirely and using raw byte arrays (should result in zero-copy).
  21. @param shouldAntialias = Apple defaults to TRUE, but turn it off for small speed boost
  22. @param multiplyFlatness = how many pixels a curve can be flattened by (Apple's internal setting) to make it faster to render but less accurate
  23. @param interpolationQuality = Apple internal setting, c.f. Apple docs for CGInterpolationQuality
  24. */
  25. +(NSData*) exportAsNSData:(SVGKImage*) image antiAliased:(BOOL) shouldAntialias curveFlatnessFactor:(CGFloat) multiplyFlatness interpolationQuality:(CGInterpolationQuality) interpolationQuality flipYaxis:(BOOL) flipYaxis;
  26. @end