]> git.saurik.com Git - wxWidgets.git/blame - include/wx/imagbmp.h
made wxHtmlWindow::SetPage virtual so that the behaviour can be customized
[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
65571936 7// Licence: wxWindows licence
8f493002
VS
8/////////////////////////////////////////////////////////////////////////////
9
10#ifndef _WX_IMAGBMP_H_
11#define _WX_IMAGBMP_H_
12
8f493002
VS
13#include "wx/image.h"
14
1971d23c 15// defines for saving the BMP file in different formats, Bits Per Pixel
fd94e8aa
VS
16// USE: wximage.SetOption( wxIMAGE_OPTION_BMP_FORMAT, wxBMP_xBPP );
17#define wxIMAGE_OPTION_BMP_FORMAT wxString(_T("wxBMP_FORMAT"))
18
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")
23
8ccff7d2
VS
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
29#endif
fd94e8aa 30
1971d23c
VZ
31
32enum
33{
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
44};
45
f6bcfd97 46// ----------------------------------------------------------------------------
8f493002 47// wxBMPHandler
f6bcfd97 48// ----------------------------------------------------------------------------
8f493002 49
f6bcfd97 50class WXDLLEXPORT wxBMPHandler : public wxImageHandler
8f493002 51{
8f493002 52public:
52b64b0a
RR
53 wxBMPHandler()
54 {
05813ada 55 m_name = _T("Windows bitmap file");
52b64b0a
RR
56 m_extension = _T("bmp");
57 m_type = wxBITMAP_TYPE_BMP;
05813ada 58 m_mime = _T("image/x-bmp");
52b64b0a 59 };
8f493002
VS
60
61#if wxUSE_STREAMS
7beb59f3
WS
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 );
05813ada 64 virtual bool DoCanRead( wxInputStream& stream );
574c939e 65
52b64b0a 66protected:
574c939e 67 bool SaveDib(wxImage *image, wxOutputStream& stream, bool verbose,
05813ada 68 bool IsBmp, bool IsMask);
574c939e 69 bool DoLoadDib(wxImage *image, int width, int height, int bpp, int ncolors,
1b941f2d 70 int comp, wxFileOffset bmpOffset, wxInputStream& stream,
05813ada
VS
71 bool verbose, bool IsBmp, bool hasPalette);
72 bool LoadDib(wxImage *image, wxInputStream& stream, bool verbose, bool IsBmp);
52b64b0a 73#endif // wxUSE_STREAMS
f6bcfd97 74
52b64b0a
RR
75private:
76 DECLARE_DYNAMIC_CLASS(wxBMPHandler)
77};
78
658974ae 79#if wxUSE_ICO_CUR
52b64b0a
RR
80// ----------------------------------------------------------------------------
81// wxICOHandler
82// ----------------------------------------------------------------------------
83
84class WXDLLEXPORT wxICOHandler : public wxBMPHandler
85{
86public:
87 wxICOHandler()
88 {
05813ada 89 m_name = _T("Windows icon file");
52b64b0a
RR
90 m_extension = _T("ico");
91 m_type = wxBITMAP_TYPE_ICO;
05813ada 92 m_mime = _T("image/x-ico");
52b64b0a
RR
93 };
94
95#if wxUSE_STREAMS
7beb59f3
WS
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 );
658974ae 98 virtual bool DoLoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index );
05813ada 99 virtual bool DoCanRead( wxInputStream& stream );
649d13e8 100 virtual int GetImageCount( wxInputStream& stream );
f6bcfd97
BP
101#endif // wxUSE_STREAMS
102
52b64b0a 103private:
05813ada 104 DECLARE_DYNAMIC_CLASS(wxICOHandler)
8f493002
VS
105};
106
107
05813ada
VS
108// ----------------------------------------------------------------------------
109// wxCURHandler
110// ----------------------------------------------------------------------------
111
05813ada
VS
112class WXDLLEXPORT wxCURHandler : public wxICOHandler
113{
114public:
115 wxCURHandler()
116 {
117 m_name = _T("Windows cursor file");
118 m_extension = _T("cur");
119 m_type = wxBITMAP_TYPE_CUR;
120 m_mime = _T("image/x-cur");
121 };
574c939e 122
05813ada
VS
123 // VS: This handler's meat is implemented inside wxICOHandler (the two
124 // formats are almost identical), but we hide this fact at
125 // the API level, since it is a mere implementation detail.
126
127#if wxUSE_STREAMS
128 virtual bool DoCanRead( wxInputStream& stream );
129#endif // wxUSE_STREAMS
130
131private:
132 DECLARE_DYNAMIC_CLASS(wxCURHandler)
133};
658974ae
VS
134// ----------------------------------------------------------------------------
135// wxANIHandler
136// ----------------------------------------------------------------------------
137
138class WXDLLEXPORT wxANIHandler : public wxCURHandler
139{
140public:
141 wxANIHandler()
142 {
143 m_name = _T("Windows animated cursor file");
144 m_extension = _T("ani");
145 m_type = wxBITMAP_TYPE_ANI;
146 m_mime = _T("image/x-ani");
147 };
574c939e 148
658974ae
VS
149
150#if wxUSE_STREAMS
7beb59f3
WS
151 virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool WXUNUSED(verbose=true) ){return false ;};
152 virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
658974ae
VS
153 virtual bool DoCanRead( wxInputStream& stream );
154 virtual int GetImageCount( wxInputStream& stream );
155#endif // wxUSE_STREAMS
156
157private:
158 DECLARE_DYNAMIC_CLASS(wxANIHandler)
159};
8f493002 160
658974ae 161#endif // wxUSE_ICO_CUR
05813ada 162#endif // _WX_IMAGBMP_H_