From 8eb5bf6800c7134ba55614ee06b85b7b30a8a191 Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 1 Mar 2021 16:35:40 +0000 Subject: [PATCH] Use png logo Signed-off-by: falkTX --- .../editor_sections/about_section.cpp | 5 +- .../editor_sections/header_section.cpp | 68 ++----------------- .../interface/editor_sections/synth_section.h | 27 ++------ .../source/interface/look_and_feel/paths.h | 15 +--- 4 files changed, 16 insertions(+), 99 deletions(-) diff --git a/ports/vitalium/source/interface/editor_sections/about_section.cpp b/ports/vitalium/source/interface/editor_sections/about_section.cpp index 56089b92..e0d1da23 100644 --- a/ports/vitalium/source/interface/editor_sections/about_section.cpp +++ b/ports/vitalium/source/interface/editor_sections/about_section.cpp @@ -46,7 +46,8 @@ AboutSection::AboutSection(const String& name) : Overlay(name), body_(Shaders::k version_text_->setFontType(PlainTextComponent::kLight); version_text_->setTextSize(12.0f); - fork_text_ = std::make_unique("About fork", String("Vital fork by falkTX")); + fork_text_ = std::make_unique("About fork", + String("Original plugin by Matt Tytel\nVital fork by falkTX\nIcon design by unfa")); addOpenGlComponent(fork_text_.get()); fork_text_->setFontType(PlainTextComponent::kLight); fork_text_->setTextSize(14.0f); @@ -138,7 +139,7 @@ void AboutSection::resized() { version_text_->setBounds(info_rect.getX() + name_x, info_rect.getY() + padding_y + 76 * size_ratio_, info_rect.getWidth() - name_x - kNameRightBuffer * size_ratio_, 32 * size_ratio_); fork_text_->setBounds(info_rect.getX() + name_x, info_rect.getY() + padding_y + 110 * size_ratio_, - info_rect.getWidth() + name_x, 40 * size_ratio_); + info_rect.getWidth() + name_x, 70 * size_ratio_); int size_padding = 5 * size_ratio_; int size_start_x = info_rect.getX() + padding_x; diff --git a/ports/vitalium/source/interface/editor_sections/header_section.cpp b/ports/vitalium/source/interface/editor_sections/header_section.cpp index 07b58aeb..52eba975 100644 --- a/ports/vitalium/source/interface/editor_sections/header_section.cpp +++ b/ports/vitalium/source/interface/editor_sections/header_section.cpp @@ -25,49 +25,19 @@ class LogoButton : public Button { public: - LogoButton(const String& name) : Button(name) { + LogoButton(const String& name) : Button(name), logo_(Paths::vitaliumLogo()) { image_component_.setComponent(this); } - void setPaths(const Path& letter, const Path& ring) { - letter_ = letter; - ring_ = ring; - } - void resized() override { - const DropShadow shadow(Colours::white, 5, Point(0, 0)); - - if (shadow_.getWidth() == getWidth() && shadow_.getHeight() == getHeight()) - return; - - Rectangle bounds = getLocalBounds().toFloat(); - letter_.applyTransform(letter_.getTransformToScaleToFit(bounds, true)); - ring_.applyTransform(ring_.getTransformToScaleToFit(bounds, true)); - - shadow_ = Image(Image::SingleChannel, getWidth(), getHeight(), true); - - Graphics shadow_g(shadow_); - shadow.drawForPath(shadow_g, letter_); - shadow.drawForPath(shadow_g, ring_); + logo_->setTransformToFit(getLocalBounds().toFloat(), RectanglePlacement::stretchToFit); redoImage(); } void paintButton(Graphics& g, bool hover, bool down) override { - Rectangle bounds = getLocalBounds().toFloat(); - letter_.applyTransform(letter_.getTransformToScaleToFit(bounds, true)); - ring_.applyTransform(ring_.getTransformToScaleToFit(bounds, true)); - - g.setColour(findColour(Skin::kShadow, true)); - g.drawImageAt(shadow_, 0, 0, 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_); + logo_->setTransformToFit(getLocalBounds().toFloat(), RectanglePlacement::stretchToFit); + logo_->draw(g, 1.0f); if (hover) { g.setColour(findColour(Skin::kLightenScreen, true)); @@ -79,18 +49,6 @@ 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)); @@ -107,22 +65,12 @@ class LogoButton : public Button { private: OpenGlImageComponent image_component_; - Path letter_; - Path ring_; - - Image shadow_; - - Colour letter_top_color_; - Colour letter_bottom_color_; - - Colour ring_top_color_; - Colour ring_bottom_color_; + std::unique_ptr logo_; }; LogoSection::LogoSection() : SynthSection("logo_section") { #if !defined(NO_TEXT_ENTRY) logo_button_ = std::make_unique("logo"); - logo_button_->setPaths(Paths::vitalV(), Paths::vitalRing()); addAndMakeVisible(logo_button_.get()); addOpenGlComponent(logo_button_->getImageComponent()); logo_button_->addListener(this); @@ -139,11 +87,7 @@ void LogoSection::resized() { logo_button_->setBounds(logo_padding_x, logo_padding_y, logo_height, logo_height); } -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::paintBackground(Graphics&) { } void LogoSection::buttonClicked(Button* clicked_button) { diff --git a/ports/vitalium/source/interface/editor_sections/synth_section.h b/ports/vitalium/source/interface/editor_sections/synth_section.h index 6331a80c..7e260c3a 100644 --- a/ports/vitalium/source/interface/editor_sections/synth_section.h +++ b/ports/vitalium/source/interface/editor_sections/synth_section.h @@ -112,35 +112,16 @@ class LoadingWheel : public OpenGlQuad { class AppLogo : public OpenGlImageComponent { public: AppLogo(String name) : OpenGlImageComponent(std::move(name)) { - logo_letter_ = Paths::vitalV(); - logo_ring_ = Paths::vitalRing(); + logo_ = Paths::vitaliumLogo(); } void paint(Graphics& g) override { - const DropShadow shadow(findColour(Skin::kShadow, true), 10.0f, Point(0, 0)); - - logo_letter_.applyTransform(logo_letter_.getTransformToScaleToFit(getLocalBounds().toFloat(), true)); - logo_ring_.applyTransform(logo_ring_.getTransformToScaleToFit(getLocalBounds().toFloat(), true)); - - shadow.drawForPath(g, logo_letter_); - shadow.drawForPath(g, logo_ring_); - - 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_); + logo_->setTransformToFit(getLocalBounds().toFloat(), RectanglePlacement::stretchToFit); + logo_->draw(g, 1.0f); } private: - Path logo_letter_; - Path logo_ring_; + std::unique_ptr logo_; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AppLogo) }; diff --git a/ports/vitalium/source/interface/look_and_feel/paths.h b/ports/vitalium/source/interface/look_and_feel/paths.h index 0a8d4073..14d72aef 100644 --- a/ports/vitalium/source/interface/look_and_feel/paths.h +++ b/ports/vitalium/source/interface/look_and_feel/paths.h @@ -30,18 +30,9 @@ class Paths { return drawable->getOutlineAsPath(); } - static Path vitalRing() { - Path path = fromSvgData((const void*)BinaryData::vital_ring_svg, BinaryData::vital_ring_svgSize); - path.addLineSegment(Line(0.0f, 0.0f, 0.0f, 0.0f), 0.2f); - path.addLineSegment(Line(kLogoWidth, kLogoWidth, kLogoWidth, kLogoWidth), 0.2f); - return path; - } - - static Path vitalV() { - Path path = fromSvgData((const void*)BinaryData::vital_v_svg, BinaryData::vital_ring_svgSize); - path.addLineSegment(Line(0.0f, 0.0f, 0.0f, 0.0f), 0.2f); - path.addLineSegment(Line(kLogoWidth, kLogoWidth, kLogoWidth, kLogoWidth), 0.2f); - return path; + static std::unique_ptr vitaliumLogo() { + return Drawable::createFromImageData((const void*)BinaryData::vitaliumunfa_png, + BinaryData::vitaliumunfa_pngSize); } static Path chorus() {