开发者

Converting vector image to Quartz 2D code

Is it possible to convert a vecto开发者_开发技巧r image into Quartz 2D code (mac) so that image can be drawn programmatically?


Not easily, you would have to write all the code yourself to do this. You might like to have a look at the Opacity image editor, which allows you to generate images and export them as Quartz or Cocoa drawing code.


What kind of vector image?

NSImage loads PDFs the same way it loads bitmaps.

NSImage is Quartz 2D drawing, but if you meant that you need a CGImage, NSImage in 10.6 has a method for getting one. However, CGImage is explicitly bitmap based, unlike NSImage. The parameters you pass to -[NSImage CGImageForRect:context:hints:] will determine how the art is rasterized. It will be rasterized the same way it would be if drawing to the passed rect in the passed context.


You can use Vector code http://www.vectorcodeapp.com to generate core graphics code, which you may use programmatically, or even use to generate postscripts.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜