2002-02-05 11:34:33 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2003-04-27 22:08:57 -04:00
|
|
|
// Name: x11/bitmap.h
|
2002-02-05 11:34:33 -05:00
|
|
|
// Purpose: wxBitmap class
|
2002-02-13 03:38:54 -05:00
|
|
|
// Author: Julian Smart, Robert Roebling
|
2002-02-05 11:34:33 -05:00
|
|
|
// Modified by:
|
|
|
|
// Created: 17/09/98
|
|
|
|
// RCS-ID: $Id$
|
2002-02-13 03:38:54 -05:00
|
|
|
// Copyright: (c) Julian Smart, Robert Roebling
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2002-02-05 11:34:33 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_BITMAP_H_
|
|
|
|
#define _WX_BITMAP_H_
|
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
#include "wx/defs.h"
|
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/string.h"
|
2002-02-05 11:34:33 -05:00
|
|
|
#include "wx/palette.h"
|
2002-02-13 03:38:54 -05:00
|
|
|
#include "wx/gdiobj.h"
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxMask;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxBitmap;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxImage;
|
2002-02-05 11:34:33 -05:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxMask
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 14:16:51 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxMask: public wxObject
|
2002-02-05 11:34:33 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxMask();
|
2002-02-13 03:38:54 -05:00
|
|
|
wxMask( const wxBitmap& bitmap, const wxColour& colour );
|
|
|
|
wxMask( const wxBitmap& bitmap, int paletteIndex );
|
|
|
|
wxMask( const wxBitmap& bitmap );
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxMask();
|
2003-04-27 22:08:57 -04:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
bool Create( const wxBitmap& bitmap, const wxColour& colour );
|
|
|
|
bool Create( const wxBitmap& bitmap, int paletteIndex );
|
|
|
|
bool Create( const wxBitmap& bitmap );
|
2002-02-05 11:34:33 -05:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
// implementation
|
|
|
|
WXPixmap GetBitmap() const { return m_bitmap; }
|
|
|
|
void SetBitmap( WXPixmap bitmap ) { m_bitmap = bitmap; }
|
2003-04-27 22:08:57 -04:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
WXDisplay *GetDisplay() const { return m_display; }
|
|
|
|
void SetDisplay( WXDisplay *display ) { m_display = display; }
|
2003-04-27 22:08:57 -04:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
private:
|
|
|
|
WXPixmap m_bitmap;
|
|
|
|
WXDisplay *m_display;
|
2003-04-27 22:08:57 -04:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxMask)
|
2002-02-05 11:34:33 -05:00
|
|
|
};
|
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxBitmap
|
|
|
|
//-----------------------------------------------------------------------------
|
2002-02-05 11:34:33 -05:00
|
|
|
|
2005-08-02 14:16:51 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
|
2002-02-05 11:34:33 -05:00
|
|
|
{
|
|
|
|
public:
|
2002-02-13 03:38:54 -05:00
|
|
|
wxBitmap();
|
|
|
|
wxBitmap( int width, int height, int depth = -1 );
|
|
|
|
wxBitmap( const char bits[], int width, int height, int depth = 1 );
|
2006-10-08 04:04:49 -04:00
|
|
|
wxBitmap( const char* const* bits );
|
2006-10-31 20:16:01 -05:00
|
|
|
#ifdef wxNEEDS_CHARPP
|
2006-10-30 03:07:51 -05:00
|
|
|
// needed for old GCC
|
|
|
|
wxBitmap(char** data)
|
|
|
|
{
|
|
|
|
*this = wxBitmap(wx_const_cast(const char* const*, data));
|
|
|
|
}
|
|
|
|
#endif
|
2008-09-21 16:03:14 -04:00
|
|
|
wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE );
|
2003-04-27 22:08:57 -04:00
|
|
|
virtual ~wxBitmap();
|
|
|
|
|
2003-04-05 07:11:05 -05:00
|
|
|
static void InitStandardHandlers();
|
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
bool Create(int width, int height, int depth = -1);
|
2006-10-08 04:04:49 -04:00
|
|
|
bool Create(const void* data, wxBitmapType type,
|
2003-04-05 07:11:05 -05:00
|
|
|
int width, int height, int depth = -1);
|
2003-05-07 13:24:11 -04:00
|
|
|
// create the wxBitmap using a _copy_ of the pixmap
|
|
|
|
bool Create(WXPixmap pixmap);
|
2003-04-05 07:11:05 -05:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
int GetHeight() const;
|
|
|
|
int GetWidth() const;
|
|
|
|
int GetDepth() const;
|
2003-04-27 22:08:57 -04:00
|
|
|
|
|
|
|
#if wxUSE_IMAGE
|
|
|
|
wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
|
2002-02-13 03:38:54 -05:00
|
|
|
wxImage ConvertToImage() const;
|
2003-04-27 22:08:57 -04:00
|
|
|
bool CreateFromImage(const wxImage& image, int depth = -1);
|
|
|
|
#endif // wxUSE_IMAGE
|
2002-02-05 11:34:33 -05:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
// copies the contents and mask of the given (colour) icon to the bitmap
|
|
|
|
virtual bool CopyFromIcon(const wxIcon& icon);
|
2002-02-05 11:34:33 -05:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
wxMask *GetMask() const;
|
|
|
|
void SetMask( wxMask *mask );
|
2003-04-27 22:08:57 -04:00
|
|
|
|
2002-02-05 11:34:33 -05:00
|
|
|
wxBitmap GetSubBitmap( const wxRect& rect ) const;
|
2002-02-08 12:44:23 -05:00
|
|
|
|
2003-04-05 07:11:05 -05:00
|
|
|
bool SaveFile( const wxString &name, wxBitmapType type, const wxPalette *palette = (wxPalette *) NULL ) const;
|
2008-09-21 16:03:14 -04:00
|
|
|
bool LoadFile( const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE );
|
2002-02-13 03:38:54 -05:00
|
|
|
|
|
|
|
wxPalette *GetPalette() const;
|
|
|
|
wxPalette *GetColourMap() const
|
|
|
|
{ return GetPalette(); };
|
2003-04-05 07:11:05 -05:00
|
|
|
virtual void SetPalette(const wxPalette& palette);
|
2002-02-13 03:38:54 -05:00
|
|
|
|
|
|
|
// implementation
|
|
|
|
// --------------
|
|
|
|
|
|
|
|
void SetHeight( int height );
|
|
|
|
void SetWidth( int width );
|
|
|
|
void SetDepth( int depth );
|
|
|
|
void SetPixmap( WXPixmap pixmap );
|
|
|
|
void SetBitmap( WXPixmap bitmap );
|
|
|
|
|
|
|
|
WXPixmap GetPixmap() const;
|
|
|
|
WXPixmap GetBitmap() const;
|
2003-04-07 13:39:00 -04:00
|
|
|
|
|
|
|
WXPixmap GetDrawable() const;
|
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
WXDisplay *GetDisplay() const;
|
2003-04-27 22:08:57 -04:00
|
|
|
|
2006-10-30 20:24:10 -05:00
|
|
|
protected:
|
2007-12-15 12:54:20 -05:00
|
|
|
virtual wxGDIRefData *CreateGDIRefData() const;
|
|
|
|
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
|
2006-10-30 20:24:10 -05:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxBitmap)
|
|
|
|
};
|
2002-02-05 11:34:33 -05:00
|
|
|
|
2006-10-30 20:24:10 -05:00
|
|
|
#endif // _WX_BITMAP_H_
|