Quantcast
Viewing all articles
Browse latest Browse all 168

Is there some kind of GetDIBitsFromDevice?

For setting DIB bits SetDIBits and SetDIBitsToDevice.
For getting DIB bits though there's only GetDIBits, at least as far I have seen.

Is there some kind of undocumented GetDIBitsFromDevice function that exists? SetDIBitsToDevice is a very powerful function (far more than just SetDIBits), because it allows you to take any rectangular portion of an image, who's pixels are represented by a byte array, and paste it anywhere in a displayed image (where that displayed image is represented by a DC). I would like to be able to do the reverse of this, take any portion of a displayed image, and copy it into byte array. GetDIBits does not have the ability to select a rectangular portion of an image displayed in a DC. GetDIBits only allows you to capture the entire displayed image (whether that image is the screen, or just one window on the screen).

Yes, I could use a set of functions like creating a new DC and a new DIB and then selecting the DIB into the DC, and then BitBlt a portion of the source into the new DC, and then in turn use GetDIBits to get a byte array copy of that new DC that I had created, and then clean up by unselecting the DIB, and deleting both the DIB and the DC, but that seems like unnecesary extra work. If a single function like SetDIBitsToDevice can be used for setting only a portion of the pixels in a displayed image, it seems only logical that there would be (and should be) an equivalent function to get only a portion of the pixels within an image.

Viewing all articles
Browse latest Browse all 168

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>