Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. clipboard and CImage

clipboard and CImage

Scheduled Pinned Locked Moved ATL / WTL / STL
questiongraphicsdockerjsonperformance
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    luedi
    wrote on last edited by
    #1

    Hi, today I feel like a little child not understanding anything from the bitmap API. What I want to do is to fetch a large image via the clipboard using one of the CF_BITMAP of CF_DIB types. Since I need the data in an image processing application I must convert the data to some specific format, namely a 24 bpp DIB. Nothing special, but the format of the DIB in the clipboard can be anything. Additionally I need the data in my own data buffer and finally the image is tiled and must be composed back into one image using supsequent calls the the external application and ::GetClipboardData. Since the image is very large I don't want to copy memory around just to compose a DIB from the clipboard data, copy this DIB into a DDB with the desired new format and later copy the data into the user supplied buffer. As I said, I feel like a little child today, not understanding anything anymore from the DIB/BITMAP API. While trying to solve my problem I had the following questions: 1.) How can I wrap a user provided buffer into a DDB or DIB? It seems to me, that this is not possible, but why? 2.) What is the difference between a HBITMAP and a HANDLE or a HDIB? Or better, why does GetObject fail if I try to use it on a HANDLE returned from ::GetClipboardData (CF_BITMAP)? 3.) How do I wrap the data in the cipboard into a CImage? I cannot Attach to the HANDLE returned either from CF_BITMAP or CF_DIB and I can't use the API directly since there is no function to return the pointer to the start of the bits buffer. The function GetBits () returns a pointer to Pixel (0,0) which is in the most cases at the end of the bits buffer. 4.) What is the difference of a DIBSECTION and a DDB/DIB? The DIBSECTION seems to combine all the needs for a DDB and a DIB. It has BITMAP header and a BITMAPINFOHEADER. In the BITMAP header there is a member bmBits that points to the bitmap data. In the CImage::UpdateBitmapInfo this member is used as a pointer to the bits for a DIBSECTION image. But why is this member not valid for a BITMAP image? 5.) There are a lot of wrappers available for DIBs. One treats a DIB as an inherited CBitmap, another introduces a HDIB handle the next one only wraps the DIBSECTION API. All wrappers seem to be written before the existance of ATL7. But the CImage class still does not cover a good range of functions to deal with this problem. Is there a wrapper available that extends the CImage class for DIB/DDB conversion? Thanks a lot for your answers. Dirk

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups