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
5
votes
2 answers

Preserve line width while scaling all points in the context with CGAffineTransform

I have a CGPath in some coordinate system that I'd like to draw. Doing so involves scaling the old coordinate system onto the Context's one. For that purpose, I use CGContextConcatCTM() which does transform all the points as it should. But, as it is…
MrMage
  • 7,282
  • 2
  • 41
  • 71
5
votes
0 answers

Create a CALayer mask by combining multiple paths

I'm trying to create a mask for a CALayer containing an image. This mask shall be able to use the union of multiple paths or the inverse of the union. In terms of a venn diagram that would be a disjunction or a joint denial (look here for graphics…
user511
  • 154
  • 1
  • 7
5
votes
1 answer

Joined UIBezierPath stroke as a whole

Being a beginner in iOS drawing I wanted to draw a small tooltip container which consists of a rectangle with an indicator arrow. I created 2 UIBezierPaths and joined them with "appendPath". I thought this was the right way to go about this, but…
Hidden
  • 129
  • 2
  • 4
5
votes
4 answers

Combining Intersecting CGPaths on iOS

I have a problem in an app I'm working on. Say I have two CGPaths that are fairly complex and I add them both to a CGMutablePath (thus combining them). Well, where the two paths intersect there will be points inside of each other. I want to…
daveMac
  • 3,041
  • 3
  • 34
  • 59
4
votes
1 answer

Move CGPathCreateMutable() so the path stays the same?

I have got 9 hexagon sprites across the screen and I have to specify a certain path around them to make their area touchable. I don't want to set the coordinates for every single path respectively, so can't I just use the first path (the hexagons…
the_critic
  • 12,720
  • 19
  • 67
  • 115
4
votes
2 answers

How do I write a PDF file from NSData source

I have a method that returns NSData from a CGPathRef like so ... + (NSData *) createPDFDataWithCGPath: (CGPathRef) path mediaBox: (CGRect) mediaBox { CFMutableDataRef data = NULL; if (path) { CFAllocatorRef allocator = NULL; data =…
Lee Probert
  • 10,308
  • 8
  • 43
  • 70
4
votes
2 answers

CGPathContainsPoint broken in iOS 12? Is a workaround possible?

I will try to keep this short. Take the following test code: CGPath* path = CGPathCreateMutable(); CGPathMoveToPoint(path, nil, 318.43, 183.47); CGPathAddCurveToPoint(path, nil, 322.98, 189.32, 327, 194.93, 329.81,…
Cristi
  • 1,488
  • 1
  • 14
  • 14
4
votes
1 answer

Resize UIView to fit a CGPath

I have a UIView subclass on which the user can add a random CGPath. The CGPath is added by processing UIPanGestures. I would like to resize the UIView to the minimal rect possible that contains the CGPath. In my UIView subclass, I have overridden…
TomH
  • 2,950
  • 2
  • 26
  • 49
4
votes
1 answer

Converting non-escaping value to 'T' may allow it to escape Xcode 10 Swift CGPath

I have this code it was work well in Xcode 9 but in Xcode 10 I received this error. Converting non-escaping value to 'T' may allow it to escape here is code : extension CGPath { func forEach( body: @convention(block) (CGPathElement) -> Void) { …
MidDev
  • 182
  • 1
  • 15
4
votes
2 answers

CGPath masked off CGPoints

I'm trying to build this: Where the white background is in fact transparent. I know how to clip a CGPath to a set region, but this seems to be to other way around, since I need to substract regions from a filled CGPath. I guess the right way to go…
samvermette
  • 40,269
  • 27
  • 112
  • 144
4
votes
2 answers

CAShapeLayer Slow User Interaction

I have a CAShapeLayer and it has to do a simple task of moving on the screen, guided by the user's finger. The problem is that the movement is too slow. The layer does move, but there is a lag and it feels slow. I have another test app where an…
alex
  • 279
  • 4
  • 14
4
votes
1 answer

CGPathCreateCopyByTransformingPath to Swift 3

I´m new to Swift 3 and I´m trying to translate the function to Swift 3: - (void) drawRect: (CGRect)rect { if (self.editionMode == Zoom) { for (Area *area in self.mArrayPaths) { CGAffineTransform zoom =…
Stornu2
  • 2,284
  • 3
  • 27
  • 47
4
votes
1 answer

Get UIBezierPath Stroke's Outline Path

I have a UIBezierPath stroke, now I want to get the stroke's outline path(not the stroke's path itself), is there a way I could get that? or at least NSLog the UIBezierPath stroke's outline path? Thanks
jane
  • 309
  • 2
  • 11
4
votes
3 answers

Huge Memory Leak in CGMutablePathRef

I Have Rendered nearly 1000 Polygons in the map. I get the path of the polygon using - (CGPathRef)polyPath:(MKPolygon *)polygon { MKMapPoint *points = [polygon points]; NSUInteger pointCount = [polygon pointCount]; NSUInteger i; …
ipraba
  • 16,485
  • 4
  • 59
  • 58
4
votes
1 answer

CGMutablePath.addArc not working in Swift 3?

In Xcode 8 beta 6, some of the functions to add a path changed, including those that add an arc: func addArc(center: CGPoint, radius: CGFloat, startAngle: CGFloat, endAngle: CGFloat, clockwise: Bool, transform: CGAffineTransform = default) Beyond a…
GoldenJoe
  • 7,874
  • 7
  • 53
  • 92