Browse Source

Use png logo

Signed-off-by: falkTX <falktx@falktx.com>
tags/2021-03-15
falkTX 1 year ago
parent
commit
8eb5bf6800
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
4 changed files with 16 additions and 99 deletions
  1. +3
    -2
      ports/vitalium/source/interface/editor_sections/about_section.cpp
  2. +6
    -62
      ports/vitalium/source/interface/editor_sections/header_section.cpp
  3. +4
    -23
      ports/vitalium/source/interface/editor_sections/synth_section.h
  4. +3
    -12
      ports/vitalium/source/interface/look_and_feel/paths.h

+ 3
- 2
ports/vitalium/source/interface/editor_sections/about_section.cpp View File

@@ -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<PlainTextComponent>("About fork", String("Vital fork by falkTX"));
fork_text_ = std::make_unique<PlainTextComponent>("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;


+ 6
- 62
ports/vitalium/source/interface/editor_sections/header_section.cpp View File

@@ -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<int>(0, 0));

if (shadow_.getWidth() == getWidth() && shadow_.getHeight() == getHeight())
return;

Rectangle<float> 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<float> 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<Drawable> logo_;
};

LogoSection::LogoSection() : SynthSection("logo_section") {
#if !defined(NO_TEXT_ENTRY)
logo_button_ = std::make_unique<LogoButton>("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) {


+ 4
- 23
ports/vitalium/source/interface/editor_sections/synth_section.h View File

@@ -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<int>(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<Drawable> logo_;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AppLogo)
};


+ 3
- 12
ports/vitalium/source/interface/look_and_feel/paths.h View File

@@ -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<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 vitalV() {
Path path = fromSvgData((const void*)BinaryData::vital_v_svg, BinaryData::vital_ring_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 std::unique_ptr<Drawable> vitaliumLogo() {
return Drawable::createFromImageData((const void*)BinaryData::vitaliumunfa_png,
BinaryData::vitaliumunfa_pngSize);
}

static Path chorus() {


Loading…
Cancel
Save