Problem with drawing paths with Core Graphics - iPhone?

First, in PostScript (and derivatives such as AppKit drawing and Core Graphics), you normally draw a counter-clockwise path, especially when filling. A clockwise path like the one you show here is what you'd draw if you want to fill outside it Second, I'm assuming that this context has origin in the top-left (positive y going down), not the bottom-left (positive y going up) Coming out of the first arc, the current point is dead-center at the bottom of the pointer. Would it not make more sense to set the second point of the arct command ( CGContextAddArcToPoint ) as the first base point of the pointer?

Besides being more correct, you would only need to pass two points to CGContextAddLines Do you mean to close the path twice? I don't think it hurts anything, but it is redundant I would start drawing at the right base point of the pointer, then plot the lines to the next two points (tip and left base point, in that order), then plot all four arcs in (counterclockwise) succession, then closepath (once). That should be slightly simpler, and correct.

First, in PostScript (and derivatives such as AppKit drawing and Core Graphics), you normally draw a counter-clockwise path, especially when filling. A clockwise path like the one you show here is what you'd draw if you want to fill outside it. Second, I'm assuming that this context has origin in the top-left (positive y going down), not the bottom-left (positive y going up).

Coming out of the first arc, the current point is dead-center at the bottom of the pointer. Would it not make more sense to set the second point of the arct command (CGContextAddArcToPoint) as the first base point of the pointer? Besides being more correct, you would only need to pass two points to CGContextAddLines.Do you mean to close the path twice?

I don't think it hurts anything, but it is redundant. I would start drawing at the right base point of the pointer, then plot the lines to the next two points (tip and left base point, in that order), then plot all four arcs in (counterclockwise) succession, then closepath (once). That should be slightly simpler, and correct.

CGContextMoveToPoint(currentContext, midx+10.0f, miny); CGPoint points = { CGPointMake(midx, 0.0f), //point CGPointMake(midx-10.0f, miny), }; CGContextAddLines(currentContext, points, 2); CGContextAddArcToPoint(currentContext, minx, miny, minx, midy, radius); //TL CGContextAddArcToPoint(currentContext, minx, maxy, midx, maxy, radius); //BL CGContextAddArcToPoint(currentContext, maxx, maxy, maxx, midy, radius); //BR CGContextAddArcToPoint(currentContext, maxx, miny, midx, miny, radius); //TR CLOSE PATH, DRAW img36.imageshack. Us/img36/92/screenshot20091010at816. Png – Mobs Oct 10 '09 at 9:17 Peter, thanks for the tips.. excuse how brief that comment was - there is a character limit.It now appears that the starting point is not working?

– Mobs Oct 10 '09 at 9:18 That code definitely should work as intended. I suggest filing a bug about closepath returning to the first lineto and not the moveto.Bugreport.apple.Com – Peter Hosey Oct 10 '09 at 11:23 Incidentally, that appears to be the same problem that affects your original code: the closepath after the bottom-left arc jumps to the first lineto (left base point), skipping even the top-left arc. – Peter Hosey Oct 10 '09 at 12:17 1 Update: This is not a bug.

Quoth the docs for CGContextAddLines: “The first point is the array specifies the initial starting point. €? So that's implicitly a second moveto.

Cut out the explicit moveto, and pass all three points of the pointer to CGContextAddLines. – Peter Hosey Oct 10 '09 at 21:01.

So the CGContextMoveToPoint was not working, no matter what values were entered, with or without the CGContextPathBegin. Starting the path with the line at the corner of the pointer arrow allowed me to specify starting point. Thanks Peter for helping me understand it, and how to simplify the paths.

It's not so much that it wasn't working as that CGContextAddToLines does an implicit moveto that canceled out your explicit one. See my newest comment on my answer. – Peter Hosey Oct 10 '09 at 21:33.

First, in PostScript (and derivatives such as AppKit drawing and Core Graphics), you normally draw a counter-clockwise path, especially when filling. A clockwise path like the one you show here is what you'd draw if you want to fill outside it. Second, I'm assuming that this context has origin in the top-left (positive y going down), not the bottom-left (positive y going up).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions