]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/imagbmp.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxImage BMP, ICO, CUR and ANI handlers
4 // Author: Robert Roebling, Chris Elliott
6 // Copyright: (c) Robert Roebling, Chris Elliott
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_IMAGBMP_H_
11 #define _WX_IMAGBMP_H_
15 // defines for saving the BMP file in different formats, Bits Per Pixel
16 // USE: wximage.SetOption( wxIMAGE_OPTION_BMP_FORMAT, wxBMP_xBPP );
17 #define wxIMAGE_OPTION_BMP_FORMAT wxString(_T("wxBMP_FORMAT"))
19 // These two options are filled in upon reading CUR file and can (should) be
20 // specified when saving a CUR file - they define the hotspot of the cursor:
21 #define wxIMAGE_OPTION_CUR_HOTSPOT_X wxT("HotSpotX")
22 #define wxIMAGE_OPTION_CUR_HOTSPOT_Y wxT("HotSpotY")
24 #if WXWIN_COMPATIBILITY_2_4
25 // Do not use these macros, they are deprecated
26 #define wxBMP_FORMAT wxIMAGE_OPTION_BMP_FORMAT
27 #define wxCUR_HOTSPOT_X wxIMAGE_OPTION_CUR_HOTSPOT_X
28 #define wxCUR_HOTSPOT_Y wxIMAGE_OPTION_CUR_HOTSPOT_Y
34 wxBMP_24BPP
= 24, // default, do not need to set
35 //wxBMP_16BPP = 16, // wxQuantize can only do 236 colors?
36 wxBMP_8BPP
= 8, // 8bpp, quantized colors
37 wxBMP_8BPP_GREY
= 9, // 8bpp, rgb averaged to greys
38 wxBMP_8BPP_GRAY
= wxBMP_8BPP_GREY
,
39 wxBMP_8BPP_RED
= 10, // 8bpp, red used as greyscale
40 wxBMP_8BPP_PALETTE
= 11, // 8bpp, use the wxImage's palette
41 wxBMP_4BPP
= 4, // 4bpp, quantized colors
42 wxBMP_1BPP
= 1, // 1bpp, quantized "colors"
43 wxBMP_1BPP_BW
= 2 // 1bpp, black & white from red
46 // ----------------------------------------------------------------------------
48 // ----------------------------------------------------------------------------
50 class WXDLLEXPORT wxBMPHandler
: public wxImageHandler
55 m_name
= _T("Windows bitmap file");
56 m_extension
= _T("bmp");
57 m_type
= wxBITMAP_TYPE_BMP
;
58 m_mime
= _T("image/x-bmp");
62 virtual bool SaveFile( wxImage
*image
, wxOutputStream
& stream
, bool verbose
=true );
63 virtual bool LoadFile( wxImage
*image
, wxInputStream
& stream
, bool verbose
=true, int index
=-1 );
66 virtual bool DoCanRead( wxInputStream
& stream
);
67 bool SaveDib(wxImage
*image
, wxOutputStream
& stream
, bool verbose
,
68 bool IsBmp
, bool IsMask
);
69 bool DoLoadDib(wxImage
*image
, int width
, int height
, int bpp
, int ncolors
,
70 int comp
, wxFileOffset bmpOffset
, wxInputStream
& stream
,
71 bool verbose
, bool IsBmp
, bool hasPalette
);
72 bool LoadDib(wxImage
*image
, wxInputStream
& stream
, bool verbose
, bool IsBmp
);
73 #endif // wxUSE_STREAMS
76 DECLARE_DYNAMIC_CLASS(wxBMPHandler
)
80 // ----------------------------------------------------------------------------
82 // ----------------------------------------------------------------------------
84 class WXDLLEXPORT wxICOHandler
: public wxBMPHandler
89 m_name
= _T("Windows icon file");
90 m_extension
= _T("ico");
91 m_type
= wxBITMAP_TYPE_ICO
;
92 m_mime
= _T("image/x-ico");
96 virtual bool SaveFile( wxImage
*image
, wxOutputStream
& stream
, bool verbose
=true );
97 virtual bool LoadFile( wxImage
*image
, wxInputStream
& stream
, bool verbose
=true, int index
=-1 );
98 virtual bool DoLoadFile( wxImage
*image
, wxInputStream
& stream
, bool verbose
, int index
);
99 virtual int GetImageCount( wxInputStream
& stream
);
101 virtual bool DoCanRead( wxInputStream
& stream
);
102 #endif // wxUSE_STREAMS
105 DECLARE_DYNAMIC_CLASS(wxICOHandler
)
109 // ----------------------------------------------------------------------------
111 // ----------------------------------------------------------------------------
113 class WXDLLEXPORT wxCURHandler
: public wxICOHandler
118 m_name
= _T("Windows cursor file");
119 m_extension
= _T("cur");
120 m_type
= wxBITMAP_TYPE_CUR
;
121 m_mime
= _T("image/x-cur");
124 // VS: This handler's meat is implemented inside wxICOHandler (the two
125 // formats are almost identical), but we hide this fact at
126 // the API level, since it is a mere implementation detail.
130 virtual bool DoCanRead( wxInputStream
& stream
);
131 #endif // wxUSE_STREAMS
134 DECLARE_DYNAMIC_CLASS(wxCURHandler
)
136 // ----------------------------------------------------------------------------
138 // ----------------------------------------------------------------------------
140 class WXDLLEXPORT wxANIHandler
: public wxCURHandler
145 m_name
= _T("Windows animated cursor file");
146 m_extension
= _T("ani");
147 m_type
= wxBITMAP_TYPE_ANI
;
148 m_mime
= _T("image/x-ani");
153 virtual bool SaveFile( wxImage
*WXUNUSED(image
), wxOutputStream
& WXUNUSED(stream
), bool WXUNUSED(verbose
=true) ){return false ;};
154 virtual bool LoadFile( wxImage
*image
, wxInputStream
& stream
, bool verbose
=true, int index
=-1 );
155 virtual int GetImageCount( wxInputStream
& stream
);
157 virtual bool DoCanRead( wxInputStream
& stream
);
158 #endif // wxUSE_STREAMS
161 DECLARE_DYNAMIC_CLASS(wxANIHandler
)
164 #endif // wxUSE_ICO_CUR
165 #endif // _WX_IMAGBMP_H_