Skip to content

Commit 51eb55f

Browse files
DarkRTAfalkTX
authored andcommitted
Vitalium: Use SVG Logo
closes #103
1 parent 20e578d commit 51eb55f

File tree

8 files changed

+563
-65211
lines changed

8 files changed

+563
-65211
lines changed

ports-juce6.0/vitalium/resources/BinaryData.cpp

Lines changed: 418 additions & 65175 deletions
Large diffs are not rendered by default.

ports-juce6.0/vitalium/resources/BinaryData.h

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,6 @@ namespace BinaryData
2828
extern const char* MontserratRegular_ttf;
2929
const int MontserratRegular_ttfSize = 245708;
3030

31-
#endif
32-
extern const char* default_vitalskin;
33-
const int default_vitalskinSize = 12912;
34-
35-
#ifdef TUNINGS
36-
extern const char* _5_Limit_scl;
37-
const int _5_Limit_sclSize = 87;
38-
39-
#endif
40-
#ifdef TUNINGS
41-
extern const char* _7_Limit_scl;
42-
const int _7_Limit_sclSize = 85;
43-
44-
#endif
45-
#ifdef TUNINGS
46-
extern const char* Pythagorean_scl;
47-
const int Pythagorean_sclSize = 108;
48-
4931
#endif
5032
#ifdef ICONS
5133
extern const char* chorus_svg;
@@ -117,10 +99,28 @@ namespace BinaryData
11799
const int shuffle_svgSize = 382;
118100

119101
#endif
120-
extern const char* vitaliumunfa_png;
121-
const int vitaliumunfa_pngSize = 36106;
102+
#ifdef TUNINGS
103+
extern const char* _5_Limit_scl;
104+
const int _5_Limit_sclSize = 87;
105+
106+
#endif
107+
#ifdef TUNINGS
108+
extern const char* _7_Limit_scl;
109+
const int _7_Limit_sclSize = 85;
110+
111+
#endif
112+
#ifdef TUNINGS
113+
extern const char* Pythagorean_scl;
114+
const int Pythagorean_sclSize = 108;
115+
116+
#endif
117+
extern const char* default_vitalskin;
118+
const int default_vitalskinSize = 12912;
119+
120+
extern const char* vitaliumunfabg_svg;
121+
const int vitaliumunfabg_svgSize = 1051;
122122

123-
extern const char* BinaryData_cpp;
124-
const int BinaryData_cppSize = 2555792;
123+
extern const char* vitaliumunfafg_svg;
124+
const int vitaliumunfafg_svgSize = 540;
125125

126126
}
Lines changed: 28 additions & 0 deletions
Loading
Lines changed: 16 additions & 0 deletions
Loading
Binary file not shown.

ports-juce6.0/vitalium/source/interface/editor_sections/header_section.cpp

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,37 @@
2525

2626
class LogoButton : public Button {
2727
public:
28-
LogoButton(const String& name) : Button(name), logo_(Paths::vitaliumLogo()) {
28+
LogoButton(const String& name) : Button(name) {
2929
image_component_.setComponent(this);
3030
}
3131

32+
void setPaths(const Path& letter, const Path& ring) {
33+
letter_ = letter;
34+
ring_ = ring;
35+
}
36+
3237
void resized() override {
33-
logo_->setTransformToFit(getLocalBounds().toFloat(), RectanglePlacement::stretchToFit);
38+
Rectangle<float> bounds = getLocalBounds().toFloat();
39+
letter_.applyTransform(letter_.getTransformToScaleToFit(bounds, true));
40+
ring_.applyTransform(ring_.getTransformToScaleToFit(bounds, true));
3441

3542
redoImage();
3643
}
3744

3845
void paintButton(Graphics& g, bool hover, bool down) override {
39-
logo_->setTransformToFit(getLocalBounds().toFloat(), RectanglePlacement::stretchToFit);
40-
logo_->draw(g, 1.0f);
46+
Rectangle<float> bounds = getLocalBounds().toFloat();
47+
letter_.applyTransform(letter_.getTransformToScaleToFit(bounds, true));
48+
ring_.applyTransform(ring_.getTransformToScaleToFit(bounds, true));
49+
50+
g.setColour(findColour(Skin::kShadow, true));
51+
52+
ColourGradient letter_gradient(letter_top_color_, 0.0f, 0.0f, letter_bottom_color_, 0.0f, getHeight(), false);
53+
ColourGradient ring_gradient(ring_top_color_, 0.0f, 0.0f, ring_bottom_color_, 0.0f, getHeight(), false);
54+
g.setGradientFill(letter_gradient);
55+
g.fillPath(letter_);
56+
57+
g.setGradientFill(ring_gradient);
58+
g.fillPath(ring_);
4159

4260
if (hover) {
4361
g.setColour(findColour(Skin::kLightenScreen, true));
@@ -49,6 +67,18 @@ class LogoButton : public Button {
4967
}
5068
}
5169

70+
void setLetterColors(Colour top, Colour bottom) {
71+
letter_top_color_ = top;
72+
letter_bottom_color_ = bottom;
73+
redoImage();
74+
}
75+
76+
void setRingColors(Colour top, Colour bottom) {
77+
ring_top_color_ = top;
78+
ring_bottom_color_ = bottom;
79+
redoImage();
80+
}
81+
5282
void mouseEnter(const MouseEvent& e) override {
5383
Button::mouseEnter(e);
5484
image_component_.setColor(Colour(0xffdddddd));
@@ -65,12 +95,20 @@ class LogoButton : public Button {
6595
private:
6696
OpenGlImageComponent image_component_;
6797

68-
std::unique_ptr<Drawable> logo_;
98+
Path letter_;
99+
Path ring_;
100+
101+
Colour letter_top_color_;
102+
Colour letter_bottom_color_;
103+
104+
Colour ring_top_color_;
105+
Colour ring_bottom_color_;
69106
};
70107

71108
LogoSection::LogoSection() : SynthSection("logo_section") {
72109
#if !defined(NO_TEXT_ENTRY)
73110
logo_button_ = std::make_unique<LogoButton>("logo");
111+
logo_button_->setPaths(Paths::unfaLogoFg(), Paths::unfaLogoBg());
74112
addAndMakeVisible(logo_button_.get());
75113
addOpenGlComponent(logo_button_->getImageComponent());
76114
logo_button_->addListener(this);
@@ -87,7 +125,11 @@ void LogoSection::resized() {
87125
logo_button_->setBounds(logo_padding_x, logo_padding_y, logo_height, logo_height);
88126
}
89127

90-
void LogoSection::paintBackground(Graphics&) {
128+
void LogoSection::paintBackground(Graphics& g) {
129+
if (logo_button_) {
130+
logo_button_->setRingColors(findColour(Skin::kWidgetPrimary1, true), findColour(Skin::kWidgetPrimary2, true));
131+
logo_button_->setLetterColors(findColour(Skin::kWidgetSecondary1, true), findColour(Skin::kWidgetSecondary2, true));
132+
}
91133
}
92134

93135
void LogoSection::buttonClicked(Button* clicked_button) {

ports-juce6.0/vitalium/source/interface/editor_sections/synth_section.h

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,30 @@ class LoadingWheel : public OpenGlQuad {
112112
class AppLogo : public OpenGlImageComponent {
113113
public:
114114
AppLogo(String name) : OpenGlImageComponent(std::move(name)) {
115-
logo_ = Paths::vitaliumLogo();
115+
logo_letter_ = Paths::unfaLogoFg();
116+
logo_ring_ = Paths::unfaLogoBg();
116117
}
117118

118119
void paint(Graphics& g) override {
119-
logo_->setTransformToFit(getLocalBounds().toFloat(), RectanglePlacement::stretchToFit);
120-
logo_->draw(g, 1.0f);
120+
logo_letter_.applyTransform(logo_letter_.getTransformToScaleToFit(getLocalBounds().toFloat(), true));
121+
logo_ring_.applyTransform(logo_ring_.getTransformToScaleToFit(getLocalBounds().toFloat(), true));
122+
123+
Colour letter_top_color = findColour(Skin::kWidgetSecondary1, true);
124+
Colour letter_bottom_color = findColour(Skin::kWidgetSecondary2, true);
125+
Colour ring_top_color = findColour(Skin::kWidgetPrimary1, true);
126+
Colour ring_bottom_color = findColour(Skin::kWidgetPrimary2, true);
127+
ColourGradient letter_gradient(letter_top_color, 0.0f, 12.0f, letter_bottom_color, 0.0f, 96.0f, false);
128+
ColourGradient ring_gradient(ring_top_color, 0.0f, 12.0f, ring_bottom_color, 0.0f, 96.0f, false);
129+
g.setGradientFill(letter_gradient);
130+
g.fillPath(logo_letter_);
131+
132+
g.setGradientFill(ring_gradient);
133+
g.fillPath(logo_ring_);
121134
}
122135

123136
private:
124-
std::unique_ptr<Drawable> logo_;
137+
Path logo_letter_;
138+
Path logo_ring_;
125139

126140
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AppLogo)
127141
};

ports-juce6.0/vitalium/source/interface/look_and_feel/paths.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
class Paths {
2626
public:
27-
static constexpr int kLogoWidth = 1701;
27+
static constexpr int kLogoWidth = 467;
2828

2929
Paths() = delete;
3030

@@ -33,9 +33,18 @@ class Paths {
3333
return drawable->getOutlineAsPath();
3434
}
3535

36-
static std::unique_ptr<Drawable> vitaliumLogo() {
37-
return Drawable::createFromImageData((const void*)BinaryData::vitaliumunfa_png,
38-
BinaryData::vitaliumunfa_pngSize);
36+
static Path unfaLogoBg() {
37+
Path path = fromSvgData((const void*)BinaryData::vitaliumunfabg_svg, BinaryData::vitaliumunfabg_svgSize);
38+
path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
39+
path.addLineSegment(Line<float>(kLogoWidth, kLogoWidth, kLogoWidth, kLogoWidth), 0.2f);
40+
return path;
41+
}
42+
43+
static Path unfaLogoFg() {
44+
Path path = fromSvgData((const void*)BinaryData::vitaliumunfafg_svg, BinaryData::vitaliumunfafg_svgSize);
45+
path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
46+
path.addLineSegment(Line<float>(kLogoWidth, kLogoWidth, kLogoWidth, kLogoWidth), 0.2f);
47+
return path;
3948
}
4049

4150
static Path chorus() {

0 commit comments

Comments
 (0)