Author Topic: Problem with TransparentBlt  (Read 6715 times)

Offline Pheaj

  • Single posting newcomer
  • *
  • Posts: 5
Problem with TransparentBlt
« on: November 19, 2005, 07:51:57 pm »
In my other linker options I have -llibmsimg32 listed, my directories are set. and I'm still get an error.
BTW, I'm using mingw.  I can get this to work with VS2003 but I'd like to get it to work with Code::Blocks and mingw.

Bitmap.cpp: In member function `void Bitmap::Draw(HDC__*, int, int, BOOL, COLORREF)':
Bitmap.cpp:226: error: `TransparentBlt' undeclared (first use this function)
Bitmap.cpp:226: error: (Each undeclared identifier is reported only once for each function it appears in.)
Process terminated with status 1 (0 minutes, 20 seconds)
 

If you have any insights please...I would be in your debt

Thanks
drew
« Last Edit: November 19, 2005, 08:18:41 pm by Pheaj »

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
Re: Problem with TransparentBlt
« Reply #1 on: November 19, 2005, 09:24:46 pm »
That's not a linking error. It can't find the function definition.

Browsing here, it tells you that you need the header file, Wingdi.h
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_2y9g.asp

If you defined #WIN32_LEAN_AND_MEAN, it may have not been including with windows.h, so just include it manually.
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

Offline Pheaj

  • Single posting newcomer
  • *
  • Posts: 5
Re: Problem with TransparentBlt
« Reply #2 on: November 20, 2005, 03:04:41 am »
Thank you very much.  I will give it a try.

Offline Pheaj

  • Single posting newcomer
  • *
  • Posts: 5
Re: Problem with TransparentBlt
« Reply #3 on: November 20, 2005, 04:45:29 am »
Nope, didn't happen.
I switched it to just you BitBlt and -lmsimg32 does not look good at all.
It runs fine but I can not for the life of me get it to work with TransparentBlt.  Works fine with VS2003. 

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
Re: Problem with TransparentBlt
« Reply #4 on: November 20, 2005, 05:38:46 am »
Odd.

I remember somebody else posting about this on another board, I think Gamedev.net. I'll take a quick peek. But the library you link to has nothing to do with it. That is the correct library. The error you posted is not a linker error, it's a compiler error where it can't find the function definition.

C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
Re: Problem with TransparentBlt
« Reply #5 on: November 20, 2005, 05:42:00 am »
It's supported only in Win98 and above. Did you define a windows version? Try searching for the function in WINGDI.h and see if it's only defined if you have WIN98 or greater defined as your windows version.

Actually, MS says you shouldn't use that function, and has an article on how to make transparent blits.

http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B79212
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

Offline Pheaj

  • Single posting newcomer
  • *
  • Posts: 5
Re: Problem with TransparentBlt
« Reply #6 on: November 20, 2005, 06:32:14 am »
I came across this and it talks about the order things are called up when linking in g++

http://sourceforge.net/forum/forum.php?thread_id=1305898&forum_id=286641
« Last Edit: November 21, 2005, 02:02:43 am by Pheaj »

Offline Pheaj

  • Single posting newcomer
  • *
  • Posts: 5
Re: Problem with TransparentBlt
« Reply #7 on: November 20, 2005, 11:37:52 pm »
Well, I got it to work.  I took the if statement out of wingid.h



Code: [Select]
#if (WINVER >= 0x0500)
BOOL WINAPI AlphaBlend(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION);
BOOL WINAPI GradientFill(HDC,PTRIVERTEX,ULONG,PVOID,ULONG,ULONG);
BOOL WINAPI TransparentBlt(HDC,int,int,int,int,HDC,int,int,int,int,UINT);
#endif

Haven't figured out why it isnt' reading the correct version of windows yet.

How about
Code: [Select]
#define  WINVER  0x0500

Then I had problems with the linking.  If figured out that too.  Woohoo a good day.

Thanks
drew
« Last Edit: November 21, 2005, 01:17:59 am by Pheaj »

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
Re: Problem with TransparentBlt
« Reply #8 on: November 21, 2005, 04:14:37 am »
Were you defining that WINVER value before including windows.h? Otherwise it'd be useless.
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

Offline Mirycia

  • Single posting newcomer
  • *
  • Posts: 1
Re: Problem with TransparentBlt
« Reply #9 on: December 15, 2018, 01:38:15 am »
hi griend where you put this code in any .H or where salutes ;D



Code: [Select]
#if (WINVER >= 0x0500)
BOOL WINAPI AlphaBlend(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION);
BOOL WINAPI GradientFill(HDC,PTRIVERTEX,ULONG,PVOID,ULONG,ULONG);
BOOL WINAPI TransparentBlt(HDC,int,int,int,int,HDC,int,int,int,int,UINT);
#endif

Haven't figured out why it isnt' reading the correct version of windows yet.

How about
Code: [Select]
#define  WINVER  0x0500

Then I had problems with the linking.  If figured out that too.  Woohoo a good day.

Thanks
drew
[/quote]