Responding to your revised code, I quote the documentation: Unlike the current path, the current clipping path is part of the graphics state. Therefore, to re-enlarge the paintable area by restoring the clipping path to a prior state, you must save the graphics state before you clip and restore the graphics state after you’ve completed any clipped drawing After determining the new clipping path, the function resets the context’s current path to an empty path — CGContextClip So, the current drawing path is not part of the graphics state. So here's what you're doing: Build drawing path Save gstate Add current drawing path to clipping path clear current drawing path Draw gradient Restore gstate (previous clipping path is restored; drawing path remains empty) Stroke nothing The solution is to draw the path into a CGPath object, then add it as the current path both before clipping (after saving the gstate) and before stroking You should also decide whether you want this to be an outer stroke, an inner stroke, or a centered stroke.
For a centered stroke, stroke while not clipped. For an inner stroke, stroke while clipped. For an outer stroke, reverse the path, then clip, then stroke.
You'll want to double your line width for both of the last two forms, since you'll be clipping out half of the stroke If I change the CGContextStrokePath(c) to be CGContextStrokeRect(c, rect) the stroke shows up Because that function adds a path of that rectangle to the current drawing path before stroking.
Responding to your revised code, I quote the documentation: Unlike the current path, the current clipping path is part of the graphics state. Therefore, to re-enlarge the paintable area by restoring the clipping path to a prior state, you must save the graphics state before you clip and restore the graphics state after you’ve completed any clipped drawing. After determining the new clipping path, the function resets the context’s current path to an empty path.
€”CGContextClip So, the current drawing path is not part of the graphics state. So here's what you're doing: Build drawing path Save gstate Add current drawing path to clipping path; clear current drawing path Draw gradient Restore gstate (previous clipping path is restored; drawing path remains empty) Stroke nothing The solution is to draw the path into a CGPath object, then add it as the current path both before clipping (after saving the gstate) and before stroking. You should also decide whether you want this to be an outer stroke, an inner stroke, or a centered stroke.
For a centered stroke, stroke while not clipped. For an inner stroke, stroke while clipped. For an outer stroke, reverse the path, then clip, then stroke.
You'll want to double your line width for both of the last two forms, since you'll be clipping out half of the stroke. If I change the CGContextStrokePath(c) to be CGContextStrokeRect(c, rect), the stroke shows up. Because that function adds a path of that rectangle to the current drawing path before stroking.
The docs for CGContextClip don't mention this. – mrueg Feb 1 '10 at 20:24 subw: Yes they do. €œAfter determining the new clipping path, the function resets the context’s current path to an empty path.
€? It does this because that's how PostScript (PDF's immediate ancestor) does it. – Peter Hosey Feb 1 '10 at 21:51 Makes sense.
I'll try this out tonight – coneybeare Feb 1 '10 at 22:48 works great. Maybe my logic is not the best on the corners, but that is a new SO question to ask :) – coneybeare Feb 2 '10 at 0:58 Dear Core Graphics GURU, If you feel like helping on another question, it is here: stackoverflow. Com/questions/2181279/… – coneybeare Feb 2 '10 at 1:10.
I don't think so. I am drawing the stroke after the gradient in the updated code. – coneybeare Feb 1 '10 at 15:14.
You're either drawing the gradient over the stroke, and/or clipping the region you stroke. I think the following might work better: CGContextSaveGState(c); CGContextClip(c); //gradient drawing stuff CGContextRestoreGState(c); CGContextStrokePath(c); Of course, you also have to set the stroke color and width correctly.
I thought this would do it but it didn't: grab. By/2714 – coneybeare Feb 1 '10 at 14:55 One more question: do you have a call to CGContextBeginPath(c) somewhere? If not, that might be a problem.
– mrueg Feb 1 '10 at 17:55 I do not. I have updated the code to show what I have before this section of the code that draws the cell. – coneybeare Feb 1 '10 at 18:16 Is the path drawn if you remove all the clipping, gradient drawing and saving and restoring the graphics state stuff?
If so, Peter Hoseys answer is probably right. – mrueg Feb 1 '10 at 20:32.
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.