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. How to paint from a memory DC to another memory DC

How to paint from a memory DC to another memory DC

Scheduled Pinned Locked Moved C / C++ / MFC
c++performancehelptutorialquestion
6 Posts 3 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.
  • A Offline
    A Offline
    Axonn Echysttas
    wrote on last edited by
    #1

    I got the following problem: I got a DC in which I need to put an image comprised of more bitmaps. However, if I paint the bitmaps one by one, I get some flicker. So I need 1 memory DC to paint the bitmaps with. 1 memory DC to paint them in. And then this last memory DC will get bitblt-ed on the third and real DC. But the problem is that when I can't paint from the first DC to the second. I select the bitmaps in the first DC and bitblt them in the second. But when I do my stuff and bitblt the second DC upon the third, I get only white. Anybody got any clue what I'm messing up here? I didn't include code 'cause my routine is rather complicated and it's not written in C++ but here is something that may be of use: 1. I create both memory DCs using "CreateCompatibleDC(REALDC)". 2. I select bitmaps in the first DC using "SelectObject (hdcMemory, myBITMAP)". 3. I simply bitblt from first DC to second DC at the desired coordinates. 4. I repeat steps 2. and 3. for 4 images, bitblt-ed at various coordinates within the second DC. 5. Now I bitblt the second DC in the real DC, the third one, the visual source. All is white................ -= E C H Y S T T A S =- The Greater Mind Balance

    I I 2 Replies Last reply
    0
    • A Axonn Echysttas

      I got the following problem: I got a DC in which I need to put an image comprised of more bitmaps. However, if I paint the bitmaps one by one, I get some flicker. So I need 1 memory DC to paint the bitmaps with. 1 memory DC to paint them in. And then this last memory DC will get bitblt-ed on the third and real DC. But the problem is that when I can't paint from the first DC to the second. I select the bitmaps in the first DC and bitblt them in the second. But when I do my stuff and bitblt the second DC upon the third, I get only white. Anybody got any clue what I'm messing up here? I didn't include code 'cause my routine is rather complicated and it's not written in C++ but here is something that may be of use: 1. I create both memory DCs using "CreateCompatibleDC(REALDC)". 2. I select bitmaps in the first DC using "SelectObject (hdcMemory, myBITMAP)". 3. I simply bitblt from first DC to second DC at the desired coordinates. 4. I repeat steps 2. and 3. for 4 images, bitblt-ed at various coordinates within the second DC. 5. Now I bitblt the second DC in the real DC, the third one, the visual source. All is white................ -= E C H Y S T T A S =- The Greater Mind Balance

      I Offline
      I Offline
      includeh10
      wrote on last edited by
      #2

      can u BitBlt() first memory DC to real DC properly? default size of memory DC is 1x1 pixels. did u set suitable size for all other memory DCs?


      A special image tool for C++ programmers, don't miss it! The world unique Software Label Maker is here for you and me ... A nice hyper tool for optimizing your MS html-help contents.


      A 1 Reply Last reply
      0
      • I includeh10

        can u BitBlt() first memory DC to real DC properly? default size of memory DC is 1x1 pixels. did u set suitable size for all other memory DCs?


        A special image tool for C++ programmers, don't miss it! The world unique Software Label Maker is here for you and me ... A nice hyper tool for optimizing your MS html-help contents.


        A Offline
        A Offline
        Axonn Echysttas
        wrote on last edited by
        #3

        I can't paint directly to the real DC 'cause I need to put more images. So I need an intermediate DC in which to dump the pictures piece by piece and then bitblt in the original DC. I set the size of the memory DC by selecting a bitmap of the desired size in it. Is that correct. -= E C H Y S T T A S =- The Greater Mind Balance

        I 1 Reply Last reply
        0
        • A Axonn Echysttas

          I got the following problem: I got a DC in which I need to put an image comprised of more bitmaps. However, if I paint the bitmaps one by one, I get some flicker. So I need 1 memory DC to paint the bitmaps with. 1 memory DC to paint them in. And then this last memory DC will get bitblt-ed on the third and real DC. But the problem is that when I can't paint from the first DC to the second. I select the bitmaps in the first DC and bitblt them in the second. But when I do my stuff and bitblt the second DC upon the third, I get only white. Anybody got any clue what I'm messing up here? I didn't include code 'cause my routine is rather complicated and it's not written in C++ but here is something that may be of use: 1. I create both memory DCs using "CreateCompatibleDC(REALDC)". 2. I select bitmaps in the first DC using "SelectObject (hdcMemory, myBITMAP)". 3. I simply bitblt from first DC to second DC at the desired coordinates. 4. I repeat steps 2. and 3. for 4 images, bitblt-ed at various coordinates within the second DC. 5. Now I bitblt the second DC in the real DC, the third one, the visual source. All is white................ -= E C H Y S T T A S =- The Greater Mind Balance

          I Offline
          I Offline
          Iain Clarke Warrior Programmer
          wrote on last edited by
          #4

          Not a direct reply, but you should look at Image Viewer Utility[^] by PJ Arends. It should help you a lot while debugging the problem. My guess is that you have incompatible bitmaps selected into your DCs.

          1 Reply Last reply
          0
          • A Axonn Echysttas

            I can't paint directly to the real DC 'cause I need to put more images. So I need an intermediate DC in which to dump the pictures piece by piece and then bitblt in the original DC. I set the size of the memory DC by selecting a bitmap of the desired size in it. Is that correct. -= E C H Y S T T A S =- The Greater Mind Balance

            I Offline
            I Offline
            includeh10
            wrote on last edited by
            #5

            do u know the differece between testing and final program?


            A special image tool for C++ programmers, don't miss it! The world unique Software Label Maker is here for you and me ... A nice hyper tool for optimizing your MS html-help contents.


            A 1 Reply Last reply
            0
            • I includeh10

              do u know the differece between testing and final program?


              A special image tool for C++ programmers, don't miss it! The world unique Software Label Maker is here for you and me ... A nice hyper tool for optimizing your MS html-help contents.


              A Offline
              A Offline
              Axonn Echysttas
              wrote on last edited by
              #6

              I don't know what you're trying to suggest here and I don't think I'm gonna like the sound of it. But please, give it a shot ::- ). -= E C H Y S T T A S =- The Greater Mind Balance

              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