Outlined strokes and transparency WAS: Getting PDF and/or EPS data
Outlined strokes and transparency WAS: Getting PDF and/or EPS data
- Subject: Outlined strokes and transparency WAS: Getting PDF and/or EPS data
- From: Robert Clair <email@hidden>
- Date: Mon, 19 Apr 2004 12:27:22 -0400
I can't think of a good solution to your problem... What you really
want to do is what (in the FreeHand universe at least) is called an
"expand stroke", that is "Create a path that outlines the stroke
applied to a given path". Unfortunately, Core Graphics doesn't
support that kind of geometric operation on paths. For things like
ovals, rectangles (and other regular polygons) the solutions are
pretty straightforward. For arbitrary paths, however, the
calculations involved are about as far away from "straightforward" as
you could ever hope for them to be. (Imagine, for example, the
simple case of a bezier segment that formed a self-intersecting
loop).
Generating the outline of any stoked polygon, regular or not, is
straightforward.
Accounting properly for the joins and ends is annoying but is more
tedious than difficult.
Bezier curves are another matter - the offset of a Bezier curve (what
you want
to outline the stroke) isn't a Bezier curve. However - if your offset
(half the
stroke width) is small compared to the (smallest) radius of curvature of
the Bezier curve, then offsetting the curve's control polygon and then
using that
as the control polygon for the "offset" curve gives a good
approximation.
If you can't meet that condition, you could try generating a bunch of
offset points
along the curve and then fitting one or more Bezier segments to them.
(Code for fitting Beziers is in the Graphic Gem series - google
fitcurve.c).
Related but perhaps OT: A question for someone who knows more about
driving
printers than I do: Why doesn't PostScript have transparency other
than for
images? (Why is there no setrgbacolor ?) Doesn't everything wind up
rasterized to
some sort of device pixel before being output? If they can blend an
image why not a fill ?
Clearly many printers can handle this - pdf 4 allows it and I can print
transparent
colors to my desktop printer.
.....Bob Clair
_______________________________________________
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.