Skip to content

Commit

Permalink
Vitalium: Use SVG Logo
Browse files Browse the repository at this point in the history
closes #103
  • Loading branch information
DarkRTA authored and falkTX committed Dec 11, 2023
1 parent 20e578d commit 51eb55f
Show file tree
Hide file tree
Showing 8 changed files with 563 additions and 65,211 deletions.
65,593 changes: 418 additions & 65,175 deletions ports-juce6.0/vitalium/resources/BinaryData.cpp

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions ports-juce6.0/vitalium/resources/BinaryData.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,6 @@ namespace BinaryData
extern const char* MontserratRegular_ttf;
const int MontserratRegular_ttfSize = 245708;

#endif
extern const char* default_vitalskin;
const int default_vitalskinSize = 12912;

#ifdef TUNINGS
extern const char* _5_Limit_scl;
const int _5_Limit_sclSize = 87;

#endif
#ifdef TUNINGS
extern const char* _7_Limit_scl;
const int _7_Limit_sclSize = 85;

#endif
#ifdef TUNINGS
extern const char* Pythagorean_scl;
const int Pythagorean_sclSize = 108;

#endif
#ifdef ICONS
extern const char* chorus_svg;
Expand Down Expand Up @@ -117,10 +99,28 @@ namespace BinaryData
const int shuffle_svgSize = 382;

#endif
extern const char* vitaliumunfa_png;
const int vitaliumunfa_pngSize = 36106;
#ifdef TUNINGS
extern const char* _5_Limit_scl;
const int _5_Limit_sclSize = 87;

#endif
#ifdef TUNINGS
extern const char* _7_Limit_scl;
const int _7_Limit_sclSize = 85;

#endif
#ifdef TUNINGS
extern const char* Pythagorean_scl;
const int Pythagorean_sclSize = 108;

#endif
extern const char* default_vitalskin;
const int default_vitalskinSize = 12912;

extern const char* vitaliumunfabg_svg;
const int vitaliumunfabg_svgSize = 1051;

extern const char* BinaryData_cpp;
const int BinaryData_cppSize = 2555792;
extern const char* vitaliumunfafg_svg;
const int vitaliumunfafg_svgSize = 540;

}
28 changes: 28 additions & 0 deletions ports-juce6.0/vitalium/resources/vitalium-unfa-bg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions ports-juce6.0/vitalium/resources/vitalium-unfa-fg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed ports-juce6.0/vitalium/resources/vitalium-unfa.png
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,37 @@

class LogoButton : public Button {
public:
LogoButton(const String& name) : Button(name), logo_(Paths::vitaliumLogo()) {
LogoButton(const String& name) : Button(name) {
image_component_.setComponent(this);
}

void setPaths(const Path& letter, const Path& ring) {
letter_ = letter;
ring_ = ring;
}

void resized() override {
logo_->setTransformToFit(getLocalBounds().toFloat(), RectanglePlacement::stretchToFit);
Rectangle<float> bounds = getLocalBounds().toFloat();
letter_.applyTransform(letter_.getTransformToScaleToFit(bounds, true));
ring_.applyTransform(ring_.getTransformToScaleToFit(bounds, true));

redoImage();
}

void paintButton(Graphics& g, bool hover, bool down) override {
logo_->setTransformToFit(getLocalBounds().toFloat(), RectanglePlacement::stretchToFit);
logo_->draw(g, 1.0f);
Rectangle<float> bounds = getLocalBounds().toFloat();
letter_.applyTransform(letter_.getTransformToScaleToFit(bounds, true));
ring_.applyTransform(ring_.getTransformToScaleToFit(bounds, true));

g.setColour(findColour(Skin::kShadow, true));

ColourGradient letter_gradient(letter_top_color_, 0.0f, 0.0f, letter_bottom_color_, 0.0f, getHeight(), false);
ColourGradient ring_gradient(ring_top_color_, 0.0f, 0.0f, ring_bottom_color_, 0.0f, getHeight(), false);
g.setGradientFill(letter_gradient);
g.fillPath(letter_);

g.setGradientFill(ring_gradient);
g.fillPath(ring_);

if (hover) {
g.setColour(findColour(Skin::kLightenScreen, true));
Expand All @@ -49,6 +67,18 @@ class LogoButton : public Button {
}
}

void setLetterColors(Colour top, Colour bottom) {
letter_top_color_ = top;
letter_bottom_color_ = bottom;
redoImage();
}

void setRingColors(Colour top, Colour bottom) {
ring_top_color_ = top;
ring_bottom_color_ = bottom;
redoImage();
}

void mouseEnter(const MouseEvent& e) override {
Button::mouseEnter(e);
image_component_.setColor(Colour(0xffdddddd));
Expand All @@ -65,12 +95,20 @@ class LogoButton : public Button {
private:
OpenGlImageComponent image_component_;

std::unique_ptr<Drawable> logo_;
Path letter_;
Path ring_;

Colour letter_top_color_;
Colour letter_bottom_color_;

Colour ring_top_color_;
Colour ring_bottom_color_;
};

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

void LogoSection::paintBackground(Graphics&) {
void LogoSection::paintBackground(Graphics& g) {
if (logo_button_) {
logo_button_->setRingColors(findColour(Skin::kWidgetPrimary1, true), findColour(Skin::kWidgetPrimary2, true));
logo_button_->setLetterColors(findColour(Skin::kWidgetSecondary1, true), findColour(Skin::kWidgetSecondary2, true));
}
}

void LogoSection::buttonClicked(Button* clicked_button) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,30 @@ class LoadingWheel : public OpenGlQuad {
class AppLogo : public OpenGlImageComponent {
public:
AppLogo(String name) : OpenGlImageComponent(std::move(name)) {
logo_ = Paths::vitaliumLogo();
logo_letter_ = Paths::unfaLogoFg();
logo_ring_ = Paths::unfaLogoBg();
}

void paint(Graphics& g) override {
logo_->setTransformToFit(getLocalBounds().toFloat(), RectanglePlacement::stretchToFit);
logo_->draw(g, 1.0f);
logo_letter_.applyTransform(logo_letter_.getTransformToScaleToFit(getLocalBounds().toFloat(), true));
logo_ring_.applyTransform(logo_ring_.getTransformToScaleToFit(getLocalBounds().toFloat(), true));

Colour letter_top_color = findColour(Skin::kWidgetSecondary1, true);
Colour letter_bottom_color = findColour(Skin::kWidgetSecondary2, true);
Colour ring_top_color = findColour(Skin::kWidgetPrimary1, true);
Colour ring_bottom_color = findColour(Skin::kWidgetPrimary2, true);
ColourGradient letter_gradient(letter_top_color, 0.0f, 12.0f, letter_bottom_color, 0.0f, 96.0f, false);
ColourGradient ring_gradient(ring_top_color, 0.0f, 12.0f, ring_bottom_color, 0.0f, 96.0f, false);
g.setGradientFill(letter_gradient);
g.fillPath(logo_letter_);

g.setGradientFill(ring_gradient);
g.fillPath(logo_ring_);
}

private:
std::unique_ptr<Drawable> logo_;
Path logo_letter_;
Path logo_ring_;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AppLogo)
};
Expand Down
17 changes: 13 additions & 4 deletions ports-juce6.0/vitalium/source/interface/look_and_feel/paths.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

class Paths {
public:
static constexpr int kLogoWidth = 1701;
static constexpr int kLogoWidth = 467;

Paths() = delete;

Expand All @@ -33,9 +33,18 @@ class Paths {
return drawable->getOutlineAsPath();
}

static std::unique_ptr<Drawable> vitaliumLogo() {
return Drawable::createFromImageData((const void*)BinaryData::vitaliumunfa_png,
BinaryData::vitaliumunfa_pngSize);
static Path unfaLogoBg() {
Path path = fromSvgData((const void*)BinaryData::vitaliumunfabg_svg, BinaryData::vitaliumunfabg_svgSize);
path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
path.addLineSegment(Line<float>(kLogoWidth, kLogoWidth, kLogoWidth, kLogoWidth), 0.2f);
return path;
}

static Path unfaLogoFg() {
Path path = fromSvgData((const void*)BinaryData::vitaliumunfafg_svg, BinaryData::vitaliumunfafg_svgSize);
path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
path.addLineSegment(Line<float>(kLogoWidth, kLogoWidth, kLogoWidth, kLogoWidth), 0.2f);
return path;
}

static Path chorus() {
Expand Down

0 comments on commit 51eb55f

Please sign in to comment.