objective c - Handling various types of Bitmaps in iOS -


is a very good article that I have found out how we can deal with bitmap buffer and UIImages. This article is related to RGBA32 / RGBA8 bitmap images. Bitmap images are created with a width of 4 * buffer * width * height *. That is, every pixel information will contain 4 bytes of data, respectively, to store red, green, blue and alpha, every 1 byte. On creating the bitmap image, bitmap information has been given 'KCGImageLifePhilMultPlayList'. CGColorSpaceCreateDeviceRGB () is used to return BitMap buffer UIImage. By changing bitmap information, we can also deal with RGBA 24 images. I need to deal with the RGBA 5551 bitmap images. I get red, green and blue colors of 5 beats that represent flexible colors and 1 bit to store the alpha value. If we are creating such a bitmap, then how can we allocate buffer to four * bitmap? Is it possible to convert it into UIImage data type? Any help would be appreciated.

Here is BITS_PER_COMPONENT 5 and BITS_PER_COMPONENT 16. With this code I have successfully KCGBitmapByteOrder16 indicates the fine sequence of the four buffer byte sequences.

size_t buffer length = width * height * 2; CGDataProviderRef Provider = CGDataProviderCreateWithData (NULL, Buffer, Buffer Lang, NULL); Size_t bitsPerComponent = BITS_PER_COMPONENT; Size_t bitspiprics = BITS_PER_PIXEL; Size_t bytesprero = 2 * width; CGColorSpaceRef ColorSpotcher = CGColorSpaceCreateDeviceRGB (); If (color space == faucet) {NSLog (@ "Error in assigning color space"); CGDataProviderRelease (provider); Return zero; } CGBitmapInfo bitmapInfo = kCGBitmapByteOrder16 Little | KCGImageAlphaNoneSkipFirst; CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault; CGImageRef iref = CGImageCreate (width, height, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpaceRef, bitmapInfo, provider, // data provider should be zero, // decode yes, // presentation interpolate); Uint32_t * pixel = (uint32_t *) molk (buffer lang); If (pixels == null) {NSLog (@ "Error: Not allocated for memory bitmap"); CGDataProviderRelease (provider); CGColorSpaceRelease (colorSpaceRef); CGImageRelease (iref); Return zero; } CGContextRef Reference = CGBitmapContextCreate (pixels, width, height, bits, byteparts, colorspace, bitmapinfo);

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -