// we don't dare premultiplied alpha yet
#define wxMAC_USE_PREMULTIPLIED_ALPHA 0
+#if wxUSE_BMPBUTTON
+
void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType )
{
memset( info , 0 , sizeof(ControlButtonContentInfo) ) ;
}
}
+#endif //wxUSE_BMPBUTTON
+
#define M_BITMAPDATA ((wxBitmapRefData *)m_refData)
void wxBitmapRefData::Init()
// transform into IconRef
static int iconCounter = 2 ;
- OSStatus err = RegisterIconRefFromIconFamily( 'WXNG' , (OSType) iconCounter, iconFamily, &m_iconRef ) ;
+#ifdef __WXDEBUG__
+ OSStatus err =
+#endif
+ RegisterIconRefFromIconFamily( 'WXNG' , (OSType) iconCounter, iconFamily, &m_iconRef ) ;
wxASSERT_MSG( err == noErr , wxT("Error when adding bitmap") ) ;
// we have to retain a reference, as Unregister will decrement it
AcquireIconRef( m_iconRef ) ;
return m_pictHandle ;
}
-#if wxMAC_USE_CORE_GRAPHICS
+#ifdef __WXMAC_OSX__
void wxMacMemoryBufferReleaseProc(void *info, const void *data, size_t size)
{
wxMemoryBuffer* membuf = (wxMemoryBuffer*) info ;
bool wxBitmap::CreateFromXpm(const char **bits)
{
+#if wxUSE_IMAGE
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") )
*this = wxBitmap(img);
return TRUE;
+#else
+ return FALSE;
+#endif
}
-#if wxMAC_USE_CORE_GRAPHICS
+#ifdef __WXMAC_OSX__
WXCGIMAGEREF wxBitmap::CGImageCreate() const
{
wxCHECK_MSG( Ok(), NULL , wxT("invalid bitmap") ) ;
}
else
{
+#if wxUSE_IMAGE
wxImage loadimage(filename, type);
if (loadimage.Ok()) {
*this = loadimage;
return true;
}
+#endif
}
wxLogWarning(wxT("no bitmap handler for type %d defined."), type);
return false;
return handler->Create(this, data, type, width, height, depth);
}
+#if wxUSE_IMAGE
+
wxBitmap::wxBitmap(const wxImage& image, int depth)
{
wxCHECK_RET( image.Ok(), wxT("invalid image") )
bool hasAlpha = false ;
bool hasMask = false ;
+ int maskBytesPerRow = 0 ;
unsigned char *alpha = NULL ;
unsigned char *mask = NULL ;
if ( HasAlpha() )
{
hasMask = true ;
mask = (unsigned char*) GetMask()->GetRawAccess() ;
+ maskBytesPerRow = GetMask()->GetBytesPerRow() ;
}
if ( hasAlpha )
static const int MASK_BLUE = 3;
static const int MASK_BLUE_REPLACEMENT = 2;
- for (int yy = 0; yy < height; yy++)
+ for (int yy = 0; yy < height; yy++ , mask += maskBytesPerRow )
{
+ unsigned char * maskp = mask ;
for (int xx = 0; xx < width; xx++)
{
long color = *((long*) source) ;
unsigned char b = (color&0x000000FF);
if ( hasMask )
{
- if ( *mask++ == 0 )
+ if ( *maskp++ == 0 )
{
if ( r == MASK_RED && g == MASK_GREEN && b == MASK_BLUE )
b = MASK_BLUE_REPLACEMENT ;
return image;
}
+#endif //wxUSE_IMAGE
bool wxBitmap::SaveFile(const wxString& filename, wxBitmapType type,
const wxPalette *palette) const
}
else
{
+#if wxUSE_IMAGE
wxImage image = ConvertToImage();
-
return image.SaveFile(filename, type);
+#endif
}
wxLogWarning(wxT("no bitmap handler for type %d defined."), type);