X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/732d8c74f805e35cd398711fcd3969c4c668e259..66c2bf7b1d9326fb650acfaae22ec50528cfbf7c:/include/wx/msw/bitmap.h diff --git a/include/wx/msw/bitmap.h b/include/wx/msw/bitmap.h index 515ceb966e..ef07317b1d 100644 --- a/include/wx/msw/bitmap.h +++ b/include/wx/msw/bitmap.h @@ -4,7 +4,6 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id$ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,6 +12,7 @@ #define _WX_BITMAP_H_ #include "wx/msw/gdiimage.h" +#include "wx/math.h" #include "wx/palette.h" class WXDLLIMPEXP_FWD_CORE wxBitmap; @@ -25,7 +25,6 @@ class WXDLLIMPEXP_FWD_CORE wxDC; class WXDLLIMPEXP_FWD_CORE wxDIB; #endif class WXDLLIMPEXP_FWD_CORE wxIcon; -class WXDLLIMPEXP_FWD_CORE wxImage; class WXDLLIMPEXP_FWD_CORE wxMask; class WXDLLIMPEXP_FWD_CORE wxPalette; class WXDLLIMPEXP_FWD_CORE wxPixelDataBase; @@ -44,7 +43,8 @@ enum wxBitmapTransparency // NOTE: for wxMSW we don't use the wxBitmapBase base class declared in bitmap.h! // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxBitmap : public wxGDIImage +class WXDLLIMPEXP_CORE wxBitmap : public wxGDIImage, + public wxBitmapHelpers { public: // default ctor creates an invalid bitmap, you must Create() it later @@ -115,6 +115,7 @@ public: #if wxUSE_IMAGE wxImage ConvertToImage() const; + wxBitmap ConvertToDisabled(unsigned char brightness = 255) const; #endif // wxUSE_IMAGE // get the given part of bitmap @@ -143,6 +144,9 @@ public: virtual bool Create(int width, int height, const wxDC& dc); virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1); + virtual bool CreateScaled(int w, int h, int d, double logicalScale) + { return Create(wxRound(w*logicalScale), wxRound(h*logicalScale), d); } + virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const; @@ -159,7 +163,6 @@ public: #endif // wxUSE_PALETTE wxMask *GetMask() const; - wxBitmap GetMaskBitmap() const; void SetMask(wxMask *mask); // these functions are internal and shouldn't be used, they risk to @@ -167,6 +170,13 @@ public: bool HasAlpha() const; void UseAlpha(); + // support for scaled bitmaps + virtual double GetScaleFactor() const { return 1.0; } + virtual double GetScaledWidth() const { return GetWidth() / GetScaleFactor(); } + virtual double GetScaledHeight() const { return GetHeight() / GetScaleFactor(); } + virtual wxSize GetScaledSize() const + { return wxSize(wxRound(GetScaledWidth()), wxRound(GetScaledHeight())); } + // implementation only from now on // ------------------------------- @@ -174,10 +184,8 @@ public: void SetHBITMAP(WXHBITMAP bmp) { SetHandle((WXHANDLE)bmp); } WXHBITMAP GetHBITMAP() const { return (WXHBITMAP)GetHandle(); } -#ifdef __WXDEBUG__ void SetSelectedInto(wxDC *dc); wxDC *GetSelectedInto() const; -#endif // __WXDEBUG__ protected: virtual wxGDIImageRefData *CreateData() const; @@ -239,6 +247,8 @@ public: bool Create(const wxBitmap& bitmap, int paletteIndex); bool Create(const wxBitmap& bitmap); + wxBitmap GetBitmap() const; + // Implementation WXHBITMAP GetMaskBitmap() const { return m_maskBitmap; } void SetMaskBitmap(WXHBITMAP bmp) { m_maskBitmap = bmp; }