Audacity  3.0.3
ImageRoll.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  ImageRoll.h
6 
7  Dominic Mazzoni
8 
9 
10 **********************************************************************/
11 
12 #ifndef __AUDACITY_IMAGE_ROLL__
13 #define __AUDACITY_IMAGE_ROLL__
14 
15 #include <vector>
16 // #include <wx/dc.h> // for enum wxRasterOperationMode
17 #include <wx/defs.h>
18 #include "wxPanelWrapper.h" // to inherit
19 
20 #if !wxCHECK_VERSION(3,0,0)
21 #define wxRasterOperationMode int
22 #endif
23 
24 // wxImage copies cheaply with reference counting
25 using ImageArray = std::vector<wxImage>;
26 
27 class AUDACITY_DLL_API ImageRoll
28 {
29  public:
30  enum RollType {
35  Frame
36  };
37 
38  ImageRoll();
39  ImageRoll(const wxImage &src);
40  ImageRoll(RollType type, const wxImage &src, wxColour magicColor);
42  ImageRoll &operator =(const ImageRoll&);
44 
45  bool Ok() const;
46 
47  wxSize GetMinSize() const { return mMinSize; }
48  wxSize GetMaxSize() const { return mMaxSize; }
49 
50  void Draw(wxDC &dc, wxRect rect,
51  int /* wxRasterOperationMode */ logicalFunc);
52  void Draw(wxDC &dc, wxRect rect); // default logicalFunc to wxCOPY
53 
54  static ImageArray SplitH(const wxImage &src, wxColour magicColor);
55  static ImageArray SplitV(const wxImage &src, wxColour magicColor);
56 
57  protected:
58 
59  void DrawBitmap(wxDC &dc, wxBitmap &bitmap,
60  int x, int y,
61  int /* wxRasterOperationMode */ logicalFunc);
62 
63  void Init(RollType type, const wxImage &src, wxColour magicColor);
64 
66  // wxBitmap copies cheaply with reference counting
67  std::vector<wxBitmap> mPieces;
68  wxSize mMinSize;
69  wxSize mMaxSize;
70 };
71 
72 // A very simple class that just display an ImageRoll that doesn't
73 // do anything
74 class ImageRollPanel final : public wxPanelWrapper
75 {
76  public:
77  DECLARE_DYNAMIC_CLASS(ImageRollPanel)
78 
79  ImageRollPanel(wxWindow *parent,
80  wxWindowID id,
81  //ImageRoll &imgRoll,
82  const wxPoint& pos = wxDefaultPosition,
83  const wxSize& size = wxDefaultSize,
84  long style = wxTAB_TRAVERSAL);
85 
86  void SetLogicalFunction(int /*wxRasterOperationMode*/ func);
87 
88  void OnPaint(wxPaintEvent &evt);
89  void OnSize(wxSizeEvent &evt);
90 
91  protected:
92  //ImageRoll mImageRoll;
93 
94  int /*wxRasterOperationMode*/ mLogicalFunction;
95 
96  DECLARE_EVENT_TABLE()
97 
98 };
99 
100 #endif // __AUDACITY_IMAGE_ROLL__
size
size_t size
Definition: ffmpeg-2.3.6-single-header.h:412
Init
Definition: ModuleManager.h:152
ImageRoll::HorizontalRoll
@ HorizontalRoll
Definition: ImageRoll.h:33
ImageRoll::mMaxSize
wxSize mMaxSize
Definition: ImageRoll.h:69
ImageRollPanel::OnPaint
void OnPaint(wxPaintEvent &evt)
Definition: ImageRoll.cpp:451
ImageRoll::mPieces
std::vector< wxBitmap > mPieces
Definition: ImageRoll.h:67
wxPanelWrapper
Definition: wxPanelWrapper.h:41
ImageArray
std::vector< wxImage > ImageArray
Definition: ImageRoll.h:25
ImageRoll::ImageRoll
ImageRoll(const ImageRoll &)
wxPanelWrapper.h
ImageRoll::VerticalRoll
@ VerticalRoll
Definition: ImageRoll.h:34
ImageRoll
An ImageRoll is an image that can be expanded to an arbitrary size; it is made up of both fixed piece...
Definition: ImageRoll.h:28
ImageRoll::Uninitialized
@ Uninitialized
Definition: ImageRoll.h:31
ImageRoll::Draw
void Draw(wxDC &dc, wxRect rect, int logicalFunc)
ImageRoll::mType
RollType mType
Definition: ImageRoll.h:65
ImageRollPanel::OnSize
void OnSize(wxSizeEvent &evt)
Definition: ImageRoll.cpp:458
ImageRoll::FixedImage
@ FixedImage
Definition: ImageRoll.h:32
ImageRoll::RollType
RollType
Definition: ImageRoll.h:30
ImageRollPanel::SetLogicalFunction
void SetLogicalFunction(int func)
Definition: ImageRoll.cpp:446
ImageRoll::GetMinSize
wxSize GetMinSize() const
Definition: ImageRoll.h:47
ImageRoll::mMinSize
wxSize mMinSize
Definition: ImageRoll.h:68
ImageRoll::~ImageRoll
~ImageRoll()
ImageRollPanel
A wxPanel which displays an ImageRoll.
Definition: ImageRoll.h:75
ImageRoll::GetMaxSize
wxSize GetMaxSize() const
Definition: ImageRoll.h:48
ImageRollPanel::ImageRollPanel
ImageRollPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
Definition: ImageRoll.cpp:432
ImageRollPanel::mLogicalFunction
int mLogicalFunction
Definition: ImageRoll.h:94