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: Rendering HTML into CGBitmapContextRef




On May 23, 2005, at 1:15 PM, Gen Kiyooka wrote:

On May 20, 2005, at 1:25 PM, Scott Thompson wrote:

On May 20, 2005, at 1:06 PM, Mark Morrill wrote:

Hi all,

I've looked and I've come up with nothing... yet. Often, the answer will appear after posting to a list :) For example, after starting writing this post, I found "HTML Rendering Library". This looks like it will let me render into a offscreen gworld but, I'd rather skip that step.

What I want to do is to take a bit of html and render it into a CGBitmapContextRef (or CGContextRef for that matter.)


As I understand it, an Offscreen GWorld and a CGBitmapContextRef are analogous, and there is no reason that
they cannot both point to the same underlying memory. Use QTNewGWorldFromPtr to create your GWorld and
give it the same memory as your CGBitmapContextRef. The fact that Quartz and QuickDraw use different locations for (0,0)
may be slightly problematic.


This is, by in large, true. You can easily create a GWorld and a CGBitmapContext that both share the same memory.

For the sake of posterity, however, I should mention that it is also pretty easy to use QuickTime to create a GWorld that doesn't work with QuickDraw! For example, you can use QuickTime to create a GWorld that is CMYK (for importing CMYK images), but you cannot draw into that GWorld using QuickDraw.

Even if you create an ARGB offscreen pixel map that is shared by a GWorld and a CGBitmapContext drawing into it with QuickDraw may not be what you want. In particular, QuickDraw treats things as XRGB, not ARGB and you may run into trouble when QuickDraw sets the "X" to 255.

Scott


_______________________________________________ Do not post admin requests to the list. They will be ignored. Quartz-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quartz-dev/email@hidden

This email sent to email@hidden
References: 
 >Rendering HTML into CGBitmapContextRef (From: Mark Morrill <email@hidden>)
 >Re: Rendering HTML into CGBitmapContextRef (From: Scott Thompson <email@hidden>)
 >Re: Rendering HTML into CGBitmapContextRef (From: Gen Kiyooka <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.