+class WXDLLEXPORT wxBitmapRefData: public wxGDIRefData
+{
+ friend class WXDLLIMPEXP_FWD_CORE wxIcon;
+ friend class WXDLLIMPEXP_FWD_CORE wxCursor;
+public:
+ wxBitmapRefData(int width , int height , int depth);
+ wxBitmapRefData();
+ wxBitmapRefData(const wxBitmapRefData &tocopy);
+
+ virtual ~wxBitmapRefData();
+
+ void Free();
+ bool Ok() const { return IsOk(); }
+ bool IsOk() const { return m_ok; }
+ void SetOk( bool isOk) { m_ok = isOk; }
+
+ void SetWidth( int width ) { m_width = width; }
+ void SetHeight( int height ) { m_height = height; }
+ void SetDepth( int depth ) { m_depth = depth; }
+
+ int GetWidth() const { return m_width; }
+ int GetHeight() const { return m_height; }
+ int GetDepth() const { return m_depth; }
+
+ void *GetRawAccess() const;
+ void *BeginRawAccess();
+ void EndRawAccess();
+
+ bool HasAlpha() const { return m_hasAlpha; }
+ void UseAlpha( bool useAlpha );
+
+public:
+#if wxUSE_PALETTE
+ wxPalette m_bitmapPalette;
+#endif // wxUSE_PALETTE
+
+ wxMask * m_bitmapMask; // Optional mask
+ CGImageRef CreateCGImage() const;
+
+ // returns true if the bitmap has a size that
+ // can be natively transferred into a true icon
+ // if no is returned GetIconRef will still produce
+ // an icon but it will be generated via a PICT and
+ // rescaled to 16 x 16
+ bool HasNativeSize();
+
+ // caller should increase ref count if needed longer
+ // than the bitmap exists
+ IconRef GetIconRef();
+
+ // returns a Pict from the bitmap content
+ PicHandle GetPictHandle();
+
+ CGContextRef GetBitmapContext() const;
+
+ int GetBytesPerRow() const { return m_bytesPerRow; }
+ private :
+ bool Create(int width , int height , int depth);
+ void Init();
+
+ int m_width;
+ int m_height;
+ int m_bytesPerRow;
+ int m_depth;
+ bool m_hasAlpha;
+ wxMemoryBuffer m_memBuf;
+ int m_rawAccessCount;
+ bool m_ok;
+ mutable CGImageRef m_cgImageRef;
+
+ IconRef m_iconRef;
+ PicHandle m_pictHandle;
+
+ CGContextRef m_hBitmap;
+};
+
+
+#define wxMAC_USE_PREMULTIPLIED_ALPHA 1
+static const int kBestByteAlignement = 16;
+static const int kMaskBytesPerPixel = 1;