CGPathRef and PDF

There is a way to draw a complex shape using an application such as CorelDraw or Adobe Flash, etc., save it or export it as a PDF file, and then open it using Core Graphics in iOS. The idea is to draw a shape, vector, with CorelDraw - for example, and this is just the way to go. No color or fill. And then you can open it directly using Core Graphics, add it as CGPath to the context, and then be able to manipulate it, for example, fill it with solid color or gradient or patterns.

The bottom line is that I'm looking for a way to draw a complex shape in a user-friendly environment, such as Corel or Flash, and export it as a water that you can manipulate in Core Graphics. And suggestions or help are really available.

Thanks.

+4
source share
3 answers

SVGKit does not work exactly as I need. Although I have to say that this is well done. There are other resources that I have found, and I will leave them here for future reference if anyone stops at this post and is looking for a solution.

Converting SVG Paths to Objective-C Paths Good for simple paths; strokes and fills can be manipulated later using protocols. Complex paths get confused.

SVGKit Good for creating images and animating them later in the program. However, one cannot manipulate strokes, bays, and paths.

Opacity You can export as source code, so you have more control over the strokes, paths and fillings. As the path becomes more complex, manually managing the code is more difficult. Another problem - at the time of export, the program adds code-dependent codes. It can be a pain to go through about 300 lines of code to fix it so that it does not depend on permission. The end product would not be mixed, and they could be manipulated by protocols. Layers are CGLayers, not CALayers.

+2
source

If, as you say, you have PDF files (from Corel or another application), you can display them using CoreGraphics.

Take a look at:

Then there is the CGContextDrawPDFPage function, which you can use to draw PDF pages in a given graphics context, usually in drawLayer: inContext: for a subclass of UIView.

0
source

There is actually no built-in way to load CGPath from files, but you can take a look at SVGKit . Almost every modern vector drawing application can create SVG files.

0
source

All Articles