Thread: Bitmap from array to an object

  1. #1
    Registered User steve_i83's Avatar
    Join Date
    Aug 2001

    Question Bitmap from array to an object

    I have an array in my code which contains the data of a bitmap file. i wish to create a DIBsection and put all the array into it. then i want to draw that DIB section (possibly with a bitblt) to an object , either a picture box or a static text box or a frame ... or anything.... please suggest code or functions to help me

    C Rulz!

  2. #2
    train spotter
    Join Date
    Aug 2001
    near a computer
    GetDC (to find a DC for the location to draw)

    CreateCompatibleDC (get one of your own)

    CreateCompatibleBitmap (or use yours)

    SelectObject (to get the BMP into the HDC catching the return to put back when you finish)

    ReleaseDC (on the GetDC)
    May need SetDIBits and SetStretchBltMode

    BitBlt or StretchBlt to the frame buffer DC

    BitBlt (in the paint function to the paintstruct DC)

    DeleteDC on exit after SelectObject back so the HDC is exactly as you created it. Else you will lose GDI resources.

    I also stack a BITMAPINFOHEADER struc but I am loading jps from mem or off the drive so I am not sure if you need it.

    Easy OK?

  3. #3
    Registered User steve_i83's Avatar
    Join Date
    Aug 2001
    thanks seems easy enough.. ill try it
    C Rulz!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pass all the array as blob object in one field
    By Leite33 in forum Windows Programming
    Replies: 0
    Last Post: 11-12-2006, 01:27 PM
  2. Class Template Trouble
    By pliang in forum C++ Programming
    Replies: 4
    Last Post: 04-21-2005, 04:15 AM
  3. OpenGL -- Bitmaps
    By HQSneaker in forum Game Programming
    Replies: 14
    Last Post: 09-06-2004, 04:04 PM
  4. Merge sort please
    By vasanth in forum C Programming
    Replies: 2
    Last Post: 11-09-2003, 12:09 PM
  5. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 12:04 PM