+
+#if wxUSE_IMAGE
+
+// ----------------------------------------------------------------------------
+// wxMacCoreGraphicsImageContext
+// ----------------------------------------------------------------------------
+
+// This is a GC that can be used to draw on wxImage. In this implementation we
+// simply draw on a wxBitmap using wxMemoryDC and then convert it to wxImage in
+// the end so it's not especially interesting and exists mainly for
+// compatibility with the other platforms.
+class wxMacCoreGraphicsImageContext : public wxMacCoreGraphicsContext
+{
+public:
+ wxMacCoreGraphicsImageContext(wxGraphicsRenderer* renderer,
+ wxImage& image) :
+ wxMacCoreGraphicsContext(renderer),
+ m_image(image),
+ m_bitmap(image),
+ m_memDC(m_bitmap)
+ {
+ SetNativeContext
+ (
+ (CGContextRef)(m_memDC.GetGraphicsContext()->GetNativeContext())
+ );
+ m_width = image.GetWidth();
+ m_height = image.GetHeight();
+ }
+
+ virtual ~wxMacCoreGraphicsImageContext()
+ {
+ m_memDC.SelectObject(wxNullBitmap);
+ m_image = m_bitmap.ConvertToImage();
+ }
+
+private:
+ wxImage& m_image;
+ wxBitmap m_bitmap;
+ wxMemoryDC m_memDC;
+};
+
+#endif // wxUSE_IMAGE
+