Questions tagged [cgpathref]

17 questions
3
votes
1 answer

Convert CGPathRef to NSBezierPath

In Apple docs they give you code of how to convert NSBezierPath to CGPathRef. I need to convert the other way around, from CGPathRef to NSBezierPath. UIBezierPath has a property called cgPath so if I was working on iPhone that would not be a…
Bob Ueland
  • 1,804
  • 1
  • 15
  • 24
3
votes
2 answers

Swift - how to fill a path (opaque path)

I have a path which should have the shape of an isometric tile: let isometricPath = CGPathCreateMutable() CGPathMoveToPoint(isometricPath, nil, 0, -(tileSize.height / 2)) …
frankibanki
  • 115
  • 6
3
votes
2 answers

Can't set shadow on UICollectionViewCell and have rounded corners. Can only make one work at a time

I have a UICollectionViewCell subclass and I need to round its corners and add a shadow as well. The cell looks like a square card, and the cells have a good amount of space in-between them. So "underneath" every cell, I would like to add some…
user3344977
  • 3,584
  • 4
  • 32
  • 88
2
votes
1 answer

Opposite of CGPathCreateCopyByStrokingPath?

Are there any core or other framework methods to return a CGPath or collection of some type that represents the Fill portion of a path object? I am looking for something that would basically do the opposite of CGPathCreateCopyByStrokingPath. With…
txDecompression
  • 281
  • 3
  • 8
2
votes
5 answers

unable to call CGPathMoveToPoint() with nil in Swift

I have tried to call CGPathMoveToPoint() in Swift using the CGMutablePathRef and a CGPoint as input and NULL/nil instead of the CGAffineTransformation like this CGPathMoveToPoint(path, nil, point.x as CGFloat, point.y as CGFloat) However, I always…
user1612877
  • 391
  • 1
  • 5
  • 19
2
votes
0 answers

iOS: I can't get Core Text to use word wrapping. Where am I going wrong?

I've an attributed string with multiple words. I'm trying to draw it along a CGPathRef using Core Text on iOS7. However, even when I set the CTLineBreakMode to kCTLineBreakByWordWrapping, the text does not wrap on words, but on characters. For…
1
vote
1 answer

SKSprite not positioning where it should

I've got a character in a game, and it's supposed to shoot a bullet. I've set everything up for the character, and have setup the path for the bullet to travel through. Here's the code I'm using: //The destination of the bullet int x =…
Septronic
  • 1,156
  • 13
  • 32
1
vote
1 answer

Using MKCircle to detect if CGPathContainsPoint in Swift 2.0

I'm trying to detect if a Map Annotation is inside an MKCircle. I have tirelessly traversed the internet with little luck of finding a solid tutorial of this for Swift 2.0. All tutorial or Stack Overflow questions are answered with deprecated code…
Ivan
  • 665
  • 2
  • 10
  • 28
1
vote
0 answers

Given an X, how can you get the Y value on a CGPathRef?

I'm dealing with a CGPathRef that is a Bezier Curve. I'd like to get 100 evenly spaced X, Y coordinates on the path ref. For instance, on this line, I'd like to get 100 Y values for evenly spaced X values. Currently, I am creating a UIView and…
BigCheesy
  • 1,128
  • 8
  • 14
0
votes
1 answer

Is it possible to covert CGRect into CGPathRef ? - Objective C

I have a CGRect based on that I want to make CGPathRef. Is it doable in objective C?
Rahul
  • 5,594
  • 7
  • 38
  • 92
0
votes
1 answer

How can a CAShapeLayer continue drawing on a path (CGPathRef) even though the CGPathRef was released?

I have this code: CGPathRef cgPath = [path quartzPath]; self.blackLine.path = cgPath; self.whiteDashes.path = cgPath; CGPathRelease(cgPath); We set the CAShapeLayers (self.blackLine and self.whiteDashes) path to this CGPathRef Then…
A O
  • 5,516
  • 3
  • 33
  • 68
0
votes
2 answers

SKShapeNode and CGPathRef EXC_BAD_ACCESS

I am trying to dynamically draw curves along a path in an attempt to represent mountains. I have a function that returns a CGPathRef, which is a C pointer to a struct. -(CGPathRef)newPath { CGMutablePathRef mutablePath = CGPathCreateMutable(); …
i2Fluffy
  • 333
  • 2
  • 12
0
votes
1 answer

CGPathMoveToPoint/CGPathAddLineToPoint method parameters are confusing

I'm using the answer provided here SpriteKit's SKPhysicsBody with polygon helper tool to create polygons of physics bodies for my sprite nodes. But the offset parameters of CGPathMoveToPoint/CGPathAddLinetoPoint methods are confusing(I am unable to…
DroidHeaven
  • 2,414
  • 3
  • 25
  • 31
0
votes
2 answers

Drawing line with Touch iOS Sprite Kit

Im using the following code to draw lines in my sprite kit scene but nothing shows up. But the node counts goes up. Can anyone see what could be the problem. Ive been fighting with this code forever - (void)touchesBegan:(NSSet *)touches…
4GetFullOf
  • 1,738
  • 4
  • 22
  • 47
0
votes
1 answer

How to followPath: in clockwise direction for rectangular shape path?

I saw this answer on how to use SKAction to follow Circle CGPathRef in clockwise direction. What about rectangular path? The default one will be in counter-clockwise fashion: CGPathRef square = …
user1872384
  • 6,886
  • 11
  • 61
  • 103
1
2