|
-
Mar 23rd, 2006, 03:34 AM
#1
Thread Starter
Fanatic Member
Picture Files
What would be the easiest way of translating the contents of a DC to a picture file, like a bitmap? Or better yet, would there be a relatively fast way to gather all the contents up into a one dimensional byte array without all the bitmap header stuff? I'm looking for something faster than getpixel. Thanks.
-
Mar 23rd, 2006, 11:11 AM
#2
Re: Picture Files
The fastest method is to use a DIB (Device Independent Bitmap).
See the "GetDIBits" tutorial here for a good explanation of how to use them.
-
Mar 23rd, 2006, 02:14 PM
#3
Thread Starter
Fanatic Member
Re: Picture Files
Thanks that explained it. The code there however uses the image.handle property of a picturebox. I want to get the contents of the DC of a window not in my project. Is there any way to do this? Thanks.
-
Mar 23rd, 2006, 04:10 PM
#4
Re: Picture Files
I've only ever used it that way myself... The trouble is that GetDIBits needs a handle to the bitmap.
You could use a temporary PictureBox for the image, it wouldn't take long to Blt the image into it. I know it's a bit of a waste of resources, but you could clear it out again after setting up the DIB.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|