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 IMPLEMENT_DYNAMIC_CLASS(wxBitmap
, wxGDIObject
)
29 IMPLEMENT_DYNAMIC_CLASS(wxMask
, wxObject
)
31 #include <PictUtils.h>
33 CTabHandle
wxMacCreateColorTable( int numColors
)
35 CTabHandle newColors
; /* Handle to the new color table */
36 short index
; /* Index into the table of colors */
37 /* Allocate memory for the color table */
38 newColors
= (CTabHandle
)NewHandleClear( sizeof (ColorTable
) +
39 sizeof (ColorSpec
) * (numColors
- 1) );
42 /* Initialize the fields */
43 (**newColors
).ctSeed
= GetCTSeed();
44 (**newColors
).ctFlags
= 0;
45 (**newColors
).ctSize
= numColors
- 1;
46 /* Initialize the table of colors */
51 void wxMacDestroyColorTable( CTabHandle colors
)
53 DisposeHandle( (Handle
) colors
) ;
56 void wxMacSetColorTableEntry( CTabHandle newColors
, int index
, int red
, int green
, int blue
)
58 (**newColors
).ctTable
[index
].value
= index
;
59 (**newColors
).ctTable
[index
].rgb
.red
= 0 ;// someRedValue;
60 (**newColors
).ctTable
[index
].rgb
.green
= 0 ; // someGreenValue;
61 (**newColors
).ctTable
[index
].rgb
.blue
= 0 ; // someBlueValue;
64 GWorldPtr
wxMacCreateGWorld( int height
, int width
, int depth
)
68 Rect rect
= { 0 , 0 , width
, height
} ;
72 // get max pixel depth
74 GetCWMgrPort( &port
) ;
77 maxDevice
= GetMaxDevice( &port
->portRect
) ;
79 depth
= (**((**maxDevice
).gdPMap
)).pixelSize
;
84 err
= NewGWorld( &port
, depth
, &rect
, NULL
, NULL
, 0 ) ;
92 void wxMacDestroyGWorld( GWorldPtr gw
)
98 wxBitmapRefData::wxBitmapRefData()
109 m_bitmapType
= kMacBitmapTypeUnknownType
;
112 wxBitmapRefData::~wxBitmapRefData()
114 switch (m_bitmapType
)
116 case kMacBitmapTypePict
:
120 KillPicture( m_hPict
) ;
125 case kMacBitmapTypeGrafWorld
:
129 wxMacDestroyGWorld( m_hBitmap
) ;
146 wxList
wxBitmap::sm_handlers
;
152 if ( wxTheBitmapList
)
153 wxTheBitmapList
->AddBitmap(this);
156 wxBitmap::~wxBitmap()
159 wxTheBitmapList
->DeleteObject(this);
162 wxBitmap::wxBitmap(const char bits
[], int the_width
, int the_height
, int no_bits
)
164 m_refData
= new wxBitmapRefData
;
166 M_BITMAPDATA
->m_width
= the_width
;
167 M_BITMAPDATA
->m_height
= the_height
;
168 M_BITMAPDATA
->m_depth
= no_bits
;
169 M_BITMAPDATA
->m_numColors
= 0;
172 M_BITMAPDATA
->m_bitmapType
= kMacBitmapTypeGrafWorld
;
173 M_BITMAPDATA
->m_hBitmap
= wxMacCreateGWorld( the_width
, the_height
, no_bits
) ;
174 M_BITMAPDATA
->m_ok
= (M_BITMAPDATA
->m_hBitmap
!= NULL
) ;
177 GDHandle origDevice
;
179 GetGWorld( &origPort
, &origDevice
) ;
180 SetGWorld( M_BITMAPDATA
->m_hBitmap
, NULL
) ;
182 // bits is a word aligned array
184 unsigned char* linestart
= (unsigned char*) bits
;
185 int linesize
= ( the_width
/ 16 ) * 2 ;
186 if ( the_width
% 16 )
191 RGBColor colors
[2] = {
192 { 0xFFFF , 0xFFFF , 0xFFFF } ,
196 for( int y
= 0 ; y
< the_height
; ++y
, linestart
+= linesize
)
198 for( int x
= 0 ; x
< the_width
; ++x
)
202 int mask
= 1 << bit
;
203 if ( linestart
[index
] & mask
)
205 SetCPixel( x
, y
, &colors
[1] ) ;
209 SetCPixel( x
, y
, &colors
[0] ) ;
215 SetGWorld( origPort
, origDevice
) ;
219 //multicolor BITMAPs not yet implemented
222 if ( wxTheBitmapList
)
223 wxTheBitmapList
->AddBitmap(this);
226 wxBitmap::wxBitmap(int w
, int h
, int d
)
228 (void)Create(w
, h
, d
);
230 if ( wxTheBitmapList
)
231 wxTheBitmapList
->AddBitmap(this);
234 wxBitmap::wxBitmap(void *data
, long type
, int width
, int height
, int depth
)
236 (void) Create(data
, type
, width
, height
, depth
);
238 if ( wxTheBitmapList
)
239 wxTheBitmapList
->AddBitmap(this);
242 wxBitmap::wxBitmap(const wxString
& filename
, long type
)
244 LoadFile(filename
, (int)type
);
246 if ( wxTheBitmapList
)
247 wxTheBitmapList
->AddBitmap(this);
250 wxBitmap::wxBitmap(const char **data
)
252 (void) Create((void *)data
, wxBITMAP_TYPE_XPM_DATA
, 0, 0, 0);
255 bool wxBitmap::Create(int w
, int h
, int d
)
259 m_refData
= new wxBitmapRefData
;
261 M_BITMAPDATA
->m_width
= w
;
262 M_BITMAPDATA
->m_height
= h
;
263 M_BITMAPDATA
->m_depth
= d
;
265 M_BITMAPDATA
->m_bitmapType
= kMacBitmapTypeGrafWorld
;
266 M_BITMAPDATA
->m_hBitmap
= wxMacCreateGWorld( w
, h
, d
) ;
267 M_BITMAPDATA
->m_ok
= (M_BITMAPDATA
->m_hBitmap
!= NULL
) ;
268 return M_BITMAPDATA
->m_ok
;
271 void wxBitmap::SetHBITMAP(WXHBITMAP bmp
)
273 M_BITMAPDATA
->m_bitmapType
= kMacBitmapTypeGrafWorld
;
274 M_BITMAPDATA
->m_hBitmap
= bmp
;
275 M_BITMAPDATA
->m_ok
= (M_BITMAPDATA
->m_hBitmap
!= NULL
) ;
278 bool wxBitmap::LoadFile(const wxString
& filename
, long type
)
282 m_refData
= new wxBitmapRefData
;
284 wxBitmapHandler
*handler
= FindHandler(type
);
286 if ( handler
== NULL
) {
287 wxLogWarning("no bitmap handler for type %d defined.", type
);
292 return handler
->LoadFile(this, filename
, type
, -1, -1);
295 bool wxBitmap::Create(void *data
, long type
, int width
, int height
, int depth
)
299 m_refData
= new wxBitmapRefData
;
301 wxBitmapHandler
*handler
= FindHandler(type
);
303 if ( handler
== NULL
) {
304 wxLogWarning("no bitmap handler for type %d defined.", type
);
309 return handler
->Create(this, data
, type
, width
, height
, depth
);
312 bool wxBitmap::SaveFile(const wxString
& filename
, int type
, const wxPalette
*palette
)
314 wxBitmapHandler
*handler
= FindHandler(type
);
316 if ( handler
== NULL
) {
317 wxLogWarning("no bitmap handler for type %d defined.", type
);
322 return handler
->SaveFile(this, filename
, type
, palette
);
325 void wxBitmap::SetWidth(int w
)
328 m_refData
= new wxBitmapRefData
;
330 M_BITMAPDATA
->m_width
= w
;
333 void wxBitmap::SetHeight(int h
)
336 m_refData
= new wxBitmapRefData
;
338 M_BITMAPDATA
->m_height
= h
;
341 void wxBitmap::SetDepth(int d
)
344 m_refData
= new wxBitmapRefData
;
346 M_BITMAPDATA
->m_depth
= d
;
349 void wxBitmap::SetQuality(int q
)
352 m_refData
= new wxBitmapRefData
;
354 M_BITMAPDATA
->m_quality
= q
;
357 void wxBitmap::SetOk(bool isOk
)
360 m_refData
= new wxBitmapRefData
;
362 M_BITMAPDATA
->m_ok
= isOk
;
365 void wxBitmap::SetPalette(const wxPalette
& palette
)
368 m_refData
= new wxBitmapRefData
;
370 M_BITMAPDATA
->m_bitmapPalette
= palette
;
373 void wxBitmap::SetMask(wxMask
*mask
)
376 m_refData
= new wxBitmapRefData
;
378 M_BITMAPDATA
->m_bitmapMask
= mask
;
381 void wxBitmap::AddHandler(wxBitmapHandler
*handler
)
383 sm_handlers
.Append(handler
);
386 void wxBitmap::InsertHandler(wxBitmapHandler
*handler
)
388 sm_handlers
.Insert(handler
);
391 bool wxBitmap::RemoveHandler(const wxString
& name
)
393 wxBitmapHandler
*handler
= FindHandler(name
);
396 sm_handlers
.DeleteObject(handler
);
403 wxBitmapHandler
*wxBitmap::FindHandler(const wxString
& name
)
405 wxNode
*node
= sm_handlers
.First();
408 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
409 if ( handler
->GetName() == name
)
416 wxBitmapHandler
*wxBitmap::FindHandler(const wxString
& extension
, long bitmapType
)
418 wxNode
*node
= sm_handlers
.First();
421 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
422 if ( handler
->GetExtension() == extension
&&
423 (bitmapType
== -1 || handler
->GetType() == bitmapType
) )
430 wxBitmapHandler
*wxBitmap::FindHandler(long bitmapType
)
432 wxNode
*node
= sm_handlers
.First();
435 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
436 if (handler
->GetType() == bitmapType
)
452 // Construct a mask from a bitmap and a colour indicating
453 // the transparent area
454 wxMask::wxMask(const wxBitmap
& bitmap
, const wxColour
& colour
)
457 Create(bitmap
, colour
);
460 // Construct a mask from a bitmap and a palette index indicating
461 // the transparent area
462 wxMask::wxMask(const wxBitmap
& bitmap
, int paletteIndex
)
465 Create(bitmap
, paletteIndex
);
468 // Construct a mask from a mono bitmap (copies the bitmap).
469 wxMask::wxMask(const wxBitmap
& bitmap
)
479 wxMacDestroyGWorld( m_maskBitmap
) ;
480 m_maskBitmap
= NULL
;
484 // Create a mask from a mono bitmap (copies the bitmap).
485 bool wxMask::Create(const wxBitmap
& bitmap
)
491 // Create a mask from a bitmap and a palette index indicating
492 // the transparent area
493 bool wxMask::Create(const wxBitmap
& bitmap
, int paletteIndex
)
499 // Create a mask from a bitmap and a colour indicating
500 // the transparent area
501 bool wxMask::Create(const wxBitmap
& bitmap
, const wxColour
& colour
)
505 wxMacDestroyGWorld( m_maskBitmap
) ;
506 m_maskBitmap
= NULL
;
508 wxASSERT( ((wxBitmapRefData
*) bitmap
.GetRefData())->m_bitmapType
== kMacBitmapTypeGrafWorld
) ;
509 // other types would require a temporary bitmap. not yet implemented
516 m_maskBitmap
= wxMacCreateGWorld( bitmap
.GetWidth() , bitmap
.GetHeight() , 1 ) ;
517 RGBColor maskColor
= colour
.GetPixel() ;
519 // this is not very efficient, but I can't think
520 // of a better way of doing it
522 GDHandle origDevice
;
524 GetGWorld( &origPort
, &origDevice
) ;
525 for (int w
= 0; w
< bitmap
.GetWidth(); w
++)
527 for (int h
= 0; h
< bitmap
.GetHeight(); h
++)
529 RGBColor colors
[2] = {
530 { 0xFFFF , 0xFFFF , 0xFFFF } ,
534 SetGWorld( ((wxBitmapRefData
*) bitmap
.GetRefData())->m_hBitmap
, NULL
) ;
536 GetCPixel( w
, h
, &col
) ;
537 SetGWorld( m_maskBitmap
, NULL
) ;
538 if (col
.red
== maskColor
.red
&& col
.blue
== maskColor
.blue
&& col
.green
== maskColor
.green
)
540 SetCPixel( w
, h
, &colors
[0] ) ;
544 SetCPixel( w
, h
, &colors
[1] ) ;
548 SetGWorld( origPort
, origDevice
) ;
557 IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler
, wxObject
)
559 bool wxBitmapHandler::Create(wxBitmap
*bitmap
, void *data
, long type
, int width
, int height
, int depth
)
564 bool wxBitmapHandler::LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long type
,
565 int desiredWidth
, int desiredHeight
)
570 bool wxBitmapHandler::SaveFile(wxBitmap
*bitmap
, const wxString
& name
, int type
, const wxPalette
*palette
)
579 class WXDLLEXPORT wxPICTResourceHandler
: public wxBitmapHandler
581 DECLARE_DYNAMIC_CLASS(wxPICTResourceHandler
)
583 inline wxPICTResourceHandler()
585 m_name
= "Macintosh Pict resource";
587 m_type
= wxBITMAP_TYPE_PICT_RESOURCE
;
590 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
591 int desiredWidth
, int desiredHeight
);
593 IMPLEMENT_DYNAMIC_CLASS(wxPICTResourceHandler
, wxBitmapHandler
)
595 bool wxPICTResourceHandler::LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
596 int desiredWidth
, int desiredHeight
)
600 strcpy( (char*) theName
, name
) ;
601 c2pstr( (char*) theName
) ;
603 PicHandle thePict
= (PicHandle
) GetNamedResource( 'PICT' , theName
) ;
608 GetPictInfo( thePict
, &theInfo
, 0 , 0 , systemMethod
, 0 ) ;
609 DetachResource( (Handle
) thePict
) ;
610 M_BITMAPHANDLERDATA
->m_bitmapType
= kMacBitmapTypePict
;
611 M_BITMAPHANDLERDATA
->m_hPict
= thePict
;
612 M_BITMAPHANDLERDATA
->m_width
= theInfo
.sourceRect
.right
- theInfo
.sourceRect
.left
;
613 M_BITMAPHANDLERDATA
->m_height
= theInfo
.sourceRect
.bottom
- theInfo
.sourceRect
.top
;
615 M_BITMAPHANDLERDATA
->m_depth
= theInfo
.depth
;
616 M_BITMAPHANDLERDATA
->m_ok
= true ;
617 M_BITMAPHANDLERDATA
->m_numColors
= theInfo
.uniqueColors
;
618 // M_BITMAPHANDLERDATA->m_bitmapPalette;
619 // M_BITMAPHANDLERDATA->m_quality;
625 /* TODO: bitmap handlers, a bit like this:
626 class WXDLLEXPORT wxBMPResourceHandler: public wxBitmapHandler
628 DECLARE_DYNAMIC_CLASS(wxBMPResourceHandler)
630 inline wxBMPResourceHandler()
632 m_name = "Windows bitmap resource";
634 m_type = wxBITMAP_TYPE_BMP_RESOURCE;
637 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
638 int desiredWidth, int desiredHeight);
640 IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler)
643 class WXDLLEXPORT wxXPMFileHandler
: public wxBitmapHandler
645 DECLARE_DYNAMIC_CLASS(wxXPMFileHandler
)
647 inline wxXPMFileHandler(void)
649 m_name
= "XPM bitmap file";
651 m_type
= wxBITMAP_TYPE_XPM
;
654 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
655 int desiredWidth
= -1, int desiredHeight
= -1);
656 virtual bool SaveFile(wxBitmap
*bitmap
, const wxString
& name
, int type
, const wxPalette
*palette
= NULL
);
658 IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler
, wxBitmapHandler
)
660 bool wxXPMFileHandler::LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
661 int desiredWidth
, int desiredHeight
)
665 XpmAttributes xpmAttr
;
668 M_BITMAPHANDLERDATA
->m_ok
= FALSE
;
669 dc
= CreateCompatibleDC(NULL
);
672 xpmAttr
.valuemask
= XpmReturnPixels
;
673 int errorStatus
= XpmReadFileToImage(&dc
, WXSTRINGCAST name
, &ximage
, (XImage
**) NULL
, &xpmAttr
);
675 if (errorStatus
== XpmSuccess
)
677 M_BITMAPHANDLERDATA
->m_hBitmap
= (WXHBITMAP
) ximage
->bitmap
;
680 GetObject((HBITMAP
)M_BITMAPHANDLERDATA
->m_hBitmap
, sizeof(bm
), (LPSTR
) & bm
);
682 M_BITMAPHANDLERDATA
->m_width
= (bm
.bmWidth
);
683 M_BITMAPHANDLERDATA
->m_height
= (bm
.bmHeight
);
684 M_BITMAPHANDLERDATA
->m_depth
= (bm
.bmPlanes
* bm
.bmBitsPixel
);
685 M_BITMAPHANDLERDATA
->m_numColors
= xpmAttr
.npixels
;
686 XpmFreeAttributes(&xpmAttr
);
689 M_BITMAPHANDLERDATA
->m_ok
= TRUE
;
694 M_BITMAPHANDLERDATA
->m_ok
= FALSE
;
703 bool wxXPMFileHandler::SaveFile(wxBitmap
*bitmap
, const wxString
& name
, int type
, const wxPalette
*palette
)
708 Visual
*visual
= NULL
;
711 dc
= CreateCompatibleDC(NULL
);
714 if (SelectObject(dc
, (HBITMAP
) M_BITMAPHANDLERDATA
->m_hBitmap
))
715 { /* for following SetPixel */
716 /* fill the XImage struct 'by hand' */
717 ximage
.width
= M_BITMAPHANDLERDATA
->m_width
;
718 ximage
.height
= M_BITMAPHANDLERDATA
->m_height
;
719 ximage
.depth
= M_BITMAPHANDLERDATA
->m_depth
;
720 ximage
.bitmap
= (void *)M_BITMAPHANDLERDATA
->m_hBitmap
;
721 int errorStatus
= XpmWriteFileFromImage(&dc
, WXSTRINGCAST name
,
722 &ximage
, (XImage
*) NULL
, (XpmAttributes
*) NULL
);
727 if (errorStatus
== XpmSuccess
)
728 return TRUE
; /* no error */
739 class WXDLLEXPORT wxXPMDataHandler
: public wxBitmapHandler
741 DECLARE_DYNAMIC_CLASS(wxXPMDataHandler
)
743 inline wxXPMDataHandler(void)
745 m_name
= "XPM bitmap data";
747 m_type
= wxBITMAP_TYPE_XPM_DATA
;
750 virtual bool Create(wxBitmap
*bitmap
, void *data
, long flags
, int width
, int height
, int depth
= 1);
752 IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler
, wxBitmapHandler
)
754 bool wxXPMDataHandler::Create(wxBitmap
*bitmap
, void *data
, long flags
, int width
, int height
, int depth
)
758 XpmAttributes xpmAttr
;
760 xpmAttr
.valuemask
= XpmReturnInfos
; // get infos back
761 ErrorStatus
= XpmCreateImageFromData( GetMainDevice() , (char **)data
,
762 &ximage
, (XImage
**) NULL
, &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
;
785 M_BITMAPHANDLERDATA
->m_ok
= FALSE
;
791 class WXDLLEXPORT wxBMPResourceHandler
: public wxBitmapHandler
793 DECLARE_DYNAMIC_CLASS(wxBMPResourceHandler
)
795 inline wxBMPResourceHandler()
797 m_name
= "Windows bitmap resource";
799 m_type
= wxBITMAP_TYPE_BMP_RESOURCE
;
802 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
803 int desiredWidth
, int desiredHeight
);
806 IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler
, wxBitmapHandler
)
808 bool wxBMPResourceHandler::LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
809 int desiredWidth
, int desiredHeight
)
811 // TODO: load colourmap.
813 M_BITMAPHANDLERDATA->m_hBitmap = (WXHBITMAP) ::LoadBitmap(wxGetInstance(), name);
814 if (M_BITMAPHANDLERDATA->m_hBitmap)
816 M_BITMAPHANDLERDATA->m_ok = TRUE;
818 GetObject((HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap, sizeof(BITMAP), (LPSTR) &bm);
819 M_BITMAPHANDLERDATA->m_width = bm.bmWidth;
820 M_BITMAPHANDLERDATA->m_height = bm.bmHeight;
821 M_BITMAPHANDLERDATA->m_depth = bm.bmBitsPixel;
825 // it's probably not found
826 wxLogError("Can't load bitmap '%s' from resources! Check .rc file.", name
.c_str());
831 class WXDLLEXPORT wxBMPFileHandler
: public wxBitmapHandler
833 DECLARE_DYNAMIC_CLASS(wxBMPFileHandler
)
835 inline wxBMPFileHandler(void)
837 m_name
= "Windows bitmap file";
839 m_type
= wxBITMAP_TYPE_BMP
;
842 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
843 int desiredWidth
, int desiredHeight
);
844 virtual bool SaveFile(wxBitmap
*bitmap
, const wxString
& name
, int type
, const wxPalette
*palette
= NULL
);
847 IMPLEMENT_DYNAMIC_CLASS(wxBMPFileHandler
, wxBitmapHandler
)
849 bool wxBMPFileHandler::LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
850 int desiredWidth
, int desiredHeight
)
852 #if USE_IMAGE_LOADING_IN_MSW
853 wxPalette
*palette
= NULL
;
854 bool success
= FALSE
;
856 if (type & wxBITMAP_DISCARD_COLOURMAP)
857 success = wxLoadIntoBitmap(WXSTRINGCAST name, bitmap);
860 success
= (wxLoadIntoBitmap(WXSTRINGCAST name
, bitmap
, &palette
) != 0);
861 if (!success
&& palette
)
867 M_BITMAPHANDLERDATA
->m_bitmapPalette
= *palette
;
874 bool wxBMPFileHandler::SaveFile(wxBitmap
*bitmap
, const wxString
& name
, int type
, const wxPalette
*pal
)
876 #if USE_IMAGE_LOADING_IN_MSW
877 wxPalette
*actualPalette
= (wxPalette
*)pal
;
878 if (!actualPalette
&& (!M_BITMAPHANDLERDATA
->m_bitmapPalette
.IsNull()))
879 actualPalette
= & (M_BITMAPHANDLERDATA
->m_bitmapPalette
);
880 return (wxSaveBitmap(WXSTRINGCAST name
, bitmap
, actualPalette
) != 0);
888 void wxBitmap::CleanUpHandlers()
890 wxNode
*node
= sm_handlers
.First();
893 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
894 wxNode
*next
= node
->Next();
901 void wxBitmap::InitStandardHandlers()
903 AddHandler( new wxPICTResourceHandler
) ;
904 AddHandler( new wxICONResourceHandler
) ;
905 AddHandler(new wxXPMFileHandler
);
906 AddHandler(new wxXPMDataHandler
);
907 AddHandler(new wxBMPResourceHandler
);
908 AddHandler(new wxBMPFileHandler
);