X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/650c0aa9180563eece310851973171cfaac83ad8..5a1e0e91a1ca5ec98b0eeb335cda757d1261ed08:/src/cocoa/bitmap.mm?ds=sidebyside diff --git a/src/cocoa/bitmap.mm b/src/cocoa/bitmap.mm index ff0cb8cd36..b16ba01087 100644 --- a/src/cocoa/bitmap.mm +++ b/src/cocoa/bitmap.mm @@ -519,6 +519,13 @@ wxMask::wxMask(const wxBitmap& bitmap) Create(bitmap); } +// Copy constructor +wxMask::wxMask(const wxMask& src) +: wxObject(src) +, m_cocoaNSBitmapImageRep([src.m_cocoaNSBitmapImageRep retain]) +{ +} + wxMask::~wxMask() { [m_cocoaNSBitmapImageRep release]; @@ -528,6 +535,7 @@ wxMask::~wxMask() bool wxMask::Create(const wxBitmap& bitmap) { // TODO + wxLogDebug("Cannot yet create a mask from a mono bitmap"); return FALSE; } @@ -536,6 +544,7 @@ bool wxMask::Create(const wxBitmap& bitmap) bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex) { // TODO + wxLogDebug("Cannot yet create a mask from a palette bitmap"); return FALSE; } @@ -642,6 +651,14 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) wxCHECK_MSG(wxMask_CreateFromBitmapData(pixelData, colour, dstData), false, wxT("Unable to access raw data")); } + else if([srcBitmapRep bitsPerPixel]==8 && [srcBitmapRep bitsPerSample]==8 && [srcBitmapRep samplesPerPixel]==1 && [srcBitmapRep hasAlpha]==NO) + // 8-bpp Grayscale, no alpha + { // Force all RGB to access the same grayscale component + typedef wxPixelFormat PixelFormat; + wxPixelData pixelData(const_cast(bitmap)); + wxCHECK_MSG(wxMask_CreateFromBitmapData(pixelData, colour, dstData), + false, wxT("Unable to access raw data")); + } else { wxCHECK_MSG(false,false,wxT("Unimplemented pixel format")); }