¡@

Home 

2014/10/15 ¤U¤È 10:05:57

iphone Programming Glossary: databuffer

Any idea why this image masking code does not work?

http://stackoverflow.com/questions/1133248/any-idea-why-this-image-masking-code-does-not-work

maskWidth 15 0xfffffff0 int bufferSize bytesPerRow maskHeight allocate memory for the bits CFMutableDataRef dataBuffer CFDataCreateMutable kCFAllocatorDefault 0 CFDataSetLength dataBuffer bufferSize the data will be 8 bits per pixel no alpha.. allocate memory for the bits CFMutableDataRef dataBuffer CFDataCreateMutable kCFAllocatorDefault 0 CFDataSetLength dataBuffer bufferSize the data will be 8 bits per pixel no alpha CGColorSpaceRef colourSpace CGColorSpaceCreateDeviceGray CGContextRef.. colourSpace CGColorSpaceCreateDeviceGray CGContextRef ctx CGBitmapContextCreate CFDataGetMutableBytePtr dataBuffer maskWidth maskHeight 8 bytesPerRow colourSpace kCGImageAlphaNone drawing into this context will draw into the dataBuffer...

Best way to serialize a NSData into an hexadeximal string

http://stackoverflow.com/questions/1305225/best-way-to-serialize-a-nsdata-into-an-hexadeximal-string

NSString hexadecimalString Returns hexadecimal string of NSData. Empty string if data is empty. const unsigned char dataBuffer const unsigned char self bytes if dataBuffer return NSString string NSUInteger dataLength self length NSMutableString hexString.. string of NSData. Empty string if data is empty. const unsigned char dataBuffer const unsigned char self bytes if dataBuffer return NSString string NSUInteger dataLength self length NSMutableString hexString NSMutableString stringWithCapacity dataLength.. dataLength 2 for int i 0 i dataLength i hexString appendString NSString stringWithFormat @ 02lx unsigned long dataBuffer i return NSString stringWithString hexString @end Usage NSData someData ... NSString someDataHexadecimalString someData..