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. C / C++ / MFC
  4. bitblt problem

bitblt problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++graphicsquestion
7 Posts 4 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.
  • T Offline
    T Offline
    tmaggioli
    wrote on last edited by
    #1

    Hi All, i have a problem with the MFC function of the class CDC: BOOL BitBlt( int x, int y, int nWidth, int nHeight, CDC* pSrcDC, int xSrc, int ySrc, DWORD dwRop ) When i use it for copy a bitmap with an area (in logic coordinates) minor than 8840000 (es. nWidth=5200 e nHeight=1700) it works properly, but with a major value it seems doesn't copy anything and the copy of the original bitmap is completely black. This bitmap resulting by the copy is already set to black previously when i use the function CBitmap::CreateCompatibleBitmap ... so i say that the BitBlt doesn't have any effect in this case.... Did you know why it happens?? Did you know some others MFC functions for doing the copy of bitmaps?? I hope i was enought clear to explain the problem. I'm sorry if it was already post but i didn't found it. Thanks in advantage for any help Bye TM

    N P M 3 Replies Last reply
    0
    • T tmaggioli

      Hi All, i have a problem with the MFC function of the class CDC: BOOL BitBlt( int x, int y, int nWidth, int nHeight, CDC* pSrcDC, int xSrc, int ySrc, DWORD dwRop ) When i use it for copy a bitmap with an area (in logic coordinates) minor than 8840000 (es. nWidth=5200 e nHeight=1700) it works properly, but with a major value it seems doesn't copy anything and the copy of the original bitmap is completely black. This bitmap resulting by the copy is already set to black previously when i use the function CBitmap::CreateCompatibleBitmap ... so i say that the BitBlt doesn't have any effect in this case.... Did you know why it happens?? Did you know some others MFC functions for doing the copy of bitmaps?? I hope i was enought clear to explain the problem. I'm sorry if it was already post but i didn't found it. Thanks in advantage for any help Bye TM

      N Offline
      N Offline
      Nelek
      wrote on last edited by
      #2

      Have you taken a look into StrechBlt (...) ?? Maybe your problem is because the sizes are not matching and the BitBlt doesn't know how to do it with that parameters.

      Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson

      1 Reply Last reply
      0
      • T tmaggioli

        Hi All, i have a problem with the MFC function of the class CDC: BOOL BitBlt( int x, int y, int nWidth, int nHeight, CDC* pSrcDC, int xSrc, int ySrc, DWORD dwRop ) When i use it for copy a bitmap with an area (in logic coordinates) minor than 8840000 (es. nWidth=5200 e nHeight=1700) it works properly, but with a major value it seems doesn't copy anything and the copy of the original bitmap is completely black. This bitmap resulting by the copy is already set to black previously when i use the function CBitmap::CreateCompatibleBitmap ... so i say that the BitBlt doesn't have any effect in this case.... Did you know why it happens?? Did you know some others MFC functions for doing the copy of bitmaps?? I hope i was enought clear to explain the problem. I'm sorry if it was already post but i didn't found it. Thanks in advantage for any help Bye TM

        P Offline
        P Offline
        Parthi_Appu
        wrote on last edited by
        #3

        Tommaso Maggioli wrote:

        BOOL BitBlt( int x, int y, int nWidth, int nHeight, CDC* pSrcDC,

        How your are selecting the bitmap in pSrcDC and in which DC you are coping?.. It will be clear if you post your code little bit...


        Do your Duty and Don't expect the Result

        T 1 Reply Last reply
        0
        • P Parthi_Appu

          Tommaso Maggioli wrote:

          BOOL BitBlt( int x, int y, int nWidth, int nHeight, CDC* pSrcDC,

          How your are selecting the bitmap in pSrcDC and in which DC you are coping?.. It will be clear if you post your code little bit...


          Do your Duty and Don't expect the Result

          T Offline
          T Offline
          tmaggioli
          wrote on last edited by
          #4

          I use the function BitBlt in this way: ... ... /** caller*/ pPGMBitmap->copyTo (CpyBitmapDisplay.GetDC(), 0, 0, BMPSize.cx, BMPSize.cy, 0, 0); ... ... ... ... /** handler*/ void CBitmapDisplay::copyTo(CDC *pdc, int xDest, int yDest, int w, int h, int xSrc, int ySrc) { if(pdc && hDC_.GetSafeHdc() != 0) pdc->BitBlt(xDest, yDest, w,h, &hDC_, xSrc, ySrc, SRCCOPY); } ... ... where &hDC is a CDC object of the class CBitmapDisplay.... Thanks TM

          1 Reply Last reply
          0
          • T tmaggioli

            Hi All, i have a problem with the MFC function of the class CDC: BOOL BitBlt( int x, int y, int nWidth, int nHeight, CDC* pSrcDC, int xSrc, int ySrc, DWORD dwRop ) When i use it for copy a bitmap with an area (in logic coordinates) minor than 8840000 (es. nWidth=5200 e nHeight=1700) it works properly, but with a major value it seems doesn't copy anything and the copy of the original bitmap is completely black. This bitmap resulting by the copy is already set to black previously when i use the function CBitmap::CreateCompatibleBitmap ... so i say that the BitBlt doesn't have any effect in this case.... Did you know why it happens?? Did you know some others MFC functions for doing the copy of bitmaps?? I hope i was enought clear to explain the problem. I'm sorry if it was already post but i didn't found it. Thanks in advantage for any help Bye TM

            M Offline
            M Offline
            Mark Salsbery
            wrote on last edited by
            #5

            Is BitBlt returning FALSE?  If so, what does GetLastError() return? Mark

            Mark Salsbery Microsoft MVP - Visual C++ :java:

            T 1 Reply Last reply
            0
            • M Mark Salsbery

              Is BitBlt returning FALSE?  If so, what does GetLastError() return? Mark

              Mark Salsbery Microsoft MVP - Visual C++ :java:

              T Offline
              T Offline
              tmaggioli
              wrote on last edited by
              #6

              I'm sorry but i see only now that the bitblt operate perfectly and the problem is another.... :doh: Thanks to All, TM

              N 1 Reply Last reply
              0
              • T tmaggioli

                I'm sorry but i see only now that the bitblt operate perfectly and the problem is another.... :doh: Thanks to All, TM

                N Offline
                N Offline
                Nelek
                wrote on last edited by
                #7

                Don't need to apologise, many times errors are not where we think ;) It is good if you have solved it

                Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson

                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