]> git.saurik.com Git - wxWidgets.git/blame - include/wx/imagbmp.h
fixed operator=(), ==() and !=() for wxPen
[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
12028905 13#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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
8ccff7d2
VS
28#if WXWIN_COMPATIBILITY_2_4
29 // Do not use these macros, they are deprecated
30 #define wxBMP_FORMAT wxIMAGE_OPTION_BMP_FORMAT
31 #define wxCUR_HOTSPOT_X wxIMAGE_OPTION_CUR_HOTSPOT_X
32 #define wxCUR_HOTSPOT_Y wxIMAGE_OPTION_CUR_HOTSPOT_Y
33#endif
fd94e8aa 34
1971d23c
VZ
35
36enum
37{
38 wxBMP_24BPP = 24, // default, do not need to set
39 //wxBMP_16BPP = 16, // wxQuantize can only do 236 colors?
40 wxBMP_8BPP = 8, // 8bpp, quantized colors
41 wxBMP_8BPP_GREY = 9, // 8bpp, rgb averaged to greys
42 wxBMP_8BPP_GRAY = wxBMP_8BPP_GREY,
43 wxBMP_8BPP_RED = 10, // 8bpp, red used as greyscale
44 wxBMP_8BPP_PALETTE = 11, // 8bpp, use the wxImage's palette
45 wxBMP_4BPP = 4, // 4bpp, quantized colors
46 wxBMP_1BPP = 1, // 1bpp, quantized "colors"
47 wxBMP_1BPP_BW = 2 // 1bpp, black & white from red
48};
49
f6bcfd97 50// ----------------------------------------------------------------------------
8f493002 51// wxBMPHandler
f6bcfd97 52// ----------------------------------------------------------------------------
8f493002 53
f6bcfd97 54class WXDLLEXPORT wxBMPHandler : public wxImageHandler
8f493002 55{
8f493002 56public:
52b64b0a
RR
57 wxBMPHandler()
58 {
05813ada 59 m_name = _T("Windows bitmap file");
52b64b0a
RR
60 m_extension = _T("bmp");
61 m_type = wxBITMAP_TYPE_BMP;
05813ada 62 m_mime = _T("image/x-bmp");
52b64b0a 63 };
8f493002
VS
64
65#if wxUSE_STREAMS
05813ada 66 virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
d394f479 67 virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
05813ada 68 virtual bool DoCanRead( wxInputStream& stream );
574c939e 69
52b64b0a 70protected:
574c939e 71 bool SaveDib(wxImage *image, wxOutputStream& stream, bool verbose,
05813ada 72 bool IsBmp, bool IsMask);
574c939e 73 bool DoLoadDib(wxImage *image, int width, int height, int bpp, int ncolors,
05813ada
VS
74 int comp, off_t bmpOffset, wxInputStream& stream,
75 bool verbose, bool IsBmp, bool hasPalette);
76 bool LoadDib(wxImage *image, wxInputStream& stream, bool verbose, bool IsBmp);
52b64b0a 77#endif // wxUSE_STREAMS
f6bcfd97 78
52b64b0a
RR
79private:
80 DECLARE_DYNAMIC_CLASS(wxBMPHandler)
81};
82
658974ae 83#if wxUSE_ICO_CUR
52b64b0a
RR
84// ----------------------------------------------------------------------------
85// wxICOHandler
86// ----------------------------------------------------------------------------
87
88class WXDLLEXPORT wxICOHandler : public wxBMPHandler
89{
90public:
91 wxICOHandler()
92 {
05813ada 93 m_name = _T("Windows icon file");
52b64b0a
RR
94 m_extension = _T("ico");
95 m_type = wxBITMAP_TYPE_ICO;
05813ada 96 m_mime = _T("image/x-ico");
52b64b0a
RR
97 };
98
99#if wxUSE_STREAMS
05813ada 100 virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
658974ae
VS
101 virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
102 virtual bool DoLoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index );
05813ada 103 virtual bool DoCanRead( wxInputStream& stream );
649d13e8 104 virtual int GetImageCount( wxInputStream& stream );
f6bcfd97
BP
105#endif // wxUSE_STREAMS
106
52b64b0a 107private:
05813ada 108 DECLARE_DYNAMIC_CLASS(wxICOHandler)
8f493002
VS
109};
110
111
05813ada
VS
112// ----------------------------------------------------------------------------
113// wxCURHandler
114// ----------------------------------------------------------------------------
115
05813ada
VS
116class WXDLLEXPORT wxCURHandler : public wxICOHandler
117{
118public:
119 wxCURHandler()
120 {
121 m_name = _T("Windows cursor file");
122 m_extension = _T("cur");
123 m_type = wxBITMAP_TYPE_CUR;
124 m_mime = _T("image/x-cur");
125 };
574c939e 126
05813ada
VS
127 // VS: This handler's meat is implemented inside wxICOHandler (the two
128 // formats are almost identical), but we hide this fact at
129 // the API level, since it is a mere implementation detail.
130
131#if wxUSE_STREAMS
132 virtual bool DoCanRead( wxInputStream& stream );
133#endif // wxUSE_STREAMS
134
135private:
136 DECLARE_DYNAMIC_CLASS(wxCURHandler)
137};
658974ae
VS
138// ----------------------------------------------------------------------------
139// wxANIHandler
140// ----------------------------------------------------------------------------
141
142class WXDLLEXPORT wxANIHandler : public wxCURHandler
143{
144public:
145 wxANIHandler()
146 {
147 m_name = _T("Windows animated cursor file");
148 m_extension = _T("ani");
149 m_type = wxBITMAP_TYPE_ANI;
150 m_mime = _T("image/x-ani");
151 };
574c939e 152
658974ae
VS
153
154#if wxUSE_STREAMS
574c939e 155 virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool WXUNUSED(verbose=TRUE) ){return FALSE ;};
658974ae
VS
156 virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
157 virtual bool DoCanRead( wxInputStream& stream );
158 virtual int GetImageCount( wxInputStream& stream );
159#endif // wxUSE_STREAMS
160
161private:
162 DECLARE_DYNAMIC_CLASS(wxANIHandler)
163};
8f493002 164
658974ae 165#endif // wxUSE_ICO_CUR
05813ada 166#endif // _WX_IMAGBMP_H_