]> git.saurik.com Git - wxWidgets.git/blame - include/wx/imagbmp.h
Quick and dirty fix for building with COMPATIBILITY_2_4 off.
[wxWidgets.git] / include / wx / imagbmp.h
CommitLineData
8f493002
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: imagbmp.h
05813ada
VS
3// Purpose: wxImage BMP, ICO and CUR handlers
4// Author: Robert Roebling, Chris Elliott
8f493002 5// RCS-ID: $Id$
05813ada 6// Copyright: (c) Robert Roebling, Chris Elliott
8f493002
VS
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
10#ifndef _WX_IMAGBMP_H_
11#define _WX_IMAGBMP_H_
12
af49c4b8 13#if defined(__GNUG__) && !defined(__APPLE__)
8f493002
VS
14#pragma interface "imagbmp.h"
15#endif
16
17#include "wx/image.h"
18
1971d23c 19// defines for saving the BMP file in different formats, Bits Per Pixel
fd94e8aa
VS
20// USE: wximage.SetOption( wxIMAGE_OPTION_BMP_FORMAT, wxBMP_xBPP );
21#define wxIMAGE_OPTION_BMP_FORMAT wxString(_T("wxBMP_FORMAT"))
22
23// These two options are filled in upon reading CUR file and can (should) be
24// specified when saving a CUR file - they define the hotspot of the cursor:
25#define wxIMAGE_OPTION_CUR_HOTSPOT_X wxT("HotSpotX")
26#define wxIMAGE_OPTION_CUR_HOTSPOT_Y wxT("HotSpotY")
27
28// Do not use these macros, they are deprecated!! :
29#define wxBMP_FORMAT wxIMAGE_OPTION_BMP_FORMAT
30#define wxCUR_HOTSPOT_X wxIMAGE_OPTION_CUR_HOTSPOT_X
31#define wxCUR_HOTSPOT_Y wxIMAGE_OPTION_CUR_HOTSPOT_Y
32
1971d23c
VZ
33
34enum
35{
36 wxBMP_24BPP = 24, // default, do not need to set
37 //wxBMP_16BPP = 16, // wxQuantize can only do 236 colors?
38 wxBMP_8BPP = 8, // 8bpp, quantized colors
39 wxBMP_8BPP_GREY = 9, // 8bpp, rgb averaged to greys
40 wxBMP_8BPP_GRAY = wxBMP_8BPP_GREY,
41 wxBMP_8BPP_RED = 10, // 8bpp, red used as greyscale
42 wxBMP_8BPP_PALETTE = 11, // 8bpp, use the wxImage's palette
43 wxBMP_4BPP = 4, // 4bpp, quantized colors
44 wxBMP_1BPP = 1, // 1bpp, quantized "colors"
45 wxBMP_1BPP_BW = 2 // 1bpp, black & white from red
46};
47
f6bcfd97 48// ----------------------------------------------------------------------------
8f493002 49// wxBMPHandler
f6bcfd97 50// ----------------------------------------------------------------------------
8f493002 51
f6bcfd97 52class WXDLLEXPORT wxBMPHandler : public wxImageHandler
8f493002 53{
8f493002 54public:
52b64b0a
RR
55 wxBMPHandler()
56 {
05813ada 57 m_name = _T("Windows bitmap file");
52b64b0a
RR
58 m_extension = _T("bmp");
59 m_type = wxBITMAP_TYPE_BMP;
05813ada 60 m_mime = _T("image/x-bmp");
52b64b0a 61 };
8f493002
VS
62
63#if wxUSE_STREAMS
05813ada 64 virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
d394f479 65 virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
05813ada 66 virtual bool DoCanRead( wxInputStream& stream );
574c939e 67
52b64b0a 68protected:
574c939e 69 bool SaveDib(wxImage *image, wxOutputStream& stream, bool verbose,
05813ada 70 bool IsBmp, bool IsMask);
574c939e 71 bool DoLoadDib(wxImage *image, int width, int height, int bpp, int ncolors,
05813ada
VS
72 int comp, off_t bmpOffset, wxInputStream& stream,
73 bool verbose, bool IsBmp, bool hasPalette);
74 bool LoadDib(wxImage *image, wxInputStream& stream, bool verbose, bool IsBmp);
52b64b0a 75#endif // wxUSE_STREAMS
f6bcfd97 76
52b64b0a
RR
77private:
78 DECLARE_DYNAMIC_CLASS(wxBMPHandler)
79};
80
658974ae 81#if wxUSE_ICO_CUR
52b64b0a
RR
82// ----------------------------------------------------------------------------
83// wxICOHandler
84// ----------------------------------------------------------------------------
85
86class WXDLLEXPORT wxICOHandler : public wxBMPHandler
87{
88public:
89 wxICOHandler()
90 {
05813ada 91 m_name = _T("Windows icon file");
52b64b0a
RR
92 m_extension = _T("ico");
93 m_type = wxBITMAP_TYPE_ICO;
05813ada 94 m_mime = _T("image/x-ico");
52b64b0a
RR
95 };
96
97#if wxUSE_STREAMS
05813ada 98 virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
658974ae
VS
99 virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
100 virtual bool DoLoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index );
05813ada 101 virtual bool DoCanRead( wxInputStream& stream );
649d13e8 102 virtual int GetImageCount( wxInputStream& stream );
f6bcfd97
BP
103#endif // wxUSE_STREAMS
104
52b64b0a 105private:
05813ada 106 DECLARE_DYNAMIC_CLASS(wxICOHandler)
8f493002
VS
107};
108
109
05813ada
VS
110// ----------------------------------------------------------------------------
111// wxCURHandler
112// ----------------------------------------------------------------------------
113
05813ada
VS
114class WXDLLEXPORT wxCURHandler : public wxICOHandler
115{
116public:
117 wxCURHandler()
118 {
119 m_name = _T("Windows cursor file");
120 m_extension = _T("cur");
121 m_type = wxBITMAP_TYPE_CUR;
122 m_mime = _T("image/x-cur");
123 };
574c939e 124
05813ada
VS
125 // VS: This handler's meat is implemented inside wxICOHandler (the two
126 // formats are almost identical), but we hide this fact at
127 // the API level, since it is a mere implementation detail.
128
129#if wxUSE_STREAMS
130 virtual bool DoCanRead( wxInputStream& stream );
131#endif // wxUSE_STREAMS
132
133private:
134 DECLARE_DYNAMIC_CLASS(wxCURHandler)
135};
658974ae
VS
136// ----------------------------------------------------------------------------
137// wxANIHandler
138// ----------------------------------------------------------------------------
139
140class WXDLLEXPORT wxANIHandler : public wxCURHandler
141{
142public:
143 wxANIHandler()
144 {
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");
149 };
574c939e 150
658974ae
VS
151
152#if wxUSE_STREAMS
574c939e 153 virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool WXUNUSED(verbose=TRUE) ){return FALSE ;};
658974ae
VS
154 virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
155 virtual bool DoCanRead( wxInputStream& stream );
156 virtual int GetImageCount( wxInputStream& stream );
157#endif // wxUSE_STREAMS
158
159private:
160 DECLARE_DYNAMIC_CLASS(wxANIHandler)
161};
8f493002 162
658974ae 163#endif // wxUSE_ICO_CUR
05813ada 164#endif // _WX_IMAGBMP_H_