Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa and PICT



On 8/10/07, Thomas Engelmeier <email@hidden> wrote:

> Quoting you, you deleted the non-trivial code necessary to draw - with
> just a tiny API subset - the same stuff :

  Deleted? No. Rewrote using the modern API as the original project
requirements stipulated? Yes.

> As Uli stated, you might avoid recording qd commands and emit the PICT
> opcodes directly.
> Or you might bug the author of "the other" application to upgrade his
> App to parse / use PDFs.
>
> I'd go the later route. PICT handling is not robust for anything but
> the plain, non-alpha "bitmap" case.

  I'm well aware of the alternatives to PICT and I agree it'd be
better, however I think you missed the part where I stated, "I don't
have the freedom to take a completely different approach" because I'm
working for a third party with their own project requirements and
existing mission-critical tools. Again, the ability to put PICT data
on the pasteboard (thereby maintaining compatibility with existing
mission-critical tools) is a *project requirement*.

  To that end, the overwhelming majority of opinions suggests I should
duplicate the drawing using QuickDraw. To accomplish this in the most
efficient manner, I believe the best approach is:

 - When the graph view's data series changes and -setNeedsDisplay: is
called, set another flag such as needsPICTDataCache.

- When -drawRect: is called, perform normal drawing, but at each step
(such as drawing a pie graph slice), mirror the drawing via QuickDraw
to the PICT data cache, then unset the needsPICTDataCache flag so
subsequent redraws (for UI-related stuff) don't bother with the PICT
caching.

  This has, I believe, two advantages:

1 - It only re-caches the PICT data when the data has actually changed.
2 - Piggybacking -drawRect: lets me use the same calculated drawing
metrics (no duplication of effort) which makes the code easier to
understand and maintain.

  Of course I say all this with complete ignorance of QuickDraw, so
there may be some "gotcha's" of which I'm blissfully unaware. Does
anybody see any inherent flaws in the above approach? Any suggestions
for improvement?

--
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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >Cocoa and PICT (From: "I. Savant" <email@hidden>)
 >Re: Cocoa and PICT (From: Thomas Engelmeier <email@hidden>)
 >Re: Cocoa and PICT (From: "I. Savant" <email@hidden>)
 >Re: Cocoa and PICT (From: Thomas Engelmeier <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.