Debian Codegraph @

libraries/lib-wave-track-paint/waveform/WavePaintParameters.h

raw
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*!********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 WavePaintParameters.h
7
8 Dmitry Vedenko
9
10 **********************************************************************/
11 #pragma once
12
13 #include "graphics/Color.h"
14
15 class Envelope;
16
17 //! Pair of colors for waveform painting
18 struct WAVE_TRACK_PAINT_API ColorPair final
19 {
20 //! Color for the normal state
21 graphics::Color Normal;
22 //! Color for the selected state
23 graphics::Color Selected;
24
25 friend WAVE_TRACK_PAINT_API bool
26 operator==(const ColorPair& lhs, const ColorPair& rhs) noexcept;
27 friend WAVE_TRACK_PAINT_API bool
28 operator!=(const ColorPair& lhs, const ColorPair& rhs) noexcept;
29 };
30
31 //! Parameters for the waveform painting
32 struct WAVE_TRACK_PAINT_API WavePaintParameters final
33 {
34 //! Attached volume envelope, if any
35 const Envelope* AttachedEnvelope { nullptr };
36
37 //! Height of the of clip on screen
38 int Height { 0 };
39
40
41 //! Min value used to clip the output
42 double Min { -1.0 };
43 //! Max value used to clip the output
44 double Max { 1.0 };
45
46 //! Decibel range
47 double DBRange { 60.0 };
48 //! True, if we paint in dB scale
49 bool DBScale { false };
50
51 //! True, if we mark clipped values
52 bool ShowClipping { false };
53
54 //! True, if we paint envelope
55 bool DrawEnvelope { false };
56
57 //! True, if we paint RMS values on top of min and max
58 bool ShowRMS { false };
59
60 //! Color outside the waveform area
61 graphics::Color BlankColor;
62 graphics::Color ZeroLineColor;
63
64 //! Waveform background color
65 ColorPair BackgroundColors;
66 //! Color of the (min, max) line
67 ColorPair SampleColors;
68 //! Color of the (-rms, +rms) line
69 ColorPair RMSColors;
70 //! Color for the columns where clipping has occurred
71 ColorPair ClippingColors;
72 //! Color for the envelope band
73 ColorPair EnvelopeColors;
74
75 //! Sets the basic painting parameters
76 WavePaintParameters& SetDisplayParameters(int height, double zoomMin, double zoomMax, bool showClipping) noexcept;
77 //! Sets the dB scale parameters
78 WavePaintParameters& SetDBParameters(double dbRange, bool dbScale) noexcept;
79 //! Sets the blank color
80 WavePaintParameters& SetBlankColor(graphics::Color color) noexcept;
81 //! Sets the horizontal zero line color
82 WavePaintParameters& SetZeroLineColor(graphics::Color color) noexcept;
83 //! Sets the background colors
84 WavePaintParameters& SetBackgroundColors(
85 graphics::Color normal, graphics::Color selected) noexcept;
86 //! Sets the sample colors
87 WavePaintParameters&
88 SetSampleColors(graphics::Color normal, graphics::Color selected) noexcept;
89 //! Sets the RMS colors
90 WavePaintParameters&
91 SetRMSColors(graphics::Color normal, graphics::Color selected) noexcept;
92 //! Sets the clipping colors
93 WavePaintParameters&
94 SetClippingColors(graphics::Color normal, graphics::Color selected) noexcept;
95 //! Sets the envelope colors
96 WavePaintParameters&
97 SetEnvelopeColors(graphics::Color normal, graphics::Color selected) noexcept;
98 //! Sets volume envelope
99 WavePaintParameters& SetEnvelope(const Envelope& envelope) noexcept;
100 //! Resets the envelope
101 WavePaintParameters& ResetEnvelope() noexcept;
102 //! Sets the ShowRMS flag
103 WavePaintParameters& SetShowRMS(bool showRMS) noexcept;
104 //! Sets the DrawEnvelope flag
105 WavePaintParameters& SetDrawEnvelope(bool drawEnvelope) noexcept;
106
107 friend WAVE_TRACK_PAINT_API bool operator==(
108 const WavePaintParameters& lhs,
109 const WavePaintParameters& rhs) noexcept;
110
111 friend WAVE_TRACK_PAINT_API bool operator!=(
112 const WavePaintParameters& lhs,
113 const WavePaintParameters& rhs) noexcept;
114 };