/////////////////////////////////////////////////////////////////////////////
-// Name: bitmap.cpp
+// Name: src/mac/classic/bitmap.cpp
// Purpose: wxBitmap
// Author: Stefan Csomor
// Modified by:
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation "bitmap.h"
-#endif
+#include "wx/wxprec.h"
-#include "wx/defs.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#include "wx/bitmap.h"
-#include "wx/icon.h"
-#include "wx/log.h"
-#include "wx/image.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/log.h"
+ #include "wx/icon.h"
+ #include "wx/image.h"
+#endif
+
#include "wx/xpmdecod.h"
#include "wx/rawbmp.h"
else
newColors = nil;
- /* If no errors occured, return a handle to the new off-screen PixMap */
+ /* If no errors occurred, return a handle to the new off-screen PixMap */
if (error != noErr)
{
if (newColors != nil)
: m_width(0)
, m_height(0)
, m_depth(0)
- , m_ok(FALSE)
+ , m_ok(false)
, m_numColors(0)
, m_quality(0)
{
bool wxBitmap::CreateFromXpm(const char **bits)
{
- wxCHECK_MSG( bits != NULL, FALSE, wxT("invalid bitmap data") )
+ wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") );
wxXPMDecoder decoder;
wxImage img = decoder.ReadData(bits);
- 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;
}
wxBitmap::wxBitmap(const char **bits)
if ( handler == NULL ) {
wxLogWarning(wxT("no bitmap handler for type %d defined."), type);
- return FALSE;
+ return false;
}
return handler->Create(this, data, type, width, height, depth);
wxBitmap::wxBitmap(const wxImage& image, int depth)
{
- wxCHECK_RET( image.Ok(), wxT("invalid image") )
- wxCHECK_RET( depth == -1, wxT("invalid bitmap depth") )
+ wxCHECK_RET( image.Ok(), wxT("invalid image") );
+ wxCHECK_RET( depth == -1, wxT("invalid bitmap depth") );
m_refData = new wxBitmapRefData();
return false;
}
-bool wxBitmap::Ok() const
+bool wxBitmap::IsOk() const
{
return (M_BITMAPDATA && M_BITMAPDATA->m_ok);
}
void wxBitmap::SetWidth(int w)
{
- if (!M_BITMAPDATA)
- m_refData = new wxBitmapRefData;
-
+ AllocExclusive();
M_BITMAPDATA->m_width = w;
}
void wxBitmap::SetHeight(int h)
{
- if (!M_BITMAPDATA)
- m_refData = new wxBitmapRefData;
-
+ AllocExclusive();
M_BITMAPDATA->m_height = h;
}
void wxBitmap::SetDepth(int d)
{
- if (!M_BITMAPDATA)
- m_refData = new wxBitmapRefData;
-
+ AllocExclusive();
M_BITMAPDATA->m_depth = d;
}
UnlockPixels( GetGWorldPixMap( (GWorldPtr) m_maskBitmap) );
UnlockPixels( GetGWorldPixMap( (GWorldPtr) bitmap.GetHBITMAP()) );
- return FALSE;
+ return false;
}
// Create a mask from a bitmap and a palette index indicating
{
// TODO
wxCHECK_MSG( 0, false, wxT("wxMask::Create not yet implemented"));
- return FALSE;
+ return false;
}
// Create a mask from a bitmap and a colour indicating
UnlockPixels( GetGWorldPixMap( (GWorldPtr) bitmap.GetHBITMAP() ) ) ;
SetGWorld( origPort , origDevice ) ;
- return TRUE;
+ return true;
}
bool wxMask::PointMasked(int x, int y)
bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth)
{
- return FALSE;
+ return false;
}
bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight)
{
- return FALSE;
+ return false;
}
bool wxBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette)
{
- return FALSE;
+ return false;
}
/*
M_BITMAPHANDLERDATA->m_numColors = theInfo.uniqueColors ;
// M_BITMAPHANDLERDATA->m_bitmapPalette;
// M_BITMAPHANDLERDATA->m_quality;
- return TRUE ;
+ return true ;
}
- return FALSE ;
+ return false ;
}
void wxBitmap::InitStandardHandlers()
// mask in UngetRawData()
M_BITMAPDATA->m_hasAlpha = true;
}
-