mirror of
https://codeberg.org/armin/chromaflock.git
synced 2026-09-01 04:10:47 +02:00
ui: swap title logo to cf3d02.png, crop transparent margins, add padding, drop header divider
This commit is contained in:
parent
121a95cd75
commit
256a3b6ba1
3 changed files with 29 additions and 10 deletions
|
|
@ -645,21 +645,40 @@ void MainContentComponent::paint(juce::Graphics& g) {
|
|||
|
||||
// Load logo
|
||||
if (!logoLoaded) {
|
||||
logoImage = juce::ImageFileFormat::loadFrom(
|
||||
BinaryData::cfnew_png, BinaryData::cfnew_pngSize);
|
||||
auto img = juce::ImageFileFormat::loadFrom(
|
||||
BinaryData::cf3d02_png, BinaryData::cf3d02_pngSize);
|
||||
if (img.isValid()) {
|
||||
juce::Image::BitmapData bd(img, juce::Image::BitmapData::readOnly);
|
||||
int minX = bd.width, maxX = 0, minY = bd.height, maxY = 0;
|
||||
bool found = false;
|
||||
for (int y = 0; y < bd.height; ++y) {
|
||||
for (int x = 0; x < bd.width; ++x) {
|
||||
int a = bd.data[static_cast<size_t>(y) * bd.lineStride + x * bd.pixelStride + 3];
|
||||
if (a > 10) {
|
||||
found = true;
|
||||
if (x < minX) minX = x;
|
||||
if (x > maxX) maxX = x;
|
||||
if (y < minY) minY = y;
|
||||
if (y > maxY) maxY = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
logoImage = found ? img.getClippedImage(juce::Rectangle<int>(minX, minY, maxX - minX + 1, maxY - minY + 1))
|
||||
: img;
|
||||
}
|
||||
logoLoaded = true;
|
||||
}
|
||||
if (logoImage.isValid()) {
|
||||
int logoH = 124;
|
||||
int logoW = static_cast<int>(logoH * 805.0 / 119.0);
|
||||
int gap = 8;
|
||||
int logoH = 124 - gap * 2;
|
||||
int logoW = logoImage.getHeight() > 0
|
||||
? static_cast<int>(logoH * static_cast<double>(logoImage.getWidth()) / logoImage.getHeight())
|
||||
: logoH;
|
||||
int logoX = (getWidth() - logoW) / 2;
|
||||
auto logoArea = juce::Rectangle<int>(logoX, 0, logoW, logoH);
|
||||
auto logoArea = juce::Rectangle<int>(logoX, gap, logoW, logoH);
|
||||
g.drawImage(logoImage, logoArea.toFloat(), juce::RectanglePlacement::centred);
|
||||
}
|
||||
|
||||
g.setColour(juce::Colour(0xffccaa44));
|
||||
g.drawHorizontalLine(124, 10.0f, 1650.0f);
|
||||
|
||||
auto drawSection = [&](int x, int y, int w, int h) {
|
||||
auto rect = juce::Rectangle<float>(static_cast<float>(x), static_cast<float>(y),
|
||||
static_cast<float>(w), static_cast<float>(h));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue