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. [SOLVED] Need help with WinAPI AlphaBlend() [modified]

[SOLVED] Need help with WinAPI AlphaBlend() [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelptutorialquestion
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.
  • R Offline
    R Offline
    Rozis
    wrote on last edited by
    #1

    I need help with the GDI-function Alphablend() on Vista. Here's my code: hMemDC:=CreateCompatibleDC(hdc) hbitmap:=CreatecompatibleBitmap(hdc,width,height) ... blendfunc.BlendOp=0 blendfunc.BlendFlags=0 blendfunc.SourceConstantAlpha=128 blendfunc.AlphaFormat=0 AlphaBlend(hdc,siPX,siPY,width,Height,hMemDC,0,0,Width,Height,@blendfunc)) //StretchBlt(hdc,siPX,siPY,Width,Height,hMemDC,0,0,Width,Height,SRCCOPY) //BitBlt(hdc,siPX,siPY,Width,Height,hMemDC,0,0,SRCCOPY) When i use StretchBlt() or Bitblt() it works OK, so coordinates are ok. My language is not C so @blendfunc seams wrong but im sure it is not (it means 'pointer to a structure'). I suspect AlphaBlend does not work (returns false) because my bitmap has no alpha-channel. Saw on the MS-website an example that uses CreateDibSection() to create a 32-bit bitmap but that doesn't work also. It goes like this: hMemDC:=CreateCompatibleDC(hdc) memclear(@bmi,_sizeof(_winBITMAPINFO)) bmi.bmiHeader.biSize:=_sizeof(_winBITMAPINFOHEADER) bmi.bmiHeader.biWidth:=width bmi.bmiHeader.biHeight:=height bmi.bmiHeader.biPlanes:=1 bmi.bmiHeader.biBitCount:=32 bmi.bmiHeader.biCompression:=BI_RGB bmi.bmiHeader.biSizeImage:=oDim:width*oDim:height*4 hbitmap:=CreateDIBSection(hMemDC,@bmi,DIB_RGB_COLORS,pBits,NULL,0) SelectObject(hMemDC,hbitmap) So im out of options... Has anyone an idea, or a codesnippet that does work, so i can try that one? Thanks, Rozis

    modified on Sunday, June 28, 2009 5:04 AM

    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