bitmap.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/dfb/bitmap.h
  3. // Purpose: wxBitmap class
  4. // Author: Vaclav Slavik
  5. // Created: 2006-08-04
  6. // Copyright: (c) 2006 REA Elektronik GmbH
  7. // Licence: wxWindows licence
  8. /////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_DFB_BITMAP_H_
  10. #define _WX_DFB_BITMAP_H_
  11. #include "wx/dfb/dfbptr.h"
  12. class WXDLLIMPEXP_FWD_CORE wxPixelDataBase;
  13. wxDFB_DECLARE_INTERFACE(IDirectFBSurface);
  14. //-----------------------------------------------------------------------------
  15. // wxBitmap
  16. //-----------------------------------------------------------------------------
  17. class WXDLLIMPEXP_CORE wxBitmap : public wxBitmapBase
  18. {
  19. public:
  20. wxBitmap() {}
  21. wxBitmap(const wxIDirectFBSurfacePtr& surface) { Create(surface); }
  22. wxBitmap(int width, int height, int depth = -1) { Create(width, height, depth); }
  23. wxBitmap(const wxSize& sz, int depth = -1) { Create(sz, depth); }
  24. wxBitmap(const char bits[], int width, int height, int depth = 1);
  25. wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);
  26. wxBitmap(const char* const* bits);
  27. #if wxUSE_IMAGE
  28. wxBitmap(const wxImage& image, int depth = -1);
  29. #endif
  30. bool Create(const wxIDirectFBSurfacePtr& surface);
  31. bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
  32. bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
  33. { return Create(sz.GetWidth(), sz.GetHeight(), depth); }
  34. bool Create(int width, int height, const wxDC& WXUNUSED(dc))
  35. { return Create(width,height); }
  36. virtual int GetHeight() const;
  37. virtual int GetWidth() const;
  38. virtual int GetDepth() const;
  39. #if wxUSE_IMAGE
  40. virtual wxImage ConvertToImage() const;
  41. #endif
  42. virtual wxMask *GetMask() const;
  43. virtual void SetMask(wxMask *mask);
  44. virtual wxBitmap GetSubBitmap(const wxRect& rect) const;
  45. virtual bool SaveFile(const wxString &name, wxBitmapType type,
  46. const wxPalette *palette = NULL) const;
  47. virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);
  48. #if wxUSE_PALETTE
  49. virtual wxPalette *GetPalette() const;
  50. virtual void SetPalette(const wxPalette& palette);
  51. #endif
  52. // copies the contents and mask of the given (colour) icon to the bitmap
  53. virtual bool CopyFromIcon(const wxIcon& icon);
  54. static void InitStandardHandlers();
  55. // raw bitmap access support functions
  56. void *GetRawData(wxPixelDataBase& data, int bpp);
  57. void UngetRawData(wxPixelDataBase& data);
  58. bool HasAlpha() const;
  59. // implementation:
  60. virtual void SetHeight(int height);
  61. virtual void SetWidth(int width);
  62. virtual void SetDepth(int depth);
  63. // get underlying native representation:
  64. wxIDirectFBSurfacePtr GetDirectFBSurface() const;
  65. protected:
  66. virtual wxGDIRefData *CreateGDIRefData() const;
  67. virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
  68. bool CreateWithFormat(int width, int height, int dfbFormat);
  69. DECLARE_DYNAMIC_CLASS(wxBitmap)
  70. };
  71. #endif // _WX_DFB_BITMAP_H_