• 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: Code and Decode a CGContextRef
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Code and Decode a CGContextRef


  • Subject: Re: Code and Decode a CGContextRef
  • From: "Jason Barker" <email@hidden>
  • Date: Tue, 27 Nov 2007 22:57:21 -0700

Uh, could both of you type slower so that I can understand you? :)

The image data in the CGContextRef is bitmap data. If I save out the
properties of the context individually, how should I handle the data?
Can that be converted to an NSData object?

Thanks,
Jason

>
> > I have an object with a member variable that is a CGContextRef. I'm
> > trying to implement the NSCoding protocol in my object. What is the
> > best/easiest way to code and decode this CGContextRef?
>
>
> Don't. CGContextRefs (like NSGraphicsContextes) are, under the scenes,
> references to IPC communication channels with the graphics
> infrastructure (I believe). What I know for sure is that they have no
> support for coding.
>
> Recreate a new CGContextRef in initWithCoder: from scratch using the
> appropriate CGContext... function. If you need the contents of the
> context, save them as image data (there should be CGImage... functions
> equivalent to NSImage's -TIFFRepresentation, which returns NSData
> objects which are encodable).
>
>   - ∞
>

>
> There isn't one easy way to do it, it depends on how you obtained the
> context in the first place. A bitmap context you would probably encode
> by describing its properties and maybe saving an image from its
> current contents. A PDF context may be described by the PDF data
> itself or a location where the PDF should be saved to. Other kinds of
> contexts are probably best not archived at all.
>
> What kind of context are you working with and where does it come from?
> Answering that question will probably tell you what you want to know
> to encode it well.
> --
> David Duncan
_______________________________________________

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Code and Decode a CGContextRef
      • From: Alastair Houghton <email@hidden>
References: 
 >Code and Decode a CGContextRef (From: "Jason Barker" <email@hidden>)
 >Re: Code and Decode a CGContextRef (From: David Duncan <email@hidden>)

  • Prev by Date: determining the result of a CAAnimation instance for time 't'
  • Next by Date: Re: Referenced projects and their targets/executables
  • Previous by thread: Re: Code and Decode a CGContextRef
  • Next by thread: Re: Code and Decode a CGContextRef
  • Index(es):
    • Date
    • Thread