// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "imagbmp.h"
#endif
#include "wx/defs.h"
-#if wxUSE_IMAGE && wxUSE_STREAMS
+#if wxUSE_IMAGE
#include "wx/imagbmp.h"
#include "wx/bitmap.h"
#endif
#ifdef __WXMSW__
-#include <windows.h>
+#include "wx/msw/wrapwin.h"
#endif
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxBMPHandler,wxImageHandler)
+#if wxUSE_STREAMS
+
#ifndef BI_RGB
#define BI_RGB 0
#define BI_RLE8 1
wxUint16 aWord;
// allocate space for palette if needed:
- _cmap *cmap = NULL;
+ _cmap *cmap;
if ( bpp < 16 )
{
ptr = data;
}
- int line = 0;
- int column = 0;
int linesize = ((width * bpp + 31) / 32) * 4;
/* BMPs are stored upside down */
- for ( line = (height - 1); line >= 0; line-- )
+ for ( int line = (height - 1); line >= 0; line-- )
{
int linepos = 0;
- for ( column = 0; column < width ; )
+ for ( int column = 0; column < width ; )
{
if ( bpp < 16 )
{
- int index = 0;
linepos++;
aByte = stream.GetC();
if ( bpp == 1 )
{
- int bit = 0;
- for (bit = 0; bit < 8 && column < width; bit++)
+ for (int bit = 0; bit < 8 && column < width; bit++)
{
- index = ((aByte & (0x80 >> bit)) ? 1 : 0);
+ int index = ((aByte & (0x80 >> bit)) ? 1 : 0);
ptr[poffset] = cmap[index].r;
ptr[poffset + 1] = cmap[index].g;
ptr[poffset + 2] = cmap[index].b;
}
else
{
- int nibble = 0;
- for (nibble = 0; nibble < 2 && column < width; nibble++)
+ for (int nibble = 0; nibble < 2 && column < width; nibble++)
{
- index = ((aByte & (0xF0 >> nibble * 4)) >> (!nibble * 4));
+ int index = ((aByte & (0xF0 >> nibble * 4)) >> (!nibble * 4));
if ( index >= 16 )
index = 15;
ptr[poffset] = cmap[index].r;
return hdr[0] == 'B' && hdr[1] == 'M';
}
+#endif // wxUSE_STREAMS
+
#if wxUSE_ICO_CUR
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxICOHandler, wxBMPHandler)
+#if wxUSE_STREAMS
+
struct ICONDIRENTRY
{
wxUint8 bWidth; // Width of the image
return hdr[0] == '\0' && hdr[1] == '\0' && hdr[2] == '\1' && hdr[3] == '\0';
}
+#endif // wxUSE_STREAMS
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxCURHandler, wxICOHandler)
+#if wxUSE_STREAMS
+
bool wxCURHandler::DoCanRead(wxInputStream& stream)
{
stream.SeekI(0);
return hdr[0] == '\0' && hdr[1] == '\0' && hdr[2] == '\2' && hdr[3] == '\0';
}
+#endif // wxUSE_STREAMS
+
//-----------------------------------------------------------------------------
// wxANIHandler
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxANIHandler, wxCURHandler)
+#if wxUSE_STREAMS
+
bool wxANIHandler::LoadFile(wxImage *image, wxInputStream& stream,
bool verbose, int index)
{
return wxNOT_FOUND;
}
+#endif // wxUSE_STREAMS
+
#endif // wxUSE_ICO_CUR
-#endif // wxUSE_IMAGE && wxUSE_STREAMS
+#endif // wxUSE_IMAGE