views:

285

answers:

0

I am using a color map lookup table in my indexed color space. When I use CGImageCreate to create the CGImage, then create a UIImage, I get an extra COLUMN of pixels in the first 32 bits (4 pixels) of every pixel row... which causes the image to shift right by 4 pixels. It looks like the color map is being written to the first 32 bits of every row... then the display system displays these extra pixels! Am I missing something or doing something wrong. I've researched the web and documentation and cannot configure it out...

The color map works perfectly, but I do not want to see the color map content as displayed pixels.

Here is the basic setup:

CGColorSpaceRef indexedColorSpace = CGColorSpaceCreateIndexed(rgbColorSpace, 255, lut);

cgImage = CGImageCreate(    width,
                            height,
                            bitsPerComponent,
                            bitsPerPixel,
                            bytesPerRow,
                            indexedColorSpace,
                            bitmapInfo,
                            provider,
                            NULL,
                            NO,
                            kCGRenderingIntentDefault
                        );

UIImage *image = [[UIImage alloc] initWithCGImage:cgImage];