Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I query the current point from a CGContext?

Apple's Quartz2d Programming Guide says "Quartz keeps track of the current point, which is the last location used for path construction." Is there some way for me to query what the current point is, given a CGContext reference?

I'm writing methods drawing a chart in segments, and it seems like if the CGContext already knows what the current point is, I shouldn't have to write the logic required to keep track of it separately. It seems silly to be passing both a CGContext and also the current point coordinates in method calls.

like image 821
c roald Avatar asked Jul 03 '12 22:07

c roald


1 Answers

This is how I get the current point:

CGPoint currentPoint = CGContextGetPathCurrentPoint(context);
NSLog(@"currentPoint: %@", NSStringFromCGPoint(currentPoint));
like image 52
EarlGrey Avatar answered Sep 22 '22 16:09

EarlGrey