Questions tagged [cgpath]

A graphics path is a mathematical description of a series of shapes or lines. CGPath defines an opaque type that represents an immutable graphics path.The issue related with this tag can be tagged using [tag:CGPath] in iOS

CGPath is available in apple "CoreGraphics" framework.CGPaths are how CoreGraphics describes the bezier paths it uses for drawing to the screen. They can go a long way to unlocking some of the power of CoreGraphics.

For More information:

CGPath related question in SO:

Related Tags:

446 questions
47
votes
7 answers

How can i convert NSBezierPath to CGPath

How can i convert between NSBezierPath to CGPath. Thanks.
vikas
  • 827
  • 1
  • 9
  • 19
43
votes
2 answers

Where and how to __bridge

I need some advice on __bridge-ing in iOS. Hopefully the SSCCE1 below will explain the problem better than I can in words, but I need to know how I can convert a void* to an NSMutableArray*; which __bridge variation should be used (See comment in…
James Webster
  • 31,873
  • 11
  • 70
  • 114
38
votes
2 answers

Why is 'nil' not compatible with 'UnsafePointer' in Swift 3?

Trying to create a CGMutablePath() as such: let path = CGMutablePath() CGPathMoveToPoint(path, nil, 30, 0) but the compiler keeps on giving me the following error: 'nil' not compatible with expected argument type…
cyril
  • 3,020
  • 6
  • 36
  • 61
38
votes
3 answers

How to animate a human written stroke using Swift/iOS?

Objective I am attempting to create an animated approximation of human writing, using a UIBezierPath generated from a glyph. I understand and I have read the many UIBezierPath questions which sound similar to mine (but are not the same). My goal is…
Tommie C.
  • 12,895
  • 5
  • 82
  • 100
31
votes
1 answer

Sprite Kit - SKShapeNode Path not drawing Quad Curve

I have been delving in to Apple's new Sprite Kit, and been using it for a while now. However I ran into an issue when trying to draw a curved path for an SKShapeNode. It just appears to draw a straight line instead. Here is a very simple example of…
David Williames
  • 1,109
  • 9
  • 11
31
votes
8 answers

Draw iOS 7-style squircle programmatically

I'm trying to find a way to draw a iOS 7-style icon 'squircle' shape programmatically, using core graphics. I'm not asking how to draw a rounded rectangle. A squircle is a superellipse: which is slightly different than a regular rounded…
Remy Vanherweghem
  • 3,925
  • 1
  • 32
  • 43
26
votes
1 answer

How to Animate a UIBezierPath

i would like to animate a UIBezierPath of a rect to a triangle one, not to animate a view on a path but animate the path itself so it morphs from one shape to another. the path is added to a CALayer CAShapeLayer *maskLayer = [CAShapeLayer…
Yogev Shelly
  • 1,373
  • 2
  • 13
  • 24
24
votes
2 answers

What is the difference between CGPath and UIBezierPath()?

At the moment, I'm trying to work out how to animate a custom button which I have an image of and have the coordinates of but I've found that you can create a button/object both by using the CGPath class or the UIBezierPath class. Can somebody…
BrianCO
  • 261
  • 2
  • 3
23
votes
3 answers

Get path to trace out a character in an iOS UIFont

Suppose I have a custom font "Foo" that I'm using in my iOS App. I've added it to my project, plist, etc. and I'm able to render UILabels and such with it just fine. Now, if I want to find out a sequence of points that would "trace out" the letter…
Joel
  • 2,285
  • 2
  • 21
  • 22
22
votes
2 answers

iOS Core Graphics: Draw ONLY shadows of a CGPath

I am drawing a simple path in iOS 5 with Core Graphics: CGMutablePathRef path = CGPathCreateMutable(); CGPathMoveToPoint( path, NULL, center.x , topMargin ); CGPathAddLineToPoint(path, NULL, center.x+20,…
Patrick Oscity
  • 53,604
  • 17
  • 144
  • 168
21
votes
7 answers

How to import/parse SVG into UIBezierpaths, NSBezierpaths, CGPaths?

I am trying to import paths from a vector drawing program into the ios environment. I would like to get them into CGpaths or UIbezierpaths. I am most interested in importing paths from adobe illustrator. The best way seems to save as an svg and…
Matt
  • 1,167
  • 1
  • 15
  • 26
21
votes
8 answers

SpriteKit's SKPhysicsBody with polygon helper tool

I wonder if there is a tool that could be used for easy generation of complex physics bodies in SpriteKit. I would like to have a volume based physical bodies with polygon-type shapes. SpriteKit allows to create such bodies with that method: +…
Darrarski
  • 3,882
  • 6
  • 37
  • 59
21
votes
1 answer

How to animate CAShapeLayer path and fillColor

How to animate CAShapeLayer path and fillColor? How to animate strokeEnd to show the path being drawn? and how to animate fillColor?
MAMN84
  • 1,400
  • 2
  • 13
  • 22
20
votes
2 answers

Efficient method to draw a line with millions of points

I'm writing an audio waveform editor in Cocoa with a wide range of zoom options. At its widest, it shows a waveform for an entire song (~10 million samples in view). At its narrowest, it shows a pixel accurate representation of the sound wave (~1…
tassock
  • 1,633
  • 1
  • 17
  • 32
20
votes
3 answers

CABasicAnimation with CALayer path doesn't animate

I'm trying to animation the transition of a CALayer from normal corners to rounded corners. I only want to round the top corners, so I am using a UIBezierPath. Here's the code: UIRectCorner corners = UIRectCornerTopLeft |…
eric.mitchell
  • 8,817
  • 12
  • 54
  • 92
1
2 3
29 30