Audacity 3.2.0
Functions
anonymous_namespace{AColor.cpp} Namespace Reference

Functions

void DrawNinePatch (wxDC &dc, wxBitmap &bitmap, const wxRect &r)
 
int GetButtonImageIndex (bool up, bool selected, bool highlight)
 

Function Documentation

◆ DrawNinePatch()

void anonymous_namespace{AColor.cpp}::DrawNinePatch ( wxDC &  dc,
wxBitmap &  bitmap,
const wxRect &  r 
)

Definition at line 84 of file AColor.cpp.

85 {
86 wxMemoryDC memDC;
87 memDC.SelectObject(bitmap);
88
89 // image slices
90
91 const auto uw0 = bitmap.GetWidth() / 2;
92 const auto uw1 = 1;
93 const auto uw2 = bitmap.GetWidth() - uw0 - uw1;
94
95 const auto vh0 = bitmap.GetHeight() / 2;
96 const auto vh1 = 1;
97 const auto vh2 = bitmap.GetHeight() - vh1 - vh0;
98
99 const auto u0 = 0;
100 const auto u1 = uw0;
101 const auto u2 = uw0 + uw1;
102
103 const auto v0 = 0;
104 const auto v1 = vh0;
105 const auto v2 = vh0 + vh1;
106
107 //Button geometry
108
109 const auto xw0 = std::min(uw0, r.width / 2);
110 const auto xw2 = std::min(uw2, r.width / 2);
111 const auto xw1 = r.width - xw0 - xw2;
112
113 const auto yh0 = std::min(vh0, r.height / 2);
114 const auto yh2 = std::min(vh2, r.height / 2);
115 const auto yh1 = r.height - yh0 - yh2;
116
117 const auto x0 = r.x;
118 const auto x1 = r.x + xw0;
119 const auto x2 = r.x + xw0 + xw1;
120
121 const auto y0 = r.y;
122 const auto y1 = r.y + yh0;
123 const auto y2 = r.y + yh0 + yh1;
124
125 dc.StretchBlit(x0, y0, xw0, yh0, &memDC, u0, v0, uw0, vh0, wxCOPY, true);
126 dc.StretchBlit(x1, y0, xw1, yh0, &memDC, u1, v0, uw1, vh0, wxCOPY, true);
127 dc.StretchBlit(x2, y0, xw2, yh0, &memDC, u2, v0, uw2, vh0, wxCOPY, true);
128
129 dc.StretchBlit(x0, y1, xw0, yh1, &memDC, u0, v1, uw0, vh1, wxCOPY, true);
130 dc.StretchBlit(x1, y1, xw1, yh1, &memDC, u1, v1, uw1, vh1, wxCOPY, true);
131 dc.StretchBlit(x2, y1, xw2, yh1, &memDC, u2, v1, uw2, vh1, wxCOPY, true);
132
133 dc.StretchBlit(x0, y2, xw0, yh2, &memDC, u0, v2, uw0, vh2, wxCOPY, true);
134 dc.StretchBlit(x1, y2, xw1, yh2, &memDC, u1, v2, uw1, vh2, wxCOPY, true);
135 dc.StretchBlit(x2, y2, xw2, yh2, &memDC, u2, v2, uw2, vh2, wxCOPY, true);
136 }
int min(int a, int b)

References min().

Referenced by AColor::ButtonStretch(), and AColor::DrawFrame().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetButtonImageIndex()

int anonymous_namespace{AColor.cpp}::GetButtonImageIndex ( bool  up,
bool  selected,
bool  highlight 
)

Definition at line 138 of file AColor.cpp.

139 {
140 // There are eight button states in the TCP.
141 // A theme might not differentiate among them all. That's up to
142 // the theme designer.
143 // Button highlighted (i.e. hovered over) or not.
144 // Track selected or not
145 // Button up or down.
146 // Highlight in most themes is lighter than not highlighted.
147 if ( highlight && selected)
148 return up ? bmpHiliteUpButtonExpandSel : bmpHiliteButtonExpandSel;
149 if ( highlight )
150 return up ? bmpHiliteUpButtonExpand : bmpHiliteButtonExpand;
151 if( selected )
152 return up ? bmpUpButtonExpandSel : bmpDownButtonExpandSel;
153 return up ? bmpUpButtonExpand : bmpDownButtonExpand;
154 }

Referenced by AColor::Bevel2(), and AColor::ButtonStretch().

Here is the caller graph for this function: