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