]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/imagbmp.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxImage BMP, ICO and CUR 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_
14 #pragma interface "imagbmp.h"
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"))
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
37 // ----------------------------------------------------------------------------
39 // ----------------------------------------------------------------------------
41 class WXDLLEXPORT wxBMPHandler
: public wxImageHandler
46 m_name
= _T("Windows bitmap file");
47 m_extension
= _T("bmp");
48 m_type
= wxBITMAP_TYPE_BMP
;
49 m_mime
= _T("image/x-bmp");
53 virtual bool SaveFile( wxImage
*image
, wxOutputStream
& stream
, bool verbose
=TRUE
);
54 virtual bool LoadFile( wxImage
*image
, wxInputStream
& stream
, bool verbose
=TRUE
, int index
=0 );
55 virtual bool DoCanRead( wxInputStream
& stream
);
58 bool SaveDib(wxImage
*image
, wxOutputStream
& stream
, bool verbose
,
59 bool IsBmp
, bool IsMask
);
60 bool DoLoadDib(wxImage
*image
, int width
, int height
, int bpp
, int ncolors
,
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
);
64 #endif // wxUSE_STREAMS
67 DECLARE_DYNAMIC_CLASS(wxBMPHandler
)
71 // ----------------------------------------------------------------------------
73 // ----------------------------------------------------------------------------
75 class WXDLLEXPORT wxICOHandler
: public wxBMPHandler
80 m_name
= _T("Windows icon file");
81 m_extension
= _T("ico");
82 m_type
= wxBITMAP_TYPE_ICO
;
83 m_mime
= _T("image/x-ico");
87 virtual bool SaveFile( wxImage
*image
, wxOutputStream
& stream
, bool verbose
=TRUE
);
88 virtual bool LoadFile( wxImage
*image
, wxInputStream
& stream
, bool verbose
=TRUE
, int index
=0 );
89 virtual bool DoCanRead( wxInputStream
& stream
);
90 virtual int GetImageCount( wxInputStream
& stream
);
91 #endif // wxUSE_STREAMS
94 DECLARE_DYNAMIC_CLASS(wxICOHandler
)
98 // ----------------------------------------------------------------------------
100 // ----------------------------------------------------------------------------
102 // These two options are filled in upon reading CUR file and can (should) be
103 // specified when saving a CUR file - they define the hotspot of the cursor:
104 #define wxCUR_HOTSPOT_X wxT("HotSpotX")
105 #define wxCUR_HOTSPOT_Y wxT("HotSpotY")
107 class WXDLLEXPORT wxCURHandler
: public wxICOHandler
112 m_name
= _T("Windows cursor file");
113 m_extension
= _T("cur");
114 m_type
= wxBITMAP_TYPE_CUR
;
115 m_mime
= _T("image/x-cur");
118 // VS: This handler's meat is implemented inside wxICOHandler (the two
119 // formats are almost identical), but we hide this fact at
120 // the API level, since it is a mere implementation detail.
123 virtual bool DoCanRead( wxInputStream
& stream
);
124 #endif // wxUSE_STREAMS
127 DECLARE_DYNAMIC_CLASS(wxCURHandler
)
130 #endif // _WX_IMAGBMP_H_