views:

253

answers:

2

Is it possible to convert a vector image into Quartz 2D code (mac) so that image can be drawn programmatically?

A: 

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.

Rob Keniger
I'll check it out. thanks
HiQuLABS
+1  A: 

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.

Ken
vector image from illustrator?
HiQuLABS
NSImage also loads that.
Ken