Skip to content

Commit

Permalink
wip watermark
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseDiazRohena committed Apr 14, 2024
1 parent e6f82fe commit af2fa7b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ set(AssetFiles
libs/tote_bag/assets/arrow_left.svg
libs/tote_bag/assets/arrow_right.svg
libs/tote_bag/assets/totie_pink.svg
libs/tote_bag/assets/totie_watermark.svg
)

# Setup our binary data as a target
Expand Down
13 changes: 13 additions & 0 deletions libs/tote_bag/assets/totie_watermark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions libs/tote_bag/juce_gui/components/panels/InfoPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ InfoPanel::InfoPanel (std::function<void()> mouseUpCallback)
: onMouseUp (mouseUpCallback)
, githubURL ("https://github.com/tote-bag-labs/valentine")
{
totieWatermark =
juce::Drawable::createFromImageData (BinaryData::totie_watermark_svg,
BinaryData::totie_watermark_svgSize);
}

InfoPanel::~InfoPanel()
Expand All @@ -35,6 +38,12 @@ void InfoPanel::paint (juce::Graphics& g)
const auto boundsWidth = bounds.getWidth();
const auto boundsHeight = bounds.getHeight();

std::unique_ptr<juce::Drawable> drawable =
juce::Drawable::createFromImageData (BinaryData::totie_watermark_svg,
BinaryData::totie_watermark_svgSize);

drawable->drawWithin (g, bounds.toFloat(), juce::RectanglePlacement::centred, 1.0f);

const auto textLineHeight = juce::roundToInt (boundsHeight / 32.0f);
const auto textAreaHeight = textLineHeight * detail::kNumInfoTextLines;
const auto textAreaY = bounds.getCentreY() - textAreaHeight / 2.0;
Expand Down
2 changes: 2 additions & 0 deletions libs/tote_bag/juce_gui/components/panels/InfoPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class InfoPanel : public juce::Component
private:
std::function<void()> onMouseUp;

std::unique_ptr<juce::Drawable> totieWatermark;

juce::Rectangle<int> urlBounds;
juce::URL githubURL;

Expand Down

0 comments on commit af2fa7b

Please sign in to comment.