#endif
m_isDIB =
- m_hasAlpha = FALSE;
+ m_hasAlpha = false;
}
wxBitmapRefData::wxBitmapRefData(const wxBitmapRefData& data)
wxASSERT_MSG( !data.m_isDIB,
_T("can't copy bitmap locked for raw access!") );
- m_isDIB = FALSE;
+ m_isDIB = false;
m_hasAlpha = data.m_hasAlpha;
}
return NULL;
wxBitmap *self = wx_const_cast(wxBitmap *, this);
- self->m_refData = new wxBitmapRefData(*data);
#if wxUSE_WXDIB
// copy the other bitmap
wxDIB dib((HBITMAP)(data->m_hBitmap));
self->CopyFromDIB(dib);
}
+ else
#endif // wxUSE_WXDIB
+ {
+ // don't copy the bitmap data, but do copy the size, depth, ...
+ self->m_refData = new wxBitmapRefData(*data);
+ }
return m_refData;
}
UnRef();
if ( !cursor.Ok() )
- return FALSE;
+ return false;
return CopyFromIconOrCursor(cursor);
}
UnRef();
if ( !icon.Ok() )
- return FALSE;
+ return false;
return CopyFromIconOrCursor(icon);
}
bool wxBitmap::CopyFromDIB(const wxDIB& dib)
{
- wxCHECK_MSG( dib.IsOk(), FALSE, _T("invalid DIB in CopyFromDIB") );
+ wxCHECK_MSG( dib.IsOk(), false, _T("invalid DIB in CopyFromDIB") );
#ifdef SOMETIMES_USE_DIB
HBITMAP hbitmap = dib.CreateDDB();
if ( !hbitmap )
- return FALSE;
+ return false;
#else // ALWAYS_USE_DIB
HBITMAP hbitmap = ((wxDIB &)dib).Detach(); // const_cast
#endif // SOMETIMES_USE_DIB/ALWAYS_USE_DIB
delete palette;
#endif // wxUSE_PALETTE
- return TRUE;
+ return true;
}
#endif // NEVER_USE_DIB
}
// Create from XPM data
-#if wxUSE_IMAGE && wxUSE_XPM
bool wxBitmap::CreateFromXpm(const char **data)
-#else
-bool wxBitmap::CreateFromXpm(const char **WXUNUSED(data))
-#endif
{
#if wxUSE_IMAGE && wxUSE_XPM
Init();
- wxCHECK_MSG( data != NULL, FALSE, wxT("invalid bitmap data") )
+ 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") )
+ wxCHECK_MSG( img.Ok(), false, wxT("invalid bitmap data") )
*this = wxBitmap(img);
- return TRUE;
+ return true;
#else
- return FALSE;
+ wxUnusedVar(data);
+ return false;
#endif
}
bool wxBitmap::Create(int width, int height, const wxDC& dc)
{
- wxCHECK_MSG( dc.Ok(), FALSE, _T("invalid HDC in wxBitmap::Create()") );
+ wxCHECK_MSG( dc.Ok(), false, _T("invalid HDC in wxBitmap::Create()") );
return DoCreate(width, height, -1, dc.GetHDC());
}
wxDIB dib(w, h, d);
if ( !dib.IsOk() )
- return FALSE;
+ return false;
// don't delete the DIB section in dib object dtor
hbmp = dib.Detach();
- GetBitmapData()->m_isDIB = TRUE;
+ GetBitmapData()->m_isDIB = true;
GetBitmapData()->m_depth = d;
}
else // create a DDB
if (hBitmap == NULL)
{
::ReleaseDC(NULL, hScreenDC);
- return FALSE;
+ return false;
}
HDC hMemDC = ::CreateCompatibleDC(hScreenDC);
if (!hMaskBitmap)
{
- hasMask = FALSE;
+ hasMask = false;
}
else
{
hOldMaskBitmap = ::SelectObject( hMaskDC, hMaskBitmap);
}
#else
- hasMask = FALSE;
+ hasMask = false;
#endif
}
SetPalette(image.GetPalette());
#endif // wxUSE_PALETTE
- return TRUE;
+ return true;
}
wxImage wxBitmap::ConvertToImage() const
bool wxBitmap::CreateFromImage(const wxImage& image, const wxDC& dc)
{
- wxCHECK_MSG( dc.Ok(), FALSE,
+ wxCHECK_MSG( dc.Ok(), false,
_T("invalid HDC in wxBitmap::CreateFromImage()") );
return CreateFromImage(image, -1, dc.GetHDC());
bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc)
{
- wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") );
+ wxCHECK_MSG( image.Ok(), false, wxT("invalid image") );
UnRef();
wxDIB dib(image);
if ( !dib.IsOk() )
- return FALSE;
+ return false;
// store the bitmap parameters
// don't delete the DIB section in dib object dtor
hbitmap = dib.Detach();
- refData->m_isDIB = TRUE;
+ refData->m_isDIB = true;
refData->m_depth = dib.GetDepth();
}
#ifndef ALWAYS_USE_DIB
image.GetMaskBlue())));
}
- return TRUE;
+ return true;
}
wxImage wxBitmap::ConvertToImage() const
{
*this = wxBitmap(image);
- return TRUE;
+ return true;
}
}
#endif // wxUSE_IMAGE
- return FALSE;
+ return false;
}
bool wxBitmap::Create(void *data, long type, int width, int height, int depth)
{
wxLogDebug(wxT("Failed to create bitmap: no bitmap handler for type %ld defined."), type);
- return FALSE;
+ return false;
}
m_refData = new wxBitmapRefData;
}
#endif // wxUSE_IMAGE
- return FALSE;
+ return false;
}
// ----------------------------------------------------------------------------
bool wxMask::Create(const wxBitmap& bitmap)
{
#ifndef __WXMICROWIN__
- wxCHECK_MSG( bitmap.Ok() && bitmap.GetDepth() == 1, FALSE,
+ wxCHECK_MSG( bitmap.Ok() && bitmap.GetDepth() == 1, false,
_T("can't create mask from invalid or not monochrome bitmap") );
if ( m_maskBitmap )
DeleteDC(srcDC);
SelectObject(destDC, 0);
DeleteDC(destDC);
- return TRUE;
+ return true;
#else
- return FALSE;
+ wxUnusedVar(bitmap);
+ return false;
#endif
}
}
#endif // wxUSE_PALETTE
- return FALSE;
+ return false;
}
// Create a mask from a bitmap and a colour indicating
bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
{
#ifndef __WXMICROWIN__
- wxCHECK_MSG( bitmap.Ok(), FALSE, _T("invalid bitmap in wxMask::Create") );
+ wxCHECK_MSG( bitmap.Ok(), false, _T("invalid bitmap in wxMask::Create") );
if ( m_maskBitmap )
{
wxLogLastError(wxT("CreateCompatibleDC"));
}
- bool ok = TRUE;
+ bool ok = true;
// SelectObject() will fail
wxASSERT_MSG( !bitmap.GetSelectedInto(),
{
wxLogLastError(wxT("SelectObject"));
- ok = FALSE;
+ ok = false;
}
HGDIOBJ hbmpDstOld = ::SelectObject(destDC, (HBITMAP)m_maskBitmap);
{
wxLogLastError(wxT("SelectObject"));
- ok = FALSE;
+ ok = false;
}
if ( ok )
return ok;
#else // __WXMICROWIN__
- return FALSE;
+ wxUnusedVar(bitmap);
+ wxUnusedVar(colour);
+ return false;
#endif // __WXMICROWIN__/!__WXMICROWIN__
}
{
wxBitmap *bitmap = wxDynamicCast(image, wxBitmap);
- return bitmap ? Create(bitmap, data, flags, width, height, depth) : FALSE;
+ return bitmap ? Create(bitmap, data, flags, width, height, depth) : false;
}
bool wxBitmapHandler::Load(wxGDIImage *image,
{
wxBitmap *bitmap = wxDynamicCast(image, wxBitmap);
- return bitmap ? LoadFile(bitmap, name, flags, width, height) : FALSE;
+ return bitmap ? LoadFile(bitmap, name, flags, width, height) : false;
}
bool wxBitmapHandler::Save(wxGDIImage *image,
{
wxBitmap *bitmap = wxDynamicCast(image, wxBitmap);
- return bitmap ? SaveFile(bitmap, name, type) : FALSE;
+ return bitmap ? SaveFile(bitmap, name, type) : false;
}
bool wxBitmapHandler::Create(wxBitmap *WXUNUSED(bitmap),
int WXUNUSED(height),
int WXUNUSED(depth))
{
- return FALSE;
+ return false;
}
bool wxBitmapHandler::LoadFile(wxBitmap *WXUNUSED(bitmap),
int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight))
{
- return FALSE;
+ return false;
}
bool wxBitmapHandler::SaveFile(wxBitmap *WXUNUSED(bitmap),
int WXUNUSED(type),
const wxPalette *WXUNUSED(palette))
{
- return FALSE;
+ return false;
}
// ----------------------------------------------------------------------------
*lpDIBHeader = lpDIBheader;
- return TRUE;
+ return true;
}
void wxFreeDIB(LPBITMAPINFO lpDIBHeader)
HICON wxBitmapToHICON(const wxBitmap& bmp)
{
- return wxBitmapToIconOrCursor(bmp, TRUE, 0, 0);
+ return wxBitmapToIconOrCursor(bmp, true, 0, 0);
}
HCURSOR wxBitmapToHCURSOR(const wxBitmap& bmp, int hotSpotX, int hotSpotY)
{
- return (HCURSOR)wxBitmapToIconOrCursor(bmp, FALSE, hotSpotX, hotSpotY);
+ return (HCURSOR)wxBitmapToIconOrCursor(bmp, false, hotSpotX, hotSpotY);
}
HBITMAP wxInvertMask(HBITMAP hbmpMask, int w, int h)
// Deselect objects
SelectObject(hdcSrc,srcTmp);
SelectObject(hdcDst,dstTmp);
-
+
::DeleteDC(hdcSrc);
::DeleteDC(hdcDst);