-
October 23rd, 2011, 08:57 PM
#1
Bitmap TransparentBlt problems
...
class Bitmap
{
protected:
// Member Variables
HBITMAP m_hBitmap;
int m_iWidth, m_iHeight;
// Helper Methods
void Free();
public:
// Constructor(s)/Destructor
Bitmap();
Bitmap(HDC hDC, LPTSTR szFileName);
Bitmap(HDC hDC, UINT uiResID, HINSTANCE hInstance);
Bitmap(HDC hDC, int iWidth, int iHeight, COLORREF crColor = RGB(0, 0, 0));
virtual ~Bitmap();
// General Methods
BOOL Create(HDC hDC, LPTSTR szFileName);
BOOL Create(HDC hDC, UINT uiResID, HINSTANCE hInstance);
BOOL Create(HDC hDC, int iWidth, int iHeight, COLORREF crColor);
void Draw(HDC hDC, int x, int y, BOOL bTrans = FALSE,
COLORREF crTransColor = RGB(255, 0, 255));
int GetWidth() { return m_iWidth; };
int GetHeight() { return m_iHeight; };
};
...
void Bitmap:raw(HDC hDC, int x, int y, BOOL bTrans, COLORREF crTransColor)
{
if (m_hBitmap != NULL)
{
// Create a memory device context for the bitmap
HDC hMemDC = CreateCompatibleDC(hDC);
// Select the bitmap into the device context
HBITMAP hOldBitmap = (HBITMAP)SelectObject(hMemDC, m_hBitmap);
// Draw the bitmap to the destination device context
if (bTrans)
TransparentBlt(hDC, x, y, GetWidth(), GetHeight(), hMemDC, 0, 0, GetWidth(), GetHeight(), crTransColor);
else
BitBlt(hDC, x, y, GetWidth(), GetHeight(), hMemDC, 0, 0, SRCCOPY);
// Restore and delete the memory device context
SelectObject(hMemDC, hOldBitmap);
DeleteDC(hMemDC);
}
}
...
_pMB_Up->Draw(hDC, 494, 524);
_pMB_Right->Draw(hDC, 548, 578);
_pMB_Left->Draw(hDC, 422, 578);
...
1>Bitmap.obj : error LNK2019: unresolved external symbol __imp__TransparentBlt@44 referenced in function "public: void __thiscall Bitmap:raw(struct HDC__ *,int,int,int,unsigned long)" (?Draw@Bitmap@@QAEXPAUHDC__@@HHHK@Z)
///////////////////////////////////////////////////
HELP!
-
October 24th, 2011, 02:51 AM
#2
Re: Bitmap TransparentBlt problems
From MSDN article(""):
Requirements
...
Header WinGdi.h (include Windows.h) Library Msimg32.lib DLL Msimg32.dll
So try to add Msimg32.lib in the list of objects/libraries modules...
Victor Nijegorodov
-
October 24th, 2011, 11:49 AM
#3
Re: Bitmap TransparentBlt problems
#pragma comment(lib, "Msimg32.lib")
Thank you =D
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|