Results 1 to 4 of 4

Thread: Picture Files

  1. #1

    Thread Starter
    Fanatic Member Nove's Avatar
    Join Date
    Jul 2004
    Posts
    736

    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.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    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.

  3. #3

    Thread Starter
    Fanatic Member Nove's Avatar
    Join Date
    Jul 2004
    Posts
    736

    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.

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    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
  •  



Click Here to Expand Forum to Full Width