diff --git a/CMakeLists.txt b/CMakeLists.txt index c5121ca..26de868 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,8 +23,8 @@ juce_add_binary_data(ChromaFlockBinaryData NAMESPACE BinaryData SOURCES chromaflockbg5.png - cfnew.png -) + cf3d02.png + ) if(APPLE) set(CHROMAFLOCK_FORMATS VST3 AU Standalone) diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index bbb745a..4b7387f 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -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(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(minX, minY, maxX - minX + 1, maxY - minY + 1)) + : img; + } logoLoaded = true; } if (logoImage.isValid()) { - int logoH = 124; - int logoW = static_cast(logoH * 805.0 / 119.0); + int gap = 8; + int logoH = 124 - gap * 2; + int logoW = logoImage.getHeight() > 0 + ? static_cast(logoH * static_cast(logoImage.getWidth()) / logoImage.getHeight()) + : logoH; int logoX = (getWidth() - logoW) / 2; - auto logoArea = juce::Rectangle(logoX, 0, logoW, logoH); + auto logoArea = juce::Rectangle(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(static_cast(x), static_cast(y), static_cast(w), static_cast(h)); diff --git a/cf3d02.png b/cf3d02.png new file mode 100644 index 0000000..4890838 Binary files /dev/null and b/cf3d02.png differ