|
From: Wobien <roo...@pl...> - 2007-11-05 13:16:10
|
Hi,
I want to display bitmaps that have transparent and semi-transparent pixels
in a windows program.
Searching the mdsn information on the web I found the AlphaBlend function,
that promises exactly what I wanted, so I gave it a try.
>From MSDN topic AlphaBlend:
"
Requirements
Windows NT/2000/XP/Vista: Included in Windows 2000 and later.
Windows 95/98/Me: Included in Windows 98 and later.
Header: Declared in Wingdi.h; include Windows.h.
Library: Included as a resource in Msimg32.dll.
"
To start with, I copied an example from the mdsn site into a cpp file in my
project.
I am using windows XP, I included Windows.h, and I added libmsimg32.a to the
command line options for the linker in the project options and I tried to
compile.(I copied part of my cpp-file below)
The result was an AlphaBlend not declared errror.
I checked the Windows.h and Wingdi.h files:
>From windows.h:
"
#if !(defined NOGDI || defined _WINGDI_H)
#include <wingdi.h>
#endif
"
>From Wingni.h:
"
#if (WINVER >= 0x0500)
WINGDIAPI BOOL WINAPI
AlphaBlend(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION);
WINGDIAPI BOOL WINAPI GradientFill(HDC,PTRIVERTEX,ULONG,PVOID,ULONG,ULONG);
WINGDIAPI BOOL WINAPI
TransparentBlt(HDC,int,int,int,int,HDC,int,int,int,int,UINT);
#endif
"
It looks as if the preprocessor skips the declaration of AlphaBlend because
WINVER<0x500.
Do I have to inform the preprocessor about the windows version I am using?
And if so, how do I do that (I tried to find the answer in the on-line
manual on the gcc site, but didn't find anything usefull)?
from my cpp-file:
#include <windows.h>
.
.
.
if (!AlphaBlend(hdcwnd, ulWindowWidth/5, ulWindowHeight/5,
ulBitmapWidth, ulBitmapHeight,
hdc, 0, 0, ulBitmapWidth, ulBitmapHeight, bf))
return; // alpha blend failed
.
.
Thanks for your attention,
Wobien
|