Tag: core graphics

将Quartz 2d python演示移植到纯Core Graphics C

让我首先注意到我完全不知道我在做什么用Objective-c和mac开发(虽然我对c很好)。 我用豹子的Quartz-2d绑定在豹子上制作了一个非常简单的图形工具: http://developer.apple.com/graphicsimaging/pythonandquartz.html 基本上输入一个文本文件并写一个漂亮的png文件(它是一个命令行实用程序)。 我很高兴作为一只泥泞的猪,直到我将这个实用程序移到我们的雪豹服务器上,并发现CoreGraphics和雪豹上的32位python存在各种各样的问题。 其中一些问题是可以解决的,有些则不是。 所以,我试图将这个简单的实用程序脚本移植到objective-c(实际上是CI假设)并遇到一些问题。 有没有其他人知道是否有一个很好的例子几乎完全像python和quartz中给出的那个,但都是在本机代码中? 我的主要问题是将图形上下文写入文件 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 = […]