X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6762286db6cf974817dead5b88bebf0e390dbb7e..d642db66a5efc82d374b813022c72ba88bc50839:/include/wx/osx/bitmap.h diff --git a/include/wx/osx/bitmap.h b/include/wx/osx/bitmap.h index a9d2f3fe36..d6d973aeda 100644 --- a/include/wx/osx/bitmap.h +++ b/include/wx/osx/bitmap.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: bitmap.h +// Name: wx/osx/bitmap.h // Purpose: wxBitmap class // Author: Stefan Csomor // Modified by: @@ -57,6 +57,8 @@ public: bool Create(const wxBitmap& bitmap); bool Create(const wxMemoryBuffer& buf, int width , int height , int bytesPerRow ) ; + wxBitmap GetBitmap() const; + // Implementation below void Init() ; @@ -87,7 +89,7 @@ class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase friend class WXDLLIMPEXP_FWD_CORE wxBitmapHandler; public: - wxBitmap(); // Platform-specific + wxBitmap() {} // Platform-specific // Initialize with raw data. wxBitmap(const char bits[], int width, int height, int depth = 1); @@ -100,9 +102,18 @@ public: // Constructor for generalised creation from data wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1); - + + // creates an bitmap from the native image format + wxBitmap(CGImageRef image, double scale = 1.0); + wxBitmap(WX_NSImage image); + wxBitmap(CGContextRef bitmapcontext); + + // Create a bitmap compatible with the given DC + wxBitmap(int width, int height, const wxDC& dc); + // If depth is omitted, will create a bitmap compatible with the display - wxBitmap(int width, int height, int depth = -1); + wxBitmap(int width, int height, int depth = -1) { (void)Create(width, height, depth); } + wxBitmap(const wxSize& sz, int depth = -1) { (void)Create(sz, depth); } // Convert from wxImage: wxBitmap(const wxImage& image, int depth = -1); @@ -110,15 +121,28 @@ public: // Convert from wxIcon wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); } - virtual ~wxBitmap(); + virtual ~wxBitmap() {} wxImage ConvertToImage() const; // get the given part of bitmap wxBitmap GetSubBitmap( const wxRect& rect ) const; - virtual bool Create(int width, int height, int depth = -1); + virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); + virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) + { return Create(sz.GetWidth(), sz.GetHeight(), depth); } + virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1); + bool Create( CGImageRef image, double scale = 1.0 ); + bool Create( WX_NSImage image ); + bool Create( CGContextRef bitmapcontext); + + // Create a bitmap compatible with the given DC, inheriting its magnification factor + bool Create(int width, int height, const wxDC& dc); + + // Create a bitmap with a scale factor, width and height are multiplied with that factor + bool CreateScaled(int logwidth, int logheight, int depth, double logicalScale); + // virtual bool Create( WXHICON icon) ; virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const; @@ -162,9 +186,13 @@ public: // returns a CGImageRef which must released after usage with CGImageRelease CGImageRef CreateCGImage() const ; -#if wxOSX_USE_COCOA_OR_IPHONE +#if wxOSX_USE_COCOA // returns an autoreleased version of the image WX_NSImage GetNSImage() const; +#endif +#if wxOSX_USE_IPHONE + // returns an autoreleased version of the image + WX_UIImage GetUIImage() const; #endif // returns a IconRef which must be retained before and released after usage IconRef GetIconRef() const; @@ -177,6 +205,7 @@ public: void *BeginRawAccess() ; void EndRawAccess() ; + double GetScaleFactor() const; protected: virtual wxGDIRefData *CreateGDIRefData() const; virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;