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. Can anybody explan the function TransparentBlt()?

Can anybody explan the function TransparentBlt()?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
4 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.
  • I Offline
    I Offline
    ilavl
    wrote on last edited by
    #1

    I dont know how to use it ,can you give me a instance?? thanks a lot!!:confused:

    J G 2 Replies Last reply
    0
    • I ilavl

      I dont know how to use it ,can you give me a instance?? thanks a lot!!:confused:

      J Offline
      J Offline
      Jay Beckert
      wrote on last edited by
      #2

      Hi Ilavl, Perhaps you can provide which TransparentBlt() function your using? There is two that I know of. The class CDC has one, CImage has one also and they both take different parameters. Also one of them has a bad memory leak that can render the system useless. Off the top of my head I can't remember which one or if MS has fixed this or not. A quick search on http://msdn.microsoft.com/ should help. Let me know and I'll help you out. Cheers :)

      1 Reply Last reply
      0
      • I ilavl

        I dont know how to use it ,can you give me a instance?? thanks a lot!!:confused:

        G Offline
        G Offline
        Georg Haan
        wrote on last edited by
        #3

        TransparentBlt can be used to paint a picture from one DC (the source) to another (the destination). The special thing about it is, that you can designate a specific color to be transparent. Any pixel on the source DC with that specific color, will not be copied. It purpose was to supersede older BitBlt hassle with masks. if you have a DC ready with an image you want to place on a windowDC, and this image has the color black designated as transparent, this code would probably work: In your message handler: case WM_PAINT: TransparentBlt( (HDC) wParam, // your window DC 0, // Dest. x 0, // Dest. y 220, // width of picture on destination 440, // height of picture on destination hdcSrc, // Source DC 0, // Source x 0, // Source y 220, // width of picture on source 440, // height of picture on source RGB(0,0,0) // Macro, specifies the color black ); if source and destination heights and widths differ, TranparentBlt stretches the source image to fit the size specified for the destination... If you need more help concerning this, you could, if you like, email me the piece of source you're having trouble with... Georg Haan (.Netherlands)

        H 1 Reply Last reply
        0
        • G Georg Haan

          TransparentBlt can be used to paint a picture from one DC (the source) to another (the destination). The special thing about it is, that you can designate a specific color to be transparent. Any pixel on the source DC with that specific color, will not be copied. It purpose was to supersede older BitBlt hassle with masks. if you have a DC ready with an image you want to place on a windowDC, and this image has the color black designated as transparent, this code would probably work: In your message handler: case WM_PAINT: TransparentBlt( (HDC) wParam, // your window DC 0, // Dest. x 0, // Dest. y 220, // width of picture on destination 440, // height of picture on destination hdcSrc, // Source DC 0, // Source x 0, // Source y 220, // width of picture on source 440, // height of picture on source RGB(0,0,0) // Macro, specifies the color black ); if source and destination heights and widths differ, TranparentBlt stretches the source image to fit the size specified for the destination... If you need more help concerning this, you could, if you like, email me the piece of source you're having trouble with... Georg Haan (.Netherlands)

          H Offline
          H Offline
          Hadi Rezaee
          wrote on last edited by
          #4

          Hello Georg, Do you know how can i draw transparent image with IPicture object ? Please help me ... My month article: Game programming by DirectX by Lan Mader. Please visit in: www.geocities.com/hadi_rezaie/index.html Hadi Rezaie

          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