Audacity  2.2.0
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 <wx/dc.h>
16 #include <wx/dcclient.h>
17 #include <wx/defs.h>
18 #include <wx/dynarray.h>
19 #include <wx/version.h>
20 #include "wxPanelWrapper.h"
21 
22 #if !wxCHECK_VERSION(3,0,0)
23 #define wxRasterOperationMode int
24 #endif
25 
26 WX_DECLARE_OBJARRAY(wxBitmap, BitmapArray);
27 WX_DECLARE_OBJARRAY(wxImage, ImageArray);
28 
29 class ImageRoll
30 {
31  public:
32  enum RollType {
38  };
39 
40  ImageRoll();
41  ImageRoll(const wxImage &src);
42  ImageRoll(RollType type, const wxImage &src, wxColour magicColor);
43 
44  bool Ok() const;
45 
46  wxSize GetMinSize() const { return mMinSize; }
47  wxSize GetMaxSize() const { return mMaxSize; }
48 
49  void Draw(wxDC &dc, wxRect rect,
50  wxRasterOperationMode logicalFunc = wxCOPY);
51 
52  static ImageArray SplitH(const wxImage &src, wxColour magicColor);
53  static ImageArray SplitV(const wxImage &src, wxColour magicColor);
54 
55  protected:
56 
57  void DrawBitmap(wxDC &dc, wxBitmap &bitmap,
58  int x, int y, wxRasterOperationMode logicalFunc = wxCOPY);
59 
60  void Init(RollType type, const wxImage &src, wxColour magicColor);
61 
63  BitmapArray mPieces;
64  wxSize mMinSize;
65  wxSize mMaxSize;
66 };
67 
68 // A very simple class that just display an ImageRoll that doesn't
69 // do anything
70 class ImageRollPanel final : public wxPanelWrapper
71 {
72  public:
73  DECLARE_DYNAMIC_CLASS(ImageRollPanel)
74 
75  ImageRollPanel(wxWindow *parent,
76  wxWindowID id,
77  //ImageRoll &imgRoll,
78  const wxPoint& pos = wxDefaultPosition,
79  const wxSize& size = wxDefaultSize,
80  long style = wxTAB_TRAVERSAL);
81 
83 
84  void OnPaint(wxPaintEvent &evt);
85  void OnSize(wxSizeEvent &evt);
86 
87  protected:
88  //ImageRoll mImageRoll;
89 
91 
92  DECLARE_EVENT_TABLE()
93 
94 };
95 
96 #endif // __AUDACITY_IMAGE_ROLL__
wxSize mMaxSize
Definition: ImageRoll.h:65
void SetLogicalFunction(wxRasterOperationMode func)
Definition: ImageRoll.cpp:439
ImageRollPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
Definition: ImageRoll.cpp:425
void OnPaint(wxPaintEvent &evt)
Definition: ImageRoll.cpp:444
ImageRoll()
Definition: ImageRoll.cpp:283
wxRasterOperationMode mLogicalFunction
Definition: ImageRoll.h:90
BitmapArray mPieces
Definition: ImageRoll.h:63
bool Ok() const
Definition: ImageRoll.cpp:298
Definition: ImageRoll.h:35
Definition: ImageRoll.h:37
wxSize GetMinSize() const
Definition: ImageRoll.h:46
Definition: ImageRoll.h:36
Definition: wxPanelWrapper.h:19
static ImageArray SplitH(const wxImage &src, wxColour magicColor)
Definition: ImageRoll.cpp:110
A wxPanel which displays an ImageRoll.
Definition: ImageRoll.h:70
static ImageArray SplitV(const wxImage &src, wxColour magicColor)
Definition: ImageRoll.cpp:166
Definition: ImageRoll.h:33
RollType mType
Definition: ImageRoll.h:62
void OnSize(wxSizeEvent &evt)
Definition: ImageRoll.cpp:451
WX_DECLARE_OBJARRAY(wxBitmap, BitmapArray)
wxSize mMinSize
Definition: ImageRoll.h:64
RollType
Definition: ImageRoll.h:32
void Draw(wxDC &dc, wxRect rect, wxRasterOperationMode logicalFunc=wxCOPY)
Definition: ImageRoll.cpp:316
#define wxRasterOperationMode
Definition: ImageRoll.h:23
Definition: ImageRoll.h:34
void Init(RollType type, const wxImage &src, wxColour magicColor)
Definition: ImageRoll.cpp:220
void DrawBitmap(wxDC &dc, wxBitmap &bitmap, int x, int y, wxRasterOperationMode logicalFunc=wxCOPY)
Definition: ImageRoll.cpp:303
wxSize GetMaxSize() const
Definition: ImageRoll.h:47
An ImageRoll is an image that can be expanded to an arbitrary size; it is made up of both fixed piece...
Definition: ImageRoll.h:29