1 /////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "bitmap.h"
18 #include "wx/palette.h"
19 #include "wx/bitmap.h"
28 #if !USE_SHARED_LIBRARIES
29 IMPLEMENT_DYNAMIC_CLASS(wxBitmap
, wxGDIObject
)
30 IMPLEMENT_DYNAMIC_CLASS(wxMask
, wxObject
)
33 #include <PictUtils.h>
35 CTabHandle
wxMacCreateColorTable( int numColors
)
37 CTabHandle newColors
; /* Handle to the new color table */
38 short index
; /* Index into the table of colors */
39 /* Allocate memory for the color table */
40 newColors
= (CTabHandle
)NewHandleClear( sizeof (ColorTable
) +
41 sizeof (ColorSpec
) * (numColors
- 1) );
44 /* Initialize the fields */
45 (**newColors
).ctSeed
= GetCTSeed();
46 (**newColors
).ctFlags
= 0;
47 (**newColors
).ctSize
= numColors
- 1;
48 /* Initialize the table of colors */
53 void wxMacDestroyColorTable( CTabHandle colors
)
55 DisposeHandle( (Handle
) colors
) ;
58 void wxMacSetColorTableEntry( CTabHandle newColors
, int index
, int red
, int green
, int blue
)
60 (**newColors
).ctTable
[index
].value
= index
;
61 (**newColors
).ctTable
[index
].rgb
.red
= 0 ;// someRedValue;
62 (**newColors
).ctTable
[index
].rgb
.green
= 0 ; // someGreenValue;
63 (**newColors
).ctTable
[index
].rgb
.blue
= 0 ; // someBlueValue;
66 GWorldPtr
wxMacCreateGWorld( int height
, int width
, int depth
)
70 Rect rect
= { 0 , 0 , width
, height
} ;
74 depth
= wxDisplayDepth() ;
77 err
= NewGWorld( &port
, depth
, &rect
, NULL
, NULL
, 0 ) ;
85 void wxMacDestroyGWorld( GWorldPtr gw
)
91 wxBitmapRefData::wxBitmapRefData()
102 m_bitmapType
= kMacBitmapTypeUnknownType
;
105 wxBitmapRefData::~wxBitmapRefData()
107 switch (m_bitmapType
)
109 case kMacBitmapTypePict
:
113 KillPicture( m_hPict
) ;
118 case kMacBitmapTypeGrafWorld
:
122 wxMacDestroyGWorld( m_hBitmap
) ;
139 wxList
wxBitmap::sm_handlers
;
145 if ( wxTheBitmapList
)
146 wxTheBitmapList
->AddBitmap(this);
149 wxBitmap::~wxBitmap()
152 wxTheBitmapList
->DeleteObject(this);
155 wxBitmap::wxBitmap(const char bits
[], int the_width
, int the_height
, int no_bits
)
157 m_refData
= new wxBitmapRefData
;
159 M_BITMAPDATA
->m_width
= the_width
;
160 M_BITMAPDATA
->m_height
= the_height
;
161 M_BITMAPDATA
->m_depth
= no_bits
;
162 M_BITMAPDATA
->m_numColors
= 0;
165 M_BITMAPDATA
->m_bitmapType
= kMacBitmapTypeGrafWorld
;
166 M_BITMAPDATA
->m_hBitmap
= wxMacCreateGWorld( the_width
, the_height
, no_bits
) ;
167 M_BITMAPDATA
->m_ok
= (M_BITMAPDATA
->m_hBitmap
!= NULL
) ;
170 GDHandle origDevice
;
172 GetGWorld( &origPort
, &origDevice
) ;
173 SetGWorld( M_BITMAPDATA
->m_hBitmap
, NULL
) ;
174 LockPixels( GetGWorldPixMap( (CGrafPtr
) M_BITMAPDATA
->m_hBitmap
) ) ;
176 // bits is a word aligned array
178 unsigned char* linestart
= (unsigned char*) bits
;
179 int linesize
= ( the_width
/ 16 ) * 2 ;
180 if ( the_width
% 16 )
185 RGBColor colors
[2] = {
186 { 0xFFFF , 0xFFFF , 0xFFFF } ,
190 for( int y
= 0 ; y
< the_height
; ++y
, linestart
+= linesize
)
192 for( int x
= 0 ; x
< the_width
; ++x
)
196 int mask
= 1 << bit
;
197 if ( linestart
[index
] & mask
)
199 SetCPixel( x
, y
, &colors
[1] ) ;
203 SetCPixel( x
, y
, &colors
[0] ) ;
208 UnlockPixels( GetGWorldPixMap( (CGrafPtr
) M_BITMAPDATA
->m_hBitmap
) ) ;
210 SetGWorld( origPort
, origDevice
) ;
214 //multicolor BITMAPs not yet implemented
217 if ( wxTheBitmapList
)
218 wxTheBitmapList
->AddBitmap(this);
221 wxBitmap::wxBitmap(int w
, int h
, int d
)
223 (void)Create(w
, h
, d
);
225 if ( wxTheBitmapList
)
226 wxTheBitmapList
->AddBitmap(this);
229 wxBitmap::wxBitmap(void *data
, long type
, int width
, int height
, int depth
)
231 (void) Create(data
, type
, width
, height
, depth
);
233 if ( wxTheBitmapList
)
234 wxTheBitmapList
->AddBitmap(this);
237 wxBitmap::wxBitmap(const wxString
& filename
, long type
)
239 LoadFile(filename
, (int)type
);
241 if ( wxTheBitmapList
)
242 wxTheBitmapList
->AddBitmap(this);
245 wxBitmap::wxBitmap(const char **data
)
247 (void) Create((void *)data
, wxBITMAP_TYPE_XPM_DATA
, 0, 0, 0);
250 bool wxBitmap::Create(int w
, int h
, int d
)
254 m_refData
= new wxBitmapRefData
;
256 M_BITMAPDATA
->m_width
= w
;
257 M_BITMAPDATA
->m_height
= h
;
258 M_BITMAPDATA
->m_depth
= d
;
260 M_BITMAPDATA
->m_bitmapType
= kMacBitmapTypeGrafWorld
;
261 M_BITMAPDATA
->m_hBitmap
= wxMacCreateGWorld( w
, h
, d
) ;
262 M_BITMAPDATA
->m_ok
= (M_BITMAPDATA
->m_hBitmap
!= NULL
) ;
263 return M_BITMAPDATA
->m_ok
;
266 void wxBitmap::SetHBITMAP(WXHBITMAP bmp
)
268 M_BITMAPDATA
->m_bitmapType
= kMacBitmapTypeGrafWorld
;
269 M_BITMAPDATA
->m_hBitmap
= bmp
;
270 M_BITMAPDATA
->m_ok
= (M_BITMAPDATA
->m_hBitmap
!= NULL
) ;
273 bool wxBitmap::LoadFile(const wxString
& filename
, long type
)
277 m_refData
= new wxBitmapRefData
;
279 wxBitmapHandler
*handler
= FindHandler(type
);
281 if ( handler
== NULL
) {
282 wxLogWarning("no bitmap handler for type %d defined.", type
);
287 return handler
->LoadFile(this, filename
, type
, -1, -1);
290 bool wxBitmap::Create(void *data
, long type
, int width
, int height
, int depth
)
294 m_refData
= new wxBitmapRefData
;
296 wxBitmapHandler
*handler
= FindHandler(type
);
298 if ( handler
== NULL
) {
299 wxLogWarning("no bitmap handler for type %d defined.", type
);
304 return handler
->Create(this, data
, type
, width
, height
, depth
);
307 bool wxBitmap::SaveFile(const wxString
& filename
, int type
, const wxPalette
*palette
)
309 wxBitmapHandler
*handler
= FindHandler(type
);
311 if ( handler
== NULL
) {
312 wxLogWarning("no bitmap handler for type %d defined.", type
);
317 return handler
->SaveFile(this, filename
, type
, palette
);
320 void wxBitmap::SetWidth(int w
)
323 m_refData
= new wxBitmapRefData
;
325 M_BITMAPDATA
->m_width
= w
;
328 void wxBitmap::SetHeight(int h
)
331 m_refData
= new wxBitmapRefData
;
333 M_BITMAPDATA
->m_height
= h
;
336 void wxBitmap::SetDepth(int d
)
339 m_refData
= new wxBitmapRefData
;
341 M_BITMAPDATA
->m_depth
= d
;
344 void wxBitmap::SetQuality(int q
)
347 m_refData
= new wxBitmapRefData
;
349 M_BITMAPDATA
->m_quality
= q
;
352 void wxBitmap::SetOk(bool isOk
)
355 m_refData
= new wxBitmapRefData
;
357 M_BITMAPDATA
->m_ok
= isOk
;
360 void wxBitmap::SetPalette(const wxPalette
& palette
)
363 m_refData
= new wxBitmapRefData
;
365 M_BITMAPDATA
->m_bitmapPalette
= palette
;
368 void wxBitmap::SetMask(wxMask
*mask
)
371 m_refData
= new wxBitmapRefData
;
373 M_BITMAPDATA
->m_bitmapMask
= mask
;
376 void wxBitmap::AddHandler(wxBitmapHandler
*handler
)
378 sm_handlers
.Append(handler
);
381 void wxBitmap::InsertHandler(wxBitmapHandler
*handler
)
383 sm_handlers
.Insert(handler
);
386 bool wxBitmap::RemoveHandler(const wxString
& name
)
388 wxBitmapHandler
*handler
= FindHandler(name
);
391 sm_handlers
.DeleteObject(handler
);
398 wxBitmapHandler
*wxBitmap::FindHandler(const wxString
& name
)
400 wxNode
*node
= sm_handlers
.First();
403 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
404 if ( handler
->GetName() == name
)
411 wxBitmapHandler
*wxBitmap::FindHandler(const wxString
& extension
, long bitmapType
)
413 wxNode
*node
= sm_handlers
.First();
416 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
417 if ( handler
->GetExtension() == extension
&&
418 (bitmapType
== -1 || handler
->GetType() == bitmapType
) )
425 wxBitmapHandler
*wxBitmap::FindHandler(long bitmapType
)
427 wxNode
*node
= sm_handlers
.First();
430 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
431 if (handler
->GetType() == bitmapType
)
447 // Construct a mask from a bitmap and a colour indicating
448 // the transparent area
449 wxMask::wxMask(const wxBitmap
& bitmap
, const wxColour
& colour
)
452 Create(bitmap
, colour
);
455 // Construct a mask from a bitmap and a palette index indicating
456 // the transparent area
457 wxMask::wxMask(const wxBitmap
& bitmap
, int paletteIndex
)
460 Create(bitmap
, paletteIndex
);
463 // Construct a mask from a mono bitmap (copies the bitmap).
464 wxMask::wxMask(const wxBitmap
& bitmap
)
474 wxMacDestroyGWorld( m_maskBitmap
) ;
475 m_maskBitmap
= NULL
;
479 // Create a mask from a mono bitmap (copies the bitmap).
480 bool wxMask::Create(const wxBitmap
& bitmap
)
486 // Create a mask from a bitmap and a palette index indicating
487 // the transparent area
488 bool wxMask::Create(const wxBitmap
& bitmap
, int paletteIndex
)
494 // Create a mask from a bitmap and a colour indicating
495 // the transparent area
496 bool wxMask::Create(const wxBitmap
& bitmap
, const wxColour
& colour
)
500 wxMacDestroyGWorld( m_maskBitmap
) ;
501 m_maskBitmap
= NULL
;
503 wxASSERT( ((wxBitmapRefData
*) bitmap
.GetRefData())->m_bitmapType
== kMacBitmapTypeGrafWorld
) ;
504 // other types would require a temporary bitmap. not yet implemented
511 m_maskBitmap
= wxMacCreateGWorld( bitmap
.GetWidth() , bitmap
.GetHeight() , 1 ) ;
512 LockPixels( GetGWorldPixMap( (CGrafPtr
) m_maskBitmap
) ) ;
513 LockPixels( GetGWorldPixMap( (CGrafPtr
) ((wxBitmapRefData
*) bitmap
.GetRefData())->m_hBitmap
) ) ;
514 RGBColor maskColor
= colour
.GetPixel() ;
516 // this is not very efficient, but I can't think
517 // of a better way of doing it
519 GDHandle origDevice
;
521 GetGWorld( &origPort
, &origDevice
) ;
522 for (int w
= 0; w
< bitmap
.GetWidth(); w
++)
524 for (int h
= 0; h
< bitmap
.GetHeight(); h
++)
526 RGBColor colors
[2] = {
527 { 0xFFFF , 0xFFFF , 0xFFFF } ,
531 SetGWorld( ((wxBitmapRefData
*) bitmap
.GetRefData())->m_hBitmap
, NULL
) ;
533 GetCPixel( w
, h
, &col
) ;
534 SetGWorld( m_maskBitmap
, NULL
) ;
535 if (col
.red
== maskColor
.red
&& col
.blue
== maskColor
.blue
&& col
.green
== maskColor
.green
)
537 SetCPixel( w
, h
, &colors
[0] ) ;
541 SetCPixel( w
, h
, &colors
[1] ) ;
545 UnlockPixels( GetGWorldPixMap( (CGrafPtr
) m_maskBitmap
) ) ;
546 UnlockPixels( GetGWorldPixMap( ((wxBitmapRefData
*) bitmap
.GetRefData())->m_hBitmap
) ) ;
547 SetGWorld( origPort
, origDevice
) ;
556 IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler
, wxObject
)
558 bool wxBitmapHandler::Create(wxBitmap
*bitmap
, void *data
, long type
, int width
, int height
, int depth
)
563 bool wxBitmapHandler::LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long type
,
564 int desiredWidth
, int desiredHeight
)
569 bool wxBitmapHandler::SaveFile(wxBitmap
*bitmap
, const wxString
& name
, int type
, const wxPalette
*palette
)
578 class WXDLLEXPORT wxPICTResourceHandler
: public wxBitmapHandler
580 DECLARE_DYNAMIC_CLASS(wxPICTResourceHandler
)
582 inline wxPICTResourceHandler()
584 m_name
= "Macintosh Pict resource";
586 m_type
= wxBITMAP_TYPE_PICT_RESOURCE
;
589 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
590 int desiredWidth
, int desiredHeight
);
592 IMPLEMENT_DYNAMIC_CLASS(wxPICTResourceHandler
, wxBitmapHandler
)
594 bool wxPICTResourceHandler::LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
595 int desiredWidth
, int desiredHeight
)
599 strcpy( (char*) theName
, name
) ;
600 c2pstr( (char*) theName
) ;
602 PicHandle thePict
= (PicHandle
) GetNamedResource( 'PICT' , theName
) ;
607 GetPictInfo( thePict
, &theInfo
, 0 , 0 , systemMethod
, 0 ) ;
608 DetachResource( (Handle
) thePict
) ;
609 M_BITMAPHANDLERDATA
->m_bitmapType
= kMacBitmapTypePict
;
610 M_BITMAPHANDLERDATA
->m_hPict
= thePict
;
611 M_BITMAPHANDLERDATA
->m_width
= theInfo
.sourceRect
.right
- theInfo
.sourceRect
.left
;
612 M_BITMAPHANDLERDATA
->m_height
= theInfo
.sourceRect
.bottom
- theInfo
.sourceRect
.top
;
614 M_BITMAPHANDLERDATA
->m_depth
= theInfo
.depth
;
615 M_BITMAPHANDLERDATA
->m_ok
= true ;
616 M_BITMAPHANDLERDATA
->m_numColors
= theInfo
.uniqueColors
;
617 // M_BITMAPHANDLERDATA->m_bitmapPalette;
618 // M_BITMAPHANDLERDATA->m_quality;
624 /* TODO: bitmap handlers, a bit like this:
625 class WXDLLEXPORT wxBMPResourceHandler: public wxBitmapHandler
627 DECLARE_DYNAMIC_CLASS(wxBMPResourceHandler)
629 inline wxBMPResourceHandler()
631 m_name = "Windows bitmap resource";
633 m_type = wxBITMAP_TYPE_BMP_RESOURCE;
636 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
637 int desiredWidth, int desiredHeight);
639 IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler)
642 class WXDLLEXPORT wxXPMFileHandler
: public wxBitmapHandler
644 DECLARE_DYNAMIC_CLASS(wxXPMFileHandler
)
646 inline wxXPMFileHandler(void)
648 m_name
= "XPM bitmap file";
650 m_type
= wxBITMAP_TYPE_XPM
;
653 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
654 int desiredWidth
= -1, int desiredHeight
= -1);
655 virtual bool SaveFile(wxBitmap
*bitmap
, const wxString
& name
, int type
, const wxPalette
*palette
= NULL
);
657 IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler
, wxBitmapHandler
)
659 bool wxXPMFileHandler::LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
660 int desiredWidth
, int desiredHeight
)
664 XpmAttributes xpmAttr
;
667 M_BITMAPHANDLERDATA
->m_ok
= FALSE
;
668 dc
= CreateCompatibleDC(NULL
);
671 xpmAttr
.valuemask
= XpmReturnPixels
;
672 int errorStatus
= XpmReadFileToImage(&dc
, WXSTRINGCAST name
, &ximage
, (XImage
**) NULL
, &xpmAttr
);
674 if (errorStatus
== XpmSuccess
)
676 M_BITMAPHANDLERDATA
->m_hBitmap
= (WXHBITMAP
) ximage
->bitmap
;
679 GetObject((HBITMAP
)M_BITMAPHANDLERDATA
->m_hBitmap
, sizeof(bm
), (LPSTR
) & bm
);
681 M_BITMAPHANDLERDATA
->m_width
= (bm
.bmWidth
);
682 M_BITMAPHANDLERDATA
->m_height
= (bm
.bmHeight
);
683 M_BITMAPHANDLERDATA
->m_depth
= (bm
.bmPlanes
* bm
.bmBitsPixel
);
684 M_BITMAPHANDLERDATA
->m_numColors
= xpmAttr
.npixels
;
685 XpmFreeAttributes(&xpmAttr
);
688 M_BITMAPHANDLERDATA
->m_ok
= TRUE
;
693 M_BITMAPHANDLERDATA
->m_ok
= FALSE
;
702 bool wxXPMFileHandler::SaveFile(wxBitmap
*bitmap
, const wxString
& name
, int type
, const wxPalette
*palette
)
707 Visual
*visual
= NULL
;
710 dc
= CreateCompatibleDC(NULL
);
713 if (SelectObject(dc
, (HBITMAP
) M_BITMAPHANDLERDATA
->m_hBitmap
))
716 ximage
.width
= M_BITMAPHANDLERDATA
->m_width
;
717 ximage
.height
= M_BITMAPHANDLERDATA
->m_height
;
718 ximage
.depth
= M_BITMAPHANDLERDATA
->m_depth
;
719 ximage
.bitmap
= (void *)M_BITMAPHANDLERDATA
->m_hBitmap
;
720 int errorStatus
= XpmWriteFileFromImage(&dc
, WXSTRINGCAST name
,
721 &ximage
, (XImage
*) NULL
, (XpmAttributes
*) NULL
);
726 if (errorStatus
== XpmSuccess
)
738 class WXDLLEXPORT wxXPMDataHandler
: public wxBitmapHandler
740 DECLARE_DYNAMIC_CLASS(wxXPMDataHandler
)
742 inline wxXPMDataHandler(void)
744 m_name
= "XPM bitmap data";
746 m_type
= wxBITMAP_TYPE_XPM_DATA
;
749 virtual bool Create(wxBitmap
*bitmap
, void *data
, long flags
, int width
, int height
, int depth
= 1);
751 IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler
, wxBitmapHandler
)
753 bool wxXPMDataHandler::Create(wxBitmap
*bitmap
, void *data
, long flags
, int width
, int height
, int depth
)
755 XImage
* ximage
= NULL
;
756 XImage
* xshapeimage
= NULL
;
758 XpmAttributes xpmAttr
;
760 xpmAttr
.valuemask
= XpmReturnInfos
; // get infos back
761 ErrorStatus
= XpmCreateImageFromData( GetMainDevice() , (char **)data
,
762 &ximage
, &xshapeimage
, &xpmAttr
);
764 if (ErrorStatus
== XpmSuccess
)
766 M_BITMAPHANDLERDATA
->m_ok
= FALSE
;
767 M_BITMAPHANDLERDATA
->m_numColors
= 0;
768 M_BITMAPHANDLERDATA
->m_hBitmap
= ximage
->gworldptr
;
770 M_BITMAPHANDLERDATA
->m_width
= ximage
->width
;
771 M_BITMAPHANDLERDATA
->m_height
= ximage
->height
;
772 M_BITMAPHANDLERDATA
->m_depth
= ximage
->depth
;
773 M_BITMAPHANDLERDATA
->m_numColors
= xpmAttr
.npixels
;
774 XpmFreeAttributes(&xpmAttr
);
775 M_BITMAPHANDLERDATA
->m_ok
= TRUE
;
776 ximage
->gworldptr
= NULL
;
777 XImageFree(ximage
); // releases the malloc, but does not detroy
779 M_BITMAPHANDLERDATA
->m_bitmapType
= kMacBitmapTypeGrafWorld
;
780 if ( xshapeimage
!= NULL
)
782 wxMask
* m
= new wxMask() ;
783 m
->SetMaskBitmap( xshapeimage
->gworldptr
) ;
784 M_BITMAPHANDLERDATA
->m_bitmapMask
= m
;
790 M_BITMAPHANDLERDATA
->m_ok
= FALSE
;
796 class WXDLLEXPORT wxBMPResourceHandler
: public wxBitmapHandler
798 DECLARE_DYNAMIC_CLASS(wxBMPResourceHandler
)
800 inline wxBMPResourceHandler()
802 m_name
= "Windows bitmap resource";
804 m_type
= wxBITMAP_TYPE_BMP_RESOURCE
;
807 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
808 int desiredWidth
, int desiredHeight
);
811 IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler
, wxBitmapHandler
)
813 bool wxBMPResourceHandler::LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
814 int desiredWidth
, int desiredHeight
)
816 // TODO: load colourmap.
817 // it's probably not found
818 wxLogError("Can't load bitmap '%s' from resources! Check .rc file.", name
.c_str());
823 class WXDLLEXPORT wxBMPFileHandler
: public wxBitmapHandler
825 DECLARE_DYNAMIC_CLASS(wxBMPFileHandler
)
827 inline wxBMPFileHandler(void)
829 m_name
= "Windows bitmap file";
831 m_type
= wxBITMAP_TYPE_BMP
;
834 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
835 int desiredWidth
, int desiredHeight
);
836 virtual bool SaveFile(wxBitmap
*bitmap
, const wxString
& name
, int type
, const wxPalette
*palette
= NULL
);
839 IMPLEMENT_DYNAMIC_CLASS(wxBMPFileHandler
, wxBitmapHandler
)
841 bool wxBMPFileHandler::LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
842 int desiredWidth
, int desiredHeight
)
844 #if USE_IMAGE_LOADING_IN_MSW
845 wxPalette
*palette
= NULL
;
846 bool success
= FALSE
;
847 success
= (wxLoadIntoBitmap(WXSTRINGCAST name
, bitmap
, &palette
) != 0);
848 if (!success
&& palette
)
854 M_BITMAPHANDLERDATA
->m_bitmapPalette
= *palette
;
861 bool wxBMPFileHandler::SaveFile(wxBitmap
*bitmap
, const wxString
& name
, int type
, const wxPalette
*pal
)
863 #if USE_IMAGE_LOADING_IN_MSW
864 wxPalette
*actualPalette
= (wxPalette
*)pal
;
865 if (!actualPalette
&& (!M_BITMAPHANDLERDATA
->m_bitmapPalette
.IsNull()))
866 actualPalette
= & (M_BITMAPHANDLERDATA
->m_bitmapPalette
);
867 return (wxSaveBitmap(WXSTRINGCAST name
, bitmap
, actualPalette
) != 0);
874 void wxBitmap::CleanUpHandlers()
876 wxNode
*node
= sm_handlers
.First();
879 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
880 wxNode
*next
= node
->Next();
887 void wxBitmap::InitStandardHandlers()
889 AddHandler( new wxPICTResourceHandler
) ;
890 AddHandler( new wxICONResourceHandler
) ;
891 AddHandler(new wxXPMFileHandler
);
892 AddHandler(new wxXPMDataHandler
);
893 AddHandler(new wxBMPResourceHandler
);
894 AddHandler(new wxBMPFileHandler
);