Cocoa and PICT
Cocoa and PICT
- Subject: Cocoa and PICT
- From: "I. Savant" <email@hidden>
- Date: Thu, 9 Aug 2007 10:14:24 -0400
List:
I've run into what looks to be a recurring Cocoa developer nightmare
and I'm having difficulty coalescing the various limitations,
workarounds, and documented statements of "support". The problem?
Cocoa's apparent ineptitude with the PICT format.
I'm rewriting an old PowerPlant application for a third party (I say
this because it means I don't have the freedom to take a completely
different approach) that creates graphs. The application itself is to
explore the data graphically via drag-and-drop reordering of
categories, etc. Quartz 2D has really helped me to show off Cocoa's
goodness to the original developers (it's *much* easier and a *lot*
prettier).
In a typical workflow, once the user is done manipulating, the
graphs are dragged to a very specific application that only accepts
PICT (because it is vector based and supports transparency). This is
where the trouble begins.
The old PowerPlant version has no trouble cranking out well-formed
PICT pasteboard data and files. The problem is with Cocoa. If I get
beautifully-rendered PDF or EPS data from my view and create an image
(or even directly creating an image representation), transparency is
lost *and* the image appears to be converted to a *bitmap*
representation. Numerous sources (lists, not the documentation) say
this is a basic limitation of Cocoa's PICT support. This, in short,
SUCKS.
* I've tried creating an NSPICTRepresentation from the
TIFFRepresentation (since TIFF supports raster *and* vector graphics)
and using the resulting -PICTRepresentation data (even with prepending
512 zeroed bytes to the data since the documentation says so). Result:
Copy of my image with lost transparency (black background),
rasterization.
* I tried using QuickTime's MovieImportComponent to convert the TIFF
data to PICT with kQTFileTypeTIFF. Result: Copy of my image with lost
transparency (white background), rasterization.
* I tried the previous (QuickTime) approach but with kQTFileTypePDF
and feeding it the PDF data from the view. Result: Copy of my image
with lost transparency (white background), rasterization.
So there's my problem: I need transparency *and* vector information
preserved and can see no way of doing so. It'd be great if I could go
straight from PDF to PICT or at least indirectly without *loss of
data*, but can see no way of doing either. That is of course absurd,
given that Cocoa with Quartz2D is the newer API. I don't get it; PICT
is Apple's *own format*. Why is it treated as a second-class citizen
but marked in the documentation s "supported"?
Does anybody have any suggestions on how to go from my
nicely-rendered view contents to well-formed PICT data for use with
NSPICTPboardType *without* losing transparency or being rasterized? Is
there some obvious path I'm missing?
--
I.S.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden