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

Turn on background color when highlighting with C-SPC on a mac?

osx emacs terminal macbook

I'm using emacs on a macbook. In linux, when I use C-SPC to start mark blocks, the area I marked has a yellowish background that tells me where I start & end. However, in my macbook the backgro...

Get a list of directory names and output to file

c# filesystems io directory-structure

I am looking for the best method for a windows computer to grab a directory listing, output the result to a formatted text file I can then use to make a SQL update.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.