¡@

Home 

2014/10/15 ¤U¤È 10:12:37

iphone Programming Glossary: pixeldata

How to get the RGB values for a pixel on an image on the iphone

http://stackoverflow.com/questions/144250/how-to-get-the-rgb-values-for-a-pixel-on-an-image-on-the-iphone

colorSpace UInt8 pixelByteData A pointer to an array of RGBA bytes in memory RPVW_RGBAPixel pixelData The pixel struct with alpha in this version typedef struct RGBAPixel byte red byte green byte blue byte.. colorSpace NSLog @ Error allocating color space. return nil self setPixelData malloc byteCount if pixelData NSLog @ Error allocating bitmap memory. Releasing color space. CGColorSpaceRelease colorSpace return.. the format specified here by CGBitmapContextCreate. self setContext CGBitmapContextCreate void pixelData self.size.width self.size.height RGBA_8_BIT bytesPerRow colorSpace kCGImageAlphaPremultipliedLast..

How to get the RGB values for a pixel on an image on the iphone

http://stackoverflow.com/questions/144250/how-to-get-the-rgb-values-for-a-pixel-on-an-image-on-the-iphone

byteCount size_t pixelCount CGContextRef context CGColorSpaceRef colorSpace UInt8 pixelByteData A pointer to an array of RGBA bytes in memory RPVW_RGBAPixel pixelData The pixel struct with alpha in this version typedef struct RGBAPixel byte red byte green byte blue byte alpha RGBAPixel Bitmap function returns pre calculated RGBA.. space self setColorSpace CGColorSpaceCreateDeviceRGB if colorSpace NSLog @ Error allocating color space. return nil self setPixelData malloc byteCount if pixelData NSLog @ Error allocating bitmap memory. Releasing color space. CGColorSpaceRelease colorSpace return nil Create the bitmap context. Pre multiplied RGBA 8 bits.. per component. The source image format will be converted to the format specified here by CGBitmapContextCreate. self setContext CGBitmapContextCreate void pixelData self.size.width self.size.height RGBA_8_BIT bytesPerRow colorSpace kCGImageAlphaPremultipliedLast Make sure we have our context if context free pixelData..

How to get the RGB values for a pixel on an image on the iphone

http://stackoverflow.com/questions/144250/how-to-get-the-rgb-values-for-a-pixel-on-an-image-on-the-iphone

context CGColorSpaceRef colorSpace UInt8 pixelByteData A pointer to an array of RGBA bytes in memory RPVW_RGBAPixel pixelData The pixel struct with alpha in this version typedef struct RGBAPixel byte red byte green byte blue byte alpha RGBAPixel.. if colorSpace NSLog @ Error allocating color space. return nil self setPixelData malloc byteCount if pixelData NSLog @ Error allocating bitmap memory. Releasing color space. CGColorSpaceRelease colorSpace return nil Create the bitmap.. will be converted to the format specified here by CGBitmapContextCreate. self setContext CGBitmapContextCreate void pixelData self.size.width self.size.height RGBA_8_BIT bytesPerRow colorSpace kCGImageAlphaPremultipliedLast Make sure..

Create image from RGB data?

http://stackoverflow.com/questions/7235991/create-image-from-rgb-data

question a terribly primitive example similar to Mats' suggestion but this version uses an external pixel buffer pixelData const size_t Width 10 const size_t Height 10 const size_t Area Width Height const size_t ComponentsPerPixel 4 rgba uint8_t.. size_t Width 10 const size_t Height 10 const size_t Area Width Height const size_t ComponentsPerPixel 4 rgba uint8_t pixelData Area ComponentsPerPixel fill the pixels with a lovely opaque blue gradient for size_t i 0 i Area i const size_t offset i.. fill the pixels with a lovely opaque blue gradient for size_t i 0 i Area i const size_t offset i ComponentsPerPixel pixelData offset i pixelData offset 1 i pixelData offset 2 i i enhance blue pixelData offset 3 UINT8_MAX opaque create the bitmap..