Hi, All:
I've been trying to solve a problem for awhile now and can't seem to get a handle on it. My application draws complex charts and graphs with text, etc. (called a "Figure" in this app). The application must export publication-quality PDF. All drawing is done with Quartz 2D commands in -drawRect:. It seems the use of -[NSImage lockFocus] and -[NSImage unlockFocus] always consistently rasterizes the text in these images as of the introduction of +[NSImage imageWithSize:flipped:drawingHandler], so I switched all my drawing to this method.
Unfortunately, because of the time it takes these very complex (many-thousand-point graphs, for example) figures to render, the deferred drawing causes all sorts of timing issues when the figure is invalidated and waiting for its associated query to be refreshed before initiating drawing of the figures. This means that many rapid changes or even selection changes (which dump an unneeded query's cached data if it's not being viewed) cause the rendered image to use a random mix of old vs. new cached data.
So I truly believe I need to render the image immediately, when I request it, not when the system feels it's necessary. If that means I need it to do so at maximum depth/resolution/quality/whatever, so be it. But -lock/unlockFocus ruin the image by rasterizing text.
So, is there a way to simultaneously:
- Force the image to draw immediately (ie, be able to use -lock/unlockFocus),
- Avoid rasterization of anything in the image
- Still look good no matter what (Retina or non-) screen it's displayed on (including while zoomed in)
I'd deeply appreciate any help anyone can offer.