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