PathParser.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // PathParser.h
  3. //
  4. // Created by Marcus Rohrmoser on 11.03.10.
  5. // Copyright (c) 2010-2014, Marcus Rohrmoser mobile Software
  6. // All rights reserved.
  7. //
  8. // Redistribution and use in source and binary forms, with or without modification, are permitted
  9. // provided that the following conditions are met:
  10. //
  11. // 1. Redistributions of source code must retain the above copyright notice, this list of conditions
  12. // and the following disclaimer.
  13. //
  14. // 2. The software must not be used for military or intelligence or related purposes nor
  15. // anything that's in conflict with human rights as declared in http://www.un.org/en/documents/udhr/ .
  16. //
  17. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  18. // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  19. // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  20. // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  21. // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  22. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  23. // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  24. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. //
  26. //
  27. #import "RagelParser.h"
  28. #import <CoreGraphics/CGPath.h>
  29. #import <CoreGraphics/CGAffineTransform.h>
  30. /** Parser for <a href="http://www.w3.org/TR/SVG11/paths.html#PathDataBNF">SVG path elements</a>.
  31. *
  32. * The implementation is generated via <a href="http://www.complang.org/ragel/">Ragel</a>
  33. * from PathParser.rl.
  34. *
  35. * <b>DO NOT EDIT PathParser.m MANUALLY!!!</b>
  36. *
  37. * See also https://lib2geom.svn.sourceforge.net/svnroot/lib2geom/lib2geom/trunk/src/2geom/svg-path-parser.rl
  38. */
  39. @interface PathParser : RagelParser {}
  40. /** Do the actual parsing. Stateless and reentrant.
  41. * @param data content of a svg path element's 'd' attribute.
  42. * @param trafo may be NULL
  43. * @param errPtr out parameter to report parsing problems.
  44. * @return a retained core graphics path.
  45. */
  46. -(CGPathRef)newCGPathWithNSString:(NSString *)data trafo:(const CGAffineTransform *)trafo error:(NSError **)errPtr;
  47. /** Do the actual parsing. Stateless and reentrant.
  48. * @param data content of a svg path element's 'd' attribute.
  49. * @param length number of max. baytes to read
  50. * @param errPtr out parameter to report parsing problems.
  51. * @return a retained core graphics path.
  52. */
  53. -(CGPathRef)newCGPathWithCString:(const char *)data length:(size_t)length trafo:(const CGAffineTransform *)trafo error:(NSError **)errPtr;
  54. @end