On Tue, Aug 12, 2008 at 2:26 PM, Rein Hillmann <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Disclaimer: this is a question from a newbie.
>
> Could someone please explain why an NSColor yields so much data when
> archived to NSData?
>
> For example, the following code:
>
> NSColor* color = [NSColor yellowColor];
> NSData* colorAsData = [NSArchiver archivedDataWithRootObject:color];
> NSLog(@"colorAsData: %@", colorAsData);
>
> yields the output:
>
> colorAsData: <040b7374 7265616d 74797065 6481e803 84014084 8484074e 53436f6c
> 6f720084 84084e53 4f626a65 63740085 84016301 84046666 66660101 000186>
>
> I suspect it's archiving other ivars in the color object. If so, is this
> much data in a single color object not a little extreme?

Depends on a lot of things...

For example to following is xml coded form of an NSColor that shows
the various bits of information that could be  needed to recreate the
color instance.

<object class="NSColor" key="NSBackgroundColor" id="979054659">
        <int key="NSColorSpace">6</int>
        <string key="NSCatalogName">System</string>
        <string key="NSColorName">controlColor</string>
        <object class="NSColor" key="NSColor">
                <int key="NSColorSpace">3</int>
                <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes>
        </object>
</object>

...and another example...

<object class="NSColor" key="$9">
        <int key="NSColorSpace">1</int>
        <bytes key="NSRGB">MC4yNzQxODUwOSAwLjYwNjY1MjM4IDAuODQwNDkwODIAA</bytes>
</object>

-Shawn
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to