Hi folks, let me first off noting that I have absolutely no idea what I'm doing with objective-c and mac development (though I'm fine with c). I made a wonderfully simple graphics utility on leopard with the Quartz-2d binding for python:
http://developer.apple.com/graphicsimaging/pythonandquartz.html
that basically inputs a text file and writes a nice png file (it's a command line utility). I was happy as a pig in mud until I moved the utility to our snow leopard servers and discovered that there were all sorts of issues with CoreGraphics and 32 bit python on snow leopard. Some of these issues are soluble, and some not. So, I'm attempting to port this simple utility script to objective-c (really C I suppose) and running into a few issues. Does anyone else know if there's a nice example almost exactly like the one given in python and quartz, but all in native code?
My major issue is writing the graphics context to a file
myBitmapContext = MyCreateBitmapContext (400, 300);
CGContextSetRGBFillColor (myBitmapContext, 1, 0, 0, 1);
CGContextFillRect (myBitmapContext, CGRectMake (0, 0, 200, 100 ));
CGContextSetRGBFillColor (myBitmapContext, 0, 0, 1, .5);
CGContextFillRect (myBitmapContext, CGRectMake (0, 0, 100, 200 ));
CGImageRef myImage = CGBitmapContextCreateImage (myBitmapContext);// 5
CGContextDrawImage(myBitmapContext, myBoundingBox, myImage);// 6
char *bitmapData = CGBitmapContextGetData(myBitmapContext); // 7
// I'd like to write to a file here!
CGContextRelease (myBitmapContext);// 8
if (bitmapData) free(bitmapData); // 9
CGImageRelease(myImage);
MyCreateBitmapContext is a simple function from apple's guide on quartz 2d.
TL;DR Does anyone have a C port of the python demo given in the above link?