Thread: Saving a bitmap.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065

    Saving a bitmap.

    How do I save a bitmap if all I know is the pixel data of an HDC
    that I want to save it from?

    What I want to do is 1) read all the pixel data from the 1st HDC
    (which has the original bitmap loaded into it). Then 2) blit those
    pixels into another HDC with modifications. Lastly 3) save the
    image that was blitted into the 2nd HDC as a bitmap.

    I know how to do steps 1 and 2 with GetPixel and SetPixel, I just
    don't know how to save the contents of the 2nd HDC into
    a bitmap file.

    I know the structure of a bitmap file and I know the file will be a
    16-bit bitmap.

    All I can think of would be if I have to define my own
    BITMAPFILEHEADER and BITMAPINFOHEADER, populate an array
    of COLORREFs (that would hold pixel data). Then use CreateFile
    and WriteFile to make the bitmap. I was just wondering (hoping)
    if there was a function that made it easier/less combersome than
    that.

    Thanks in advance for any help.
    Last edited by jdinger; 04-29-2002 at 05:37 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bitmap saving problem
    By geek@02 in forum Windows Programming
    Replies: 3
    Last Post: 10-01-2007, 08:44 PM
  2. Saving the static control's HDC into bitmap
    By Joelito in forum Windows Programming
    Replies: 2
    Last Post: 09-13-2007, 09:22 PM
  3. Loading a bitmap (Without using glaux)
    By Shamino in forum Game Programming
    Replies: 7
    Last Post: 03-16-2006, 09:43 AM
  4. OpenGL -- Bitmaps
    By HQSneaker in forum Game Programming
    Replies: 14
    Last Post: 09-06-2004, 04:04 PM
  5. bitmap not going onto screen
    By stallion in forum Windows Programming
    Replies: 4
    Last Post: 02-22-2003, 10:07 AM