#endif
#include "wx/metafile.h"
-#include "wx/xpmdecod.h"
-
#include "wx/rawbmp.h"
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
void Free();
void SetOk( bool isOk) { m_ok = isOk; }
+#if WXWIN_COMPATIBILITY_2_8
void SetWidth( int width ) { m_width = width; }
void SetHeight( int height ) { m_height = height; }
void SetDepth( int depth ) { m_depth = depth; }
+#endif
int GetWidth() const { return m_width; }
int GetHeight() const { return m_height; }
CGContextRef GetBitmapContext() const;
int GetBytesPerRow() const { return m_bytesPerRow; }
- private :
+private:
bool Create(int width , int height , int depth);
void Init();
m_depth = d ;
m_hBitmap = NULL ;
- m_bytesPerRow = GetBestBytesPerRow( w * 4 ) ;
- size_t size = m_bytesPerRow * h ;
+ m_bytesPerRow = GetBestBytesPerRow( m_width * 4 ) ;
+ size_t size = m_bytesPerRow * m_height ;
void* data = m_memBuf.GetWriteBuf( size ) ;
if ( data != NULL )
{
}
}
HUnlock( data );
+
OSStatus err = SetIconFamilyData( iconFamily, dataType , data );
- wxASSERT_MSG( err == noErr , wxT("Error when adding bitmap") );
+ if ( err != noErr )
+ {
+ wxFAIL_MSG("Error when adding bitmap");
+ }
+
DisposeHandle( data );
}
else
{
// setup the header properly
- Handle data = NULL ;
- Handle maskdata = NULL ;
- unsigned char * maskptr = NULL ;
- unsigned char * ptr = NULL ;
+ Handle data;
+ Handle maskdata;
+ unsigned char * maskptr;
+ unsigned char * ptr;
size_t datasize, masksize ;
datasize = sz * sz * 4 ;
err = GraphicsExportDoExport(exporter, NULL);
CGImageRelease( imageRef );
- size_t handleSize = GetHandleSize( (Handle) m_pictHandle );
- // the 512 bytes header is only needed for pict files, but not in memory
- if ( handleSize >= 512 )
- {
- memmove( *m_pictHandle , (char*)(*m_pictHandle)+512, handleSize - 512 );
- SetHandleSize( (Handle) m_pictHandle, handleSize - 512 );
- }
+ size_t handleSize = GetHandleSize( (Handle) m_pictHandle );
+ // the 512 bytes header is only needed for pict files, but not in memory
+ if ( handleSize >= 512 )
+ {
+ memmove( *m_pictHandle , (char*)(*m_pictHandle)+512, handleSize - 512 );
+ SetHandleSize( (Handle) m_pictHandle, handleSize - 512 );
+ }
}
CloseComponent( exporter );
}
Free() ;
}
+
+
+// ----------------------------------------------------------------------------
+// wxBitmap
+// ----------------------------------------------------------------------------
+
bool wxBitmap::CopyFromIcon(const wxIcon& icon)
{
bool created = false ;
return true;
}
-wxBitmap::wxBitmap()
-{
-}
-
-wxBitmap::~wxBitmap()
-{
-}
-
wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits)
{
wxBitmapRefData* bitmapRefData;
} /* bitmapRefData->IsOk() */
}
-wxBitmap::wxBitmap(int w, int h, int d)
-{
- (void)Create(w, h, d);
-}
-
wxBitmap::wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth)
{
(void) Create(data, type, width, height, depth);
}
#endif
-#if wxOSX_USE_COCOA_OR_IPHONE
+#if wxOSX_USE_COCOA
WX_NSImage wxBitmap::GetNSImage() const
{
#endif
+#if wxOSX_USE_IPHONE
+
+WX_UIImage wxBitmap::GetUIImage() const
+{
+ wxCFRef< CGImageRef > cgimage(CreateCGImage());
+ return wxOSXCreateUIImageFromCGImage( cgimage );
+}
+
+#endif
wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const
{
wxCHECK_MSG( Ok() &&
int height = image.GetHeight();
wxBitmapRefData* bitmapRefData;
-
+
m_refData = bitmapRefData = new wxBitmapRefData( width , height , depth ) ;
if ( bitmapRefData->IsOk())
return M_BITMAPDATA->HasAlpha() ;
}
+#if WXWIN_COMPATIBILITY_2_8
void wxBitmap::SetWidth(int w)
{
AllocExclusive();
AllocExclusive();
M_BITMAPDATA->SetDepth(d);
}
+#endif // WXWIN_COMPATIBILITY_2_8
void wxBitmap::SetOk(bool isOk)
{
// Standard Handlers
// ----------------------------------------------------------------------------
-#if !defined( __LP64__ ) && !defined(__WXOSX_IPHONE__)
+#if !defined( __LP64__ ) && !defined(__WXOSX_IPHONE__)
class WXDLLEXPORT wxPICTResourceHandler: public wxBitmapHandler
{
SetType(wxBITMAP_TYPE_PICT_RESOURCE);
};
- virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
- int desiredWidth, int desiredHeight);
+ virtual bool LoadFile(wxBitmap *bitmap,
+ const wxString& name,
+ wxBitmapType type,
+ int desiredWidth,
+ int desiredHeight);
};
IMPLEMENT_DYNAMIC_CLASS(wxPICTResourceHandler, wxBitmapHandler)
bool wxPICTResourceHandler::LoadFile(wxBitmap *bitmap,
const wxString& name,
- long WXUNUSED(flags),
+ wxBitmapType WXUNUSED(type),
int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight))
{