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
11
votes
1 answer

How to use CGPathApply properly

I'm trying to use CGPathApply to iterate over each CGPathElement in a CGPathRef object (mainly to write a custom way to persist CGPath data). The problem is, each time it get to the call to CGPathApply, my program crashes without any information at…
Eric
  • 1,688
  • 2
  • 15
  • 13
11
votes
2 answers

Trim/subtract CGPath from CGPath?

I have some CGPath (a poly with two circle) carried out on a CAShapeLayer. Can I trim/subtract paths like this?
Geri Borbás
  • 15,810
  • 18
  • 109
  • 172
10
votes
6 answers

Finding the center of a CGPath

I have an arbitrary CGPath and I'd like to find it's geographic center. I can get the path bounding box with CGPathGetPathBoundingBox and then find the center of that box. But is there a better way to find the center of a path? Update for those who…
EFC
  • 1,890
  • 18
  • 39
9
votes
1 answer

CGPath copy lineJoin and miterLimit has no apparent affect

I am offsetting a CGPath using copy(strokingWithWidth:lineCap:lineJoin:miterLimit:transform‌​:). The problem is the offset path introduces all kinds of jagged lines that seem to be the result of a miter join. Changing the miterLimit to 0 has no…
Jeshua Lacock
  • 5,730
  • 1
  • 28
  • 58
9
votes
2 answers

CGPath with outline

I am trying to draw a CGPath that has a stroke for it's stroke. Basically I want a draw a line using CGPath. I then want to go back and draw lines on both sides of the last CGPath giving it the effect that it is outlines. This line can bend and…
endy
  • 3,872
  • 5
  • 29
  • 43
8
votes
2 answers

CAShapeLayer Animating Path Glitches / Flickers (From Ellipse to Rect and back)

I am running into an issue when I create an explicit animation to change the value of a CAShapeLayer's path from an ellipse to a rect. In my canvas controller I setup a basic CAShapeLayer and add it to the root view's layer: CAShapeLayer…
C4 - Travis
  • 4,502
  • 4
  • 31
  • 56
8
votes
1 answer

Masking CGContext with a CGPathRef?

I am doing some drawing using a CGContext. I am currently masking the drawing using a png file like this: UIImage * myImage = [UIImage imageNamed:@"frame.png"]; CGContextRef context = UIGraphicsGetCurrentContext (); CGContextClipToMask(context,…
Frank
  • 299
  • 1
  • 4
  • 11
8
votes
1 answer

Making a half circle path with CGPath, and follow the path with SKAction

I have no idea how to make a half circle path with CGPath. There is the code i have: let path = CGPathCreateMutable() let Width: CGFloat = 38.0 let radius: CGFloat = (Width / 2.0) + (Treshold / 2.0) CGPathAddArc(pathOne, nil, x, 0.0,…
Nurassyl Nuridin
  • 444
  • 4
  • 13
8
votes
1 answer

Create endless cgpath without framedrops

I need to create a cgpath continuously. At the moment I do it like that: func createLine(){ var rand = randomBetweenNumbers(1, 2) currentY-- if rand < 1.5{ currentX-- CGPathAddLineToPoint(leftPath,…
Christian
  • 22,585
  • 9
  • 80
  • 106
8
votes
1 answer

draw an arc clockwise in iOS results in unclockwise arc

I use the following code to draw an arc in the lower half of a circle. According to documentation in Apple: This method creates an open subpath. The created arc lies on the perimeter of the specified circle. When drawn in the default …
Pegah
  • 672
  • 2
  • 13
  • 23
8
votes
1 answer

Getting CGPath for an image with Alpha channel

How can I get the outline of the image as a CGPath? For example, how can I get the outline of the Google logo (which has an transparent background). This might be slightly complex case. So a solution to handle less complex scenarios will work (for…
Mustafa
  • 20,504
  • 42
  • 146
  • 209
8
votes
3 answers

How can I combine UIBezierPath drawings?

I'm trying to combine several UIBezierPath drawings. I have different types of drawings I can make (line, cubic bezier, quadratic beziers), and each of these can be filled or unfilled. I'm selecting the drawing type randomly, and my goal is to make…
pikovayadama
  • 808
  • 2
  • 8
  • 26
7
votes
2 answers

How to create a random closed smooth CGPath?

I am trying to find a way to create a random closed smooth path (CGPath or UIBezierPath). I have read about the De Casteljau's algorithm and tons other articles about Bezier paths but it does not seem to fit to what I try to achieve. I thought about…
Rafał Sroka
  • 39,540
  • 23
  • 113
  • 143
6
votes
2 answers

CGPathRef from string

Please how can we get path of particular arabic of french letter ? I've just found out that CTFontCreatePathForGlyph will give CGPathRef like, but its will be the outline of text . I need this real text path for showing a text drawing…
abdel ali
  • 61
  • 1
  • 3
6
votes
1 answer

CGPath as a string

Is there any way to get at the actual data of a CGPath, so it can be saved to a file and restored later? And is there any documentation on how that data is structured? I would like to write it as a string (like a SVG path string), or some way with…
user1082474
  • 119
  • 8
1 2
3
29 30