// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
- #pragma implementation "bitmap.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
{
for (nCols = 0; nCols < nBytesPerLine; nCols++)
{
- unsigned char ucVal = *pzSrc++;
- unsigned char ucReversed = 0;
- int nBits;
+ unsigned char ucVal = *pzSrc++;
+ unsigned char ucReversed = 0;
+ int nBits;
for (nBits = 0; nBits < 8; nBits++)
{
ucReversed <<= 1;
- ucReversed |= (ucVal & 0x01);
+ ucReversed = (unsigned char)(ucReversed | (ucVal & 0x01));
ucVal >>= 1;
}
*pzDst++ = ucReversed;
vHeader.cx = (USHORT)nWidth;
vHeader.cy = (USHORT)nHeight;
vHeader.cPlanes = 1L;
- vHeader.cBitCount = nDepth;
+ vHeader.cBitCount = (USHORT)nDepth;
vHeader.usReserved = 0;
memset(&vInfo, '\0', 16);
vInfo.cx = (USHORT)nWidth;
vInfo.cy = (USHORT)nHeight;
vInfo.cPlanes = 1L;
- vInfo.cBitCount = nDepth;
+ vInfo.cBitCount = (USHORT)nDepth;
HBITMAP hBmp = ::GpiCreateBitmap(hPs, &vHeader, CBM_INIT, (PBYTE)pzData, &vInfo);
vHeader.cx = nW;
vHeader.cy = nH;
vHeader.cPlanes = 1;
- vHeader.cBitCount = lBitCount;
+ vHeader.cBitCount = (USHORT)lBitCount;
hBmp = ::GpiCreateBitmap( hPSScreen
,&vHeader
#endif
} // end of wxBitmap::CreateFromXpm
+bool wxBitmap::LoadFile(const wxString& filename, long type)
+{
+ UnRef();
+
+ wxBitmapHandler *handler = wxDynamicCast(FindHandler(type), wxBitmapHandler);
+
+ if ( handler )
+ {
+ m_refData = new wxBitmapRefData;
+
+ return handler->LoadFile(this, filename, type, -1, -1);
+ }
+#if wxUSE_IMAGE
+ else // no bitmap handler found
+ {
+ wxImage image;
+ if ( image.LoadFile( filename, type ) && image.Ok() )
+ {
+ *this = wxBitmap(image);
+
+ return true;
+ }
+ }
+#endif // wxUSE_IMAGE
+
+ return false;
+}
+
bool wxBitmap::LoadFile(
int nId
, long lType
GetBitmapData()->m_pBitmapMask = pMask;
} // end of wxBitmap::SetMask
-wxBitmap wxBitmap::GetBitmapForDC(
- wxDC& rDc
-) const
+wxBitmap wxBitmap::GetBitmapForDC(wxDC& WXUNUSED(rDc)) const
{
return(*this);
} // end of wxBitmap::GetBitmapForDC
// wxBitmapHandler
// ----------------------------------------------------------------------------
-bool wxBitmapHandler::Create(
- wxGDIImage* pImage
-, void* pData
-, long lFlags
-, int nWidth
-, int nHeight
-, int nDepth
-)
+bool wxBitmapHandler::Create( wxGDIImage* pImage,
+ void* pData,
+ long WXUNUSED(lFlags),
+ int nWidth,
+ int nHeight,
+ int nDepth)
{
- wxBitmap* pBitmap = wxDynamicCast( pImage
- ,wxBitmap
- );
+ wxBitmap* pBitmap = wxDynamicCast( pImage
+ ,wxBitmap
+ );
return(pBitmap ? Create( pBitmap
,pData
return false;
}
+bool wxBitmapHandler::LoadFile(
+ wxBitmap* WXUNUSED(pBitmap)
+, const wxString& WXUNUSED(rName)
+, long WXUNUSED(lType)
+, int WXUNUSED(nDesiredWidth)
+, int WXUNUSED(nDesiredHeight)
+)
+{
+ return false;
+}
+
bool wxBitmapHandler::SaveFile(
wxBitmap* WXUNUSED(pBitmap)
, const wxString& WXUNUSED(rName)
return hBmpInvMask;
} // end of WxWinGdi_InvertMask
-