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