Wouldnt it make much more sense if CGContextRef was an actual object?
Now u need to give the context with it, everytime u want to add a path.
Wouldnt it be much nicer to say:
[context addPath:myPath];
instead of
CGContextAddPath(context,myPath);
Is it a struct or whats the deal here?
Anyone care to elaborate?
It might be easier from a programmer’s point of view, but part of the reason that it is in C is for performance. When doing graphics intensive code, and rendering time matters (which is nearly always), the last thing you want to be doing is allocating lots of temporary objects. It’s a tradeoff – performance for readability/maintainability.
As Martin Ullrich mentioned, there are some Objective-C wrappers around some of the Core Graphics stuff, but it’s really a lot better to know what going on “under the hood” before using the Objective-C stuff (which will be easier, but slightly slower).
BTW this slowness I’m talking about is only really an issue when you are doing a lot of drawing, and you want (or need) to keep the FPS/responsiveness very good. If you’re drawing hundreds of shapes and lines, for example, you’d want to use CG directly. If you’re just drawing a handful of shapes/images/text, using the Obj-C wrappers will give only a negligible performance hit.