What is the void* returned from CGBitmapContextGetData?

I'm trying to get the pixel information from an image and have got to the point where I have my void* data object which is a pointer to the image data.

What exactly is this object? I've tried iterating over it hoping that it's an array of pixel info but it doesn't seem to work.

I want to get the rgb values for each pixel.

Answers


It's a pointer to the bitmap data. If you're having trouble interpreting it, then the bitmap probably isn't in the format you think it's in (CoreGraphics does some conversions automatically on loading external bitmaps).

Check the bitmap format info with CGBitmapContextGetBitmapInfo().


Need Your Help

Using javascript prototype function to initialise variable in 'this' context

javascript-objects prototype-programming javascript

I'm finding it difficult to explain in words, so here's a snippet of code I'm trying out but Firefox/firebug goes into tailspin!

Why does the following conditional operator “?:” compile but give a run-time error

c# conditional-expressions

I cannot figure out why the following program compiles without warnings, but in the exception block the conditional operator gives a NullReferenceException.