Mailing Lists: Apple Mailing Lists

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

deserializeBytes question



hey,
got a problem understanding the implementation of the deserialize methods in the NSData and NSMutableData Objects.

I am actually trying to get the int values for each rgb pixel in a tiff image rep.
so I get the NSdata object for the tiffImageRep,

then I set my Cursor to the address of the pointer to the bytes of the Data Object, I am guessing that the counter needs to be that base address of the first element in the byte buffer.

now I send this command:

myInt = [MyDataObject deserializeAlignedBytesLengthAtCursor: cursor];

this gives me back an error:
2001-10-31 15:38:42.195 mitre[447] *** -[NSConcreteData deserializeAlignedBytesLengthAtCursor:]: range {1296891946, 4} exceeds data length 1399874

so my assumption at this point is that I don't understand deserializing.
the documentation of course is very spotty, so I don't know where to begin figuring this out.

any ideas what I am doing wrong?
i tried setting my cursor to 0, just incase the buffer counted from its first entry automatically, but i quickly realized it cannot be.
Then I realized that The method : deserializeAlignedBytesLengthAtCursor has no way of limiting the number of bytes it deserializes, and that makes me think I really don't understand what the method is for.

does anybody have any code that gets one pixel at a time from an NSData object that was passed from TiffRepresentation ?

any help would be greatly appreciated,
ted




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.