// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/setup.h"
-#include "wx/utils.h"
-#include "wx/palette.h"
+#include "wx/wxprec.h"
+#ifndef WX_PRECOMP
+ #include "wx/log.h"
+ #include "wx/utils.h"
+ #include "wx/palette.h"
+ #include "wx/icon.h"
+#endif //WX_PRECOMP
#include "wx/bitmap.h"
-#include "wx/icon.h"
-#include "wx/log.h"
#include "wx/image.h"
#include "wx/xpmdecod.h"
m_numColors = data.m_numColors;
m_bitmapPalette = data.m_bitmapPalette;
m_quality = data.m_quality;
- m_cocoaNSBitmapImageRep = data.m_cocoaNSBitmapImageRep;
- [m_cocoaNSBitmapImageRep retain];
+ m_cocoaNSBitmapImageRep = [data.m_cocoaNSBitmapImageRep copyWithZone:nil];
m_bitmapMask = data.m_bitmapMask?new wxMask(*data.m_bitmapMask):NULL;
}
wxBitmap::wxBitmap()
{
m_refData = NULL;
-
- if ( wxTheBitmapList )
- wxTheBitmapList->AddBitmap(this);
}
wxBitmap::~wxBitmap()
{
- if (wxTheBitmapList)
- wxTheBitmapList->DeleteObject(this);
}
wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits)
M_BITMAPDATA->m_numColors = 0;
/* TODO: create the bitmap from data */
-
- if ( wxTheBitmapList )
- wxTheBitmapList->AddBitmap(this);
}
wxBitmap::wxBitmap(int w, int h, int d)
{
(void)Create(w, h, d);
-
- if ( wxTheBitmapList )
- wxTheBitmapList->AddBitmap(this);
}
wxBitmap::wxBitmap(void *data, wxBitmapType type, int width, int height, int depth)
{
(void) Create(data, type, width, height, depth);
-
- if ( wxTheBitmapList )
- wxTheBitmapList->AddBitmap(this);
}
wxBitmap::wxBitmap(const wxString& filename, wxBitmapType type)
{
LoadFile(filename, type);
-
- if ( wxTheBitmapList )
- wxTheBitmapList->AddBitmap(this);
}
wxObjectRefData *wxBitmap::CreateRefData() const
return M_BITMAPDATA->m_cocoaNSBitmapImageRep;
}
+void wxBitmap::SetNSBitmapImageRep(WX_NSBitmapImageRep bitmapImageRep)
+{
+ if(!M_BITMAPDATA)
+ return;
+ // NOTE: No checking is done to make sure width/height agree
+ [bitmapImageRep retain];
+ [M_BITMAPDATA->m_cocoaNSBitmapImageRep release];
+ M_BITMAPDATA->m_cocoaNSBitmapImageRep = bitmapImageRep;
+}
+
void wxBitmap::SetWidth(int w)
{
if (!M_BITMAPDATA)
M_BITMAPDATA->m_depth = d;
/* TODO: create new bitmap */
+ M_BITMAPDATA->m_cocoaNSBitmapImageRep = [[NSBitmapImageRep alloc]
+ initWithBitmapDataPlanes: NULL
+ pixelsWide: w
+ pixelsHigh: h
+ bitsPerSample: 8
+ samplesPerPixel: 3
+ hasAlpha: NO
+ isPlanar: NO
+ colorSpaceName: NSCalibratedRGBColorSpace
+ bytesPerRow: 0
+ bitsPerPixel: 0];
+
+ wxLogDebug("M_BITMAPDATA=%p NSBitmapImageRep bitmapData=%p", M_BITMAPDATA, [M_BITMAPDATA->m_cocoaNSBitmapImageRep bitmapData]);
+ M_BITMAPDATA->m_ok = true;
+ M_BITMAPDATA->m_numColors = 0;
+ M_BITMAPDATA->m_quality = 0;
+ M_BITMAPDATA->m_bitmapMask = NULL;
return M_BITMAPDATA->m_ok;
}