Re: Cocoa and PICT
Re: Cocoa and PICT
- Subject: Re: Cocoa and PICT
- From: Uli Kusterer <email@hidden>
- Date: Fri, 10 Aug 2007 07:41:32 +0200
On 09.08.2007, at 16:14, I. Savant wrote:
So there's my problem: I need transparency *and* vector information
preserved and can see no way of doing so.
To do transparency, you can use QuickTime, I think. Create a
GWorld, erase the whole image in it manually (including the alpha
channel), then draw the PICT into it. Quickdraw will only touch the
Alpha channel of pixels it actually modified, so if you then draw the
PICT using Quickdraw, you'll get transparency. Then copy the raw
pixels back out.
But I guess if you really want vector, you'd have to parse PICTs
yourself. The format is mostly documented in the old Inside Macintosh
volumes, and pretty well, too. Not sure some of the QuickTime
extensions to it are, though.
Oh wait ... you want to generate PICTs, not read them? Well, should
be a tad easier, as the format is documented. Just spit out the byte
sequences equivalent to whatever shape you wanna draw. The only issue
you'll have is simulating the Quartz commands in Quickdraw. It should
be possible to map across almost everything, but may be some work.
There's even support for smoothing polygons using picture comments,
which might be handy for simulating bezier paths. Though for gradient
fills, you'll probably have to go and clip a bitmap, or a series of
polygons, which may give some banding at high resolutions.
Note that QuickDraw only supports alpha transparency in bitmapped
data. For vector information it's either 100% transparent vs. 100%
opaque, or you can use a transfer mode like "blend" and opColor etc.
to define what ends up transparent. May be able to fake it, but not
sure it's worth the hassle.
* 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.
Where'd you hear that TIFF supports Vector graphics? TIFF, being
roughly based on IFF, can of course technically contain almost any
kind of data, but I've never encountered TIFFs that contain anything
else than pixels. It can contain several images, with different
depths, resolutions, indexed and true-color, and compressed in
different ways, but it's still a pixel map.
What makes you think it did vector? PICT is a vector format, and
like most vector formats can also contain a bunch of pixels as an
object, but TIFF? Complete news to me.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
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