views:

152

answers:

1

I've been writing my own library of functions to access some of the new Direct2D Windows libraries. In particular, I've been working on the ID2D1Bitmap interface. I wanted to write a function to return a pointer to the start of the bitmap data (for the editing of particular pixels, or custom encoding or whatever else I might wish for in the future). Unfortunately... problem ahead...

I can't seem to find a way to get access to the raw pixel data from the ID2D1Bitmap Interface.

Does anyone have an idea how to access this? One of my friends suggested drawing the bitmap to a surface and extracting the bitmap data from there. I don't know if this would work. It definitely seems inefficient and I wouldn't know which kind of surface to use.

Any help is appreciated. (c++ in particular, but I assume the code won't be tooo different between languages)

(I know I could just read in the data direct from the file, but I'm using the WIC decoders which means it could be in any number of indecipherable formats)

A: 

Since you're using the WIC decoder, you should be able to use IWICBitmap::Lock directly to get the bitmap data.

Eric Brown