Audacity 3.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 <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
25using ImageArray = std::vector<wxImage>;
26
27class 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
74class 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__
std::vector< wxImage > ImageArray
Definition: ImageRoll.h:25
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
void Draw(wxDC &dc, wxRect rect, int logicalFunc)
wxSize mMinSize
Definition: ImageRoll.h:68
wxSize GetMaxSize() const
Definition: ImageRoll.h:48
wxSize GetMinSize() const
Definition: ImageRoll.h:47
@ FixedImage
Definition: ImageRoll.h:32
@ VerticalRoll
Definition: ImageRoll.h:34
@ HorizontalRoll
Definition: ImageRoll.h:33
@ Uninitialized
Definition: ImageRoll.h:31
ImageRoll(const ImageRoll &)
std::vector< wxBitmap > mPieces
Definition: ImageRoll.h:67
wxSize mMaxSize
Definition: ImageRoll.h:69
RollType mType
Definition: ImageRoll.h:65
A wxPanel which displays an ImageRoll.
Definition: ImageRoll.h:75
void SetLogicalFunction(int func)
Definition: ImageRoll.cpp:446
int mLogicalFunction
Definition: ImageRoll.h:94
void OnPaint(wxPaintEvent &evt)
Definition: ImageRoll.cpp:451
ImageRollPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
Definition: ImageRoll.cpp:432
void OnSize(wxSizeEvent &evt)
Definition: ImageRoll.cpp:458