mirror of
https://codeberg.org/armin/chromaflock.git
synced 2026-09-01 04:10:47 +02:00
fix: stretch background image to fill 100% of horizontal width
This commit is contained in:
parent
5f1b7458b2
commit
68d71f5cc6
1 changed files with 4 additions and 13 deletions
|
|
@ -745,20 +745,11 @@ void MainContentComponent::paint(juce::Graphics& g) {
|
|||
bgImageLoaded = true;
|
||||
}
|
||||
if (bgImage.isValid()) {
|
||||
int imgW = bgImage.getWidth();
|
||||
int imgH = bgImage.getHeight();
|
||||
int compW = getWidth();
|
||||
int compH = getHeight();
|
||||
|
||||
g.setOpacity(0.35f);
|
||||
const float bgZoom = 1.8f;
|
||||
int tileW = static_cast<int>(imgW * bgZoom);
|
||||
int tileH = static_cast<int>(imgH * bgZoom);
|
||||
for (int x = 0; x < compW; x += tileW)
|
||||
for (int y = 0; y < compH; y += tileH)
|
||||
g.drawImage(bgImage, static_cast<float>(x), static_cast<float>(y),
|
||||
static_cast<float>(tileW), static_cast<float>(tileH),
|
||||
0, 0, imgW, imgH, false);
|
||||
g.drawImage(bgImage,
|
||||
juce::Rectangle<float>(0.0f, 0.0f, static_cast<float>(getWidth()),
|
||||
static_cast<float>(getHeight())),
|
||||
juce::RectanglePlacement::stretchToFit);
|
||||
g.setOpacity(1.0f);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue