• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting PDF and/or EPS data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting PDF and/or EPS data


  • Subject: Re: Getting PDF and/or EPS data
  • From: Scott Thompson <email@hidden>
  • Date: Fri, 16 Apr 2004 22:37:13 -0500

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).

Yep. A few other people have mentioned this idea before. Whilst it fits in with the general way that PostScript works it had always felt like overkill to me, since all that's really required the the stroke/fill overlap problem is a relatively simple compositing (masking) operation. Of course I now discovered that another alternative is the PDF colour blending rules...

Well.... The overlap problem is a simple "compositing" operation IF (and only if) you are rendering in a bitmap context. In the broader case of PDF rendering (inks on paper) then "compositing" doesn't make much sense.

I have often argued that Core Graphics should provide broader support for bitmap graphics operations like custom pixel blending modes and such. However, the argument given most often is that Core Graphics is a PDF implementation and PDF is a device independent drawing API. My counter argument has been, then that maybe there should be another graphics library... a complementary library for on-screen drawing that provides the capabilities needed.

Anyway... another graphics library on the system that provides curve-drawing with bitmap compositing operations is Java2D. If the java folks could figure it out (on the same OS) then surely the CG guys can too :-)

Now this solution worked fine, but it's only a half-stroke solution - the stroked line inside the bezier path goes missing. The results are acceptable, but I'm aiming for perfection, if possible. :-)

True enough.

If you're really into pain an suffering, another option would be to is create a 16 bit offscreen GWorld (using Carbon) that is the same size as stroked path. Draw the stroked path in black onto the offscreen GWorld. Then, use UpdateGWorld to transform the 16 bit pixmap into a 1 bit pixmap. From this 1 bit pixmap you can use BitmapToRegion to create a pixel mask that is just the stroke of the object. Then... use ClipCGContextToRegion to create a clip region from the pixel mask. It still won't be perfect (the antialiasing will be off when you convert the colors) but it will be closer.

:-)

Scott
_______________________________________________
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.


  • Prev by Date: How can I tell that a view has scrolled?
  • Next by Date: Re: [OT] Bug Reporter Questions
  • Previous by thread: Re: Getting PDF and/or EPS data
  • Next by thread: Display to screen but will not print
  • Index(es):
    • Date
    • Thread