]> git.saurik.com Git - wxWidgets.git/commitdiff
Added XPM ctor
authorJulian Smart <julian@anthemion.co.uk>
Mon, 28 Feb 2005 11:00:07 +0000 (11:00 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Mon, 28 Feb 2005 11:00:07 +0000 (11:00 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32453 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/image.h
src/common/image.cpp

index 14555d5800b629440414de4dad31dba5b523ddca..77a6cb84f36f47647197132c107cd4bbcdd9f7ef 100644 (file)
@@ -156,6 +156,8 @@ public:
     wxImage( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false );
     wxImage( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 );
     wxImage( const wxString& name, const wxString& mimetype, int index = -1 );
+    wxImage( const char** xpmData );
+    wxImage( char** xpmData );
 
 #if wxUSE_STREAMS
     wxImage( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1 );
@@ -168,6 +170,7 @@ public:
     bool Create( int width, int height, bool clear = true );
     bool Create( int width, int height, unsigned char* data, bool static_data = false );
     bool Create( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false );
+    bool Create( const char** xpmData );
     void Destroy();
 
     // creates an identical copy of the image (the = operator
index 204c4b665740e2ed47e4ea436eff91a85d85fdbb..2a8b2013ff0076ebd8afff5877a124c9dec08f2a 100644 (file)
 #include "wx/utils.h"
 #include "wx/math.h"
 
+#if wxUSE_XPM
+#include "wx/xpmdecod.h"
+#endif
+
 // For memcpy
 #include <string.h>
 
@@ -159,6 +163,29 @@ wxImage::wxImage( const wxImage* image )
     if (image) Ref(*image);
 }
 
+wxImage::wxImage( const char** xpmData )
+{
+    Create(xpmData);
+}
+
+wxImage::wxImage( char** xpmData )
+{
+    Create((const char**) xpmData);
+}
+
+bool wxImage::Create( const char** xpmData )
+{
+#if wxUSE_XPM
+    UnRef();
+    
+    wxXPMDecoder decoder;
+    (*this) = decoder.ReadData(xpmData);
+    return Ok();
+#else
+    return false;
+#endif
+}
+
 bool wxImage::Create( int width, int height, bool clear )
 {
     UnRef();