Re: Getting PDF and/or EPS data
Re: Getting PDF and/or EPS data
- Subject: Re: Getting PDF and/or EPS data
- From: Steve Sims <email@hidden>
- Date: Fri, 16 Apr 2004 16:02:34 -0400
Hi Scott,
Just a quick note to say thanks.
I should have guessed this was a file format restriction. I just
blindly assumed that since Apple describe Quartz as "Display PDF" that
there wouldn't be such a big difference between bitmap and PDF graphics
contexts.
Now that you've pointed out where my understanding was flawed I've read
the relevant bits of the PDF and Postscript Reference documentation.
Well, I say read, more skimmed, but I now think I understand what's
going on and why.
The big problem that I had solved on-screen was rendering transparent
bezier lines and fills with no overlap between the two. This solution
though uses an NSCompositeDestinationOut compositing operation though,
and unfortunately PDF only supports "Over" type compositing. A bummer,
but it helps explain why I had to resort to NSImage objects to
accomplish the compositing, and also explains why bits of my PDF and
EPS files were rendered as bitmaps.
However the PDF reference talks about colour blending modes... It
seems to me that a proper PDF way to solve the stroke/fill overlap
problem is as follows. Render the transparent fill of a bezier path,
set the clipping area to that path, and then rendering the stroke of
the path using the same colour as the fill but with the "Difference"
blending mode. This should remove the extra bit of fill within the
stroke line. Remove the clipping path and then render the stroke in
the desired colour.
There's just one problem with this - I looked everywhere I can think of
in the docs but I don't see how to set the colour blending mode in CG,
or through the Cocoa. Any idea if this is actually possible?
Thanks again.
Steve
On 16 Apr 2004, at 08:35, Scott Thompson wrote:
Right now I can save out PDF and EPS files using the above calls,
however neither fully matches the output I see in my window. I use
NSImage with an NSCustomImageRep in my view to render some bezier
paths, making use of the compositing routines for masking purposes.
I'm drawing and filling some things with transparent colours, and I'm
also using NSShadow to get a shadow drawn.
When I try to view my PDF inside Preview the compositing operations I
have used are not obeyed. The EPS version does seem to obey the
compositing, so my transparent shapes get drawn correctly, but the
shadow is missing. In both cases composited elements seem to get
rendered as bitmaps.
This is consistent with the PostScript language. PostScript does not
support transparency except through the alpha channel on images.
Later versions of the PDF spec make some concessions for transparency,
but by in large the way that that support is carried out is very
implementation dependent.
If you look at Adobe Illustrator's support of transparency you'll find
that, by-in-large, the way Illustrator implements that transparency
(particularly when putting out PostScript) is by using high-resolution
bitmaps. Macromedia FreeHand can generate full-resolution
transparency, but I have in-depth, first-hand knowlege of how that is
done and it is pretty complex. Essentially it simulates transparency
by duplicating PostScript elements, color tinting them, and drawing
them through a clipping path in such a way that the end result looks
like alpha compositing but is really just painter's algorithm. .
In the PDF case, your use of shadows is probably shooting you in the
foot. What is likely happening is that the Shadow is implemented as a
bitmap. When the system tries to render the items that the shadow
touches it converts those items in turn to bitmap representations.
You might get better results if you can find a way to render the
shadow (by itself) into a bitmap and then use NSImage to composite the
shadow into the view yourself.
Depending on how you are looking at the EPS representation you could
also be seeing the bitmap preview that is associated with the
PostScript code.
Obviously what I really want is output that's the same as my window
display but in EPS or PDF format, with no bitmapping of my composited
elements.
This is really not supported by the underlying file format
specifications. They are doing the best they can.
Does anybody have any hints as to how I might be able to sort this
lot out or ideas as to what I might be doing wrong?
What you're doing "wrong" is trying to use a data format that really
doesn't support the operations you want to store. If you really want
a representation of "exactly what I see in my view" then just capture
a bitmap image of the view and be done with it. :-)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.