// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation "bitmap.h"
-#endif
-
#include "wx/bitmap.h"
#include "wx/icon.h"
#include "wx/log.h"
#include "wx/wfstream.h"
#endif
#endif
-#include <math.h>
+#include "wx/math.h"
//-----------------------------------------------------------------------------
// wxMask
int x, int y, int width, int height,
int depth )
{
- int xscreen = DefaultScreen( (Display*)xdisplay );
- Window xroot = RootWindow( (Display*)xdisplay, xscreen );
- Visual* xvisual = DefaultVisual( xdisplay, xscreen );
+ Display * const dpy = (Display *)xdisplay;
+
+ int xscreen = DefaultScreen( dpy );
+ Window xroot = RootWindow( dpy, xscreen );
+ Visual* xvisual = DefaultVisual( dpy, xscreen );
- XImage* ximage = XCreateImage( (Display*)xdisplay, xvisual, depth,
+ XImage* ximage = XCreateImage( dpy, xvisual, depth,
ZPixmap, 0, 0, width, height, 32, 0 );
ximage->data = (char*)malloc( ximage->bytes_per_line * ximage->height );
- ximage = XGetSubImage( (Display*)xdisplay, (Pixmap)xpixmap,
+ ximage = XGetSubImage( dpy, (Pixmap)xpixmap,
x, y, width, height,
AllPlanes, ZPixmap, ximage, 0, 0 );
- GC gc = XCreateGC( (Display*)xdisplay, (Pixmap)xpixmap, 0, NULL );
- Pixmap ret = XCreatePixmap( (Display*)xdisplay, xroot,
+ GC gc = XCreateGC( dpy, (Pixmap)xpixmap, 0, NULL );
+ Pixmap ret = XCreatePixmap( dpy, xroot,
width, height, depth );
- XPutImage( (Display*)xdisplay, ret, gc, ximage,
+ XPutImage( dpy, ret, gc, ximage,
0, 0, 0, 0, width, height );
XDestroyImage( ximage );
- XFreeGC( (Display*)xdisplay, gc );
+ XFreeGC( dpy, gc );
return (WXPixmap)ret;
}
wxBitmapHandler *handler = FindHandler(type);
if ( handler == NULL ) {
- wxLogWarning("no data bitmap handler for type %ld defined.",
+ wxLogWarning(wxT("no data bitmap handler for type %ld defined."),
(long)type);
return FALSE;
bool wxBitmap::CreateFromXpm( const char **bits )
{
- wxCHECK_MSG( bits, FALSE, _T("NULL pointer in wxBitmap::CreateFromXpm") );
+ wxCHECK_MSG( bits, FALSE, wxT("NULL pointer in wxBitmap::CreateFromXpm") );
return Create(bits, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
}
#if wxUSE_NANOX
if (!image.Ok())
{
- wxASSERT_MSG(image.Ok(), "Invalid wxImage passed to wxBitmap::CreateFromImage.");
+ wxASSERT_MSG(image.Ok(), wxT("Invalid wxImage passed to wxBitmap::CreateFromImage."));
return FALSE;
}
if (depth == 1)
{
- wxFAIL_MSG( "mono images later" );
+ wxFAIL_MSG( wxT("mono images later") );
}
else
{
int b_mask = image.GetMaskBlue();
unsigned char* data = image.GetData();
- wxASSERT_MSG( data, "No image data" );
+ wxASSERT_MSG( data, wxT("No image data") );
unsigned char *colorCube =
wxTheApp->GetVisualInfo(M_BMPDATA->m_display)->m_colorCube;
class wxXPMFileHandler : public wxBitmapHandler
{
- DECLARE_DYNAMIC_CLASS(wxXPMFileHandler);
+ DECLARE_DYNAMIC_CLASS(wxXPMFileHandler)
public:
wxXPMFileHandler()
{
- m_name = "XPM file";
- m_extension = "xpm";
- m_type = wxBITMAP_TYPE_XPM;
+ SetName( wxT("XPM file") );
+ SetExtension( wxT("xpm") );
+ SetType( wxBITMAP_TYPE_XPM );
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
class wxXPMDataHandler : public wxBitmapHandler
{
- DECLARE_DYNAMIC_CLASS(wxXPMDataHandler);
+ DECLARE_DYNAMIC_CLASS(wxXPMDataHandler)
public:
wxXPMDataHandler()
{
- m_name = "XPM data";
- m_extension = "xpm";
- m_type = wxBITMAP_TYPE_XPM_DATA;
+ SetName( wxT("XPM data") );
+ SetExtension( wxT("xpm") );
+ SetType( wxBITMAP_TYPE_XPM_DATA );
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
public:
inline wxXBMDataHandler()
{
- m_name = "XBM data";
- m_extension = "xbm";
- m_type = wxBITMAP_TYPE_XBM_DATA;
+ SetName( wxT("XBM data") );
+ SetExtension( wxT("xbm") );
+ SetType( wxBITMAP_TYPE_XBM_DATA );
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,