#include "wx/msw/private.h"
#include "wx/log.h"
+#if !defined(__WXMICROWIN__)
#include "wx/msw/dib.h"
+#endif
+
#include "wx/image.h"
#include "wx/xpmdecod.h"
bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon)
{
+#ifndef __WXMICROWIN__
// it may be either HICON or HCURSOR
HICON hicon = (HICON)icon.GetHandle();
#endif // WXWIN_COMPATIBILITY_2
return TRUE;
+#else
+ return FALSE;
+#endif
}
#endif // Win32
{
Init();
+#ifndef __WXMICROWIN__
wxBitmapRefData *refData = new wxBitmapRefData;
m_refData = refData;
// we assume that it is in XBM format which is not quite the same as
// the format CreateBitmap() wants because the order of bytes in the
// line is inversed!
- static const size_t bytesPerLine = (width + 7) / 8;
- static const size_t padding = bytesPerLine % 2;
- static const size_t len = height * ( padding + bytesPerLine );
+ const size_t bytesPerLine = (width + 7) / 8;
+ const size_t padding = bytesPerLine % 2;
+ const size_t len = height * ( padding + bytesPerLine );
data = (char *)malloc(len);
const char *src = bits;
char *dst = data;
}
SetHBITMAP((WXHBITMAP)hbmp);
+#endif
}
// Create from XPM data
Init();
wxCHECK_MSG( data != NULL, FALSE, wxT("invalid bitmap data") )
-
+
wxXPMDecoder decoder;
wxImage img = decoder.ReadData(data);
wxCHECK_MSG( img.Ok(), FALSE, wxT("invalid bitmap data") )
-
- *this = wxBitmap(img);
-
- if ( wxTheBitmapList ) wxTheBitmapList->AddBitmap(this);
+ *this = wxBitmap(img);
return TRUE;
#else
- return FALSE;
+ return FALSE;
#endif
}
bool wxBitmap::Create(int w, int h, int d)
{
+#ifndef __WXMICROWIN__
UnRef();
m_refData = new wxBitmapRefData;
#if WXWIN_COMPATIBILITY_2
GetBitmapData()->m_ok = hbmp != 0;
#endif // WXWIN_COMPATIBILITY_2
-
return Ok();
+#else
+ return FALSE;
+#endif
}
// ----------------------------------------------------------------------------
bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
{
+#ifdef __WXMICROWIN__
+ // TODO
+ return FALSE;
+#else
wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") )
m_refData = new wxBitmapRefData();
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
return TRUE;
+#endif
}
wxImage wxBitmap::ConvertToImage() const
{
+#ifdef __WXMICROWIN__
+ // TODO
+ return wxImage();
+#else
wxImage image;
wxCHECK_MSG( Ok(), wxNullImage, wxT("invalid bitmap") );
free(lpBits);
return image;
+#endif
}
#endif // wxUSE_IMAGE
wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const
{
+#ifndef __WXMICROWIN__
wxCHECK_MSG( Ok() &&
(rect.x >= 0) && (rect.y >= 0) &&
(rect.x+rect.width <= GetWidth()) &&
DeleteDC(dcSrc);
return ret;
+#else
+ return wxBitmap();
+#endif
}
// ----------------------------------------------------------------------------
// Contributed by Frederic Villeneuve <frederic.villeneuve@natinst.com>
wxBitmap wxBitmap::GetBitmapForDC(wxDC& dc) const
{
+#ifdef __WXMICROWIN__
+ return wxBitmap();
+#else
wxMemoryDC memDC;
wxBitmap tmpBitmap(GetWidth(), GetHeight(), dc.GetDepth());
HPALETTE hPal = (HPALETTE) NULL;
wxFreeDIB(lpDib);
return tmpBitmap;
+#endif
}
// ----------------------------------------------------------------------------
// Create a mask from a mono bitmap (copies the bitmap).
bool wxMask::Create(const wxBitmap& bitmap)
{
+#ifndef __WXMICROWIN__
wxCHECK_MSG( bitmap.Ok() && bitmap.GetDepth() == 1, FALSE,
_T("can't create mask from invalid or not monochrome bitmap") );
SelectObject(destDC, 0);
DeleteDC(destDC);
return TRUE;
+#else
+ return FALSE;
+#endif
}
// Create a mask from a bitmap and a palette index indicating
// the transparent area
bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
{
+#ifndef __WXMICROWIN__
wxCHECK_MSG( bitmap.Ok(), FALSE, _T("invalid bitmap in wxMask::Create") );
if ( m_maskBitmap )
bool ok = TRUE;
+ // SelectObject() will fail
+ wxASSERT_MSG( !bitmap.GetSelectedInto(),
+ _T("bitmap can't be selected in another DC") );
+
HGDIOBJ hbmpSrcOld = ::SelectObject(srcDC, GetHbitmapOf(bitmap));
if ( !hbmpSrcOld )
{
::DeleteDC(destDC);
return ok;
+#else
+ return FALSE;
+#endif
}
// ----------------------------------------------------------------------------
// DIB functions
// ----------------------------------------------------------------------------
+#ifndef __WXMICROWIN__
bool wxCreateDIB(long xSize, long ySize, long bitsPerPixel,
HPALETTE hPal, LPBITMAPINFO* lpDIBHeader)
{
{
free(lpDIBHeader);
}
+#endif
// ----------------------------------------------------------------------------
// other helper functions
extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w, int h)
{
+#ifndef __WXMICROWIN__
wxCHECK_MSG( hbmpMask, 0, _T("invalid bitmap in wxInvertMask") );
// get width/height from the bitmap if not given
::DeleteDC(hdcDst);
return hbmpInvMask;
+#else
+ return 0;
+#endif
}