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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CreateCompatibleBitmap and memory

CreateCompatibleBitmap and memory

Scheduled Pinned Locked Moved C / C++ / MFC
helpgraphicsperformancequestion
3 Posts 2 Posters 4 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.
  • C Offline
    C Offline
    CodeBrain
    wrote on last edited by
    #1

    I am trying to create a bitmap for a DC using CreateCompatibleBitmap. But I have the problem that my bitmap can be very large. Say 6000x4000 pixel with (32bit). If I try to create such a large bitmap CreateCompatibleBitmap always fails and GetLastError returns ERROR_NOT_ENOUGH_MEMORY. OK, I have a large bitmap but I should have enough memory on my PC for such a large bitmap... So why has CreateCompatibleBitmap such problems to find enough memory? Can I split the bitmap in more junks automatically e.g. using a DIB instead of the DDB? Any response welcome. Thanks in advance

    J 1 Reply Last reply
    0
    • C CodeBrain

      I am trying to create a bitmap for a DC using CreateCompatibleBitmap. But I have the problem that my bitmap can be very large. Say 6000x4000 pixel with (32bit). If I try to create such a large bitmap CreateCompatibleBitmap always fails and GetLastError returns ERROR_NOT_ENOUGH_MEMORY. OK, I have a large bitmap but I should have enough memory on my PC for such a large bitmap... So why has CreateCompatibleBitmap such problems to find enough memory? Can I split the bitmap in more junks automatically e.g. using a DIB instead of the DDB? Any response welcome. Thanks in advance

      J Offline
      J Offline
      John R Shaw
      wrote on last edited by
      #2

      You should be able to create bitmaps of the size mentioned, even though it does require 96000000 bytes of memory (image bits only). CodeBrain wrote: Can I split the bitmap in more junks automatically e.g. using a DIB instead of the DDB? Answer: No, you would have to write your own code to split it into smaller chunks. I recommend going to the bitmap section and see if any of those programs has the same problem. Good luck! INTP

      C 1 Reply Last reply
      0
      • J John R Shaw

        You should be able to create bitmaps of the size mentioned, even though it does require 96000000 bytes of memory (image bits only). CodeBrain wrote: Can I split the bitmap in more junks automatically e.g. using a DIB instead of the DDB? Answer: No, you would have to write your own code to split it into smaller chunks. I recommend going to the bitmap section and see if any of those programs has the same problem. Good luck! INTP

        C Offline
        C Offline
        CodeBrain
        wrote on last edited by
        #3

        I made some additional tests. I have found out that 6000x4000 works, but 6000x4100 does not work. :confused: I will take a look on the bitmap section, maybe I'll find something.

        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