Skip to content

Commit

Permalink
Merge branch 'region'
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown321 committed Jan 6, 2025
2 parents 89049fb + 6948216 commit 7e3bb77
Show file tree
Hide file tree
Showing 14 changed files with 375 additions and 122 deletions.
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
- [x] walkman One settings in wampy settings
- [x] simple clock skin
- [ ] visualization from NW-WM1Z spectrum analyzer
- [ ] regions.txt (winamp)
- [ ] region.txt (winamp)
- [ ] clickable lyrics icon (hagoromo)
- [ ] eq button custom action - too small?
- [ ] "restart wampy" button in settings - use case?
Expand Down
3 changes: 3 additions & 0 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ You can get skins from [Winamp Skin Museum](https://skins.webamp.org/).

`Show clutterbar` displays vertical list of options to the left of track time/visualization.

`Skin transparency` enables skin transparency (`region.txt`). Background color is black.

#### Known issues and quirks

Issues:
Expand All @@ -166,6 +168,7 @@ Quirks:
- Playlist is never full. Default player keeps up to 15 songs in memory, some of those have already been played,
reducing playlist size further
- Some elements may look slightly off (if you look hard enough) due to upscaling (800/275 = 2.90909...).
- Skin transparency is not pixel perfect (irrational upscaling ratio).
- There might be small delay between clicking button and getting response (noticeable on shuffle button)

Improvements (compared to Winamp v2.95):
Expand Down
Binary file modified images/settings-winamp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion libs/ImageMagick
Submodule ImageMagick updated 560 files
2 changes: 2 additions & 0 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ namespace AppConfig {
ini["winamp"]["bitmapFontInPlaylist"] = std::to_string(winamp.useBitmapFontInPlaylist);
ini["winamp"]["preferTimeRemaining"] = std::to_string(winamp.preferTimeRemaining);
ini["winamp"]["showClutterbar"] = std::to_string(winamp.showClutterbar);
ini["winamp"]["skinTransparency"] = std::to_string(winamp.skinTransparency);

ini["misc"]["swapTrackButtons"] = std::to_string(misc.swapTrackButtons);

Expand Down Expand Up @@ -151,6 +152,7 @@ namespace AppConfig {
winamp.useBitmapFontInPlaylist = (bool)std::atoi(ini["winamp"]["bitmapFontInPlaylist"].c_str());
winamp.preferTimeRemaining = (bool)std::atoi(ini["winamp"]["preferTimeRemaining"].c_str());
winamp.showClutterbar = (bool)std::atoi(ini["winamp"]["showClutterbar"].c_str());
winamp.skinTransparency = (bool)std::atoi(ini["winamp"]["skinTransparency"].c_str());
cassette.randomize = (bool)std::atoi(ini["cassette"]["randomize"].c_str());
// NOLINTEND

Expand Down
14 changes: 13 additions & 1 deletion src/digital_clock/digital_clock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ namespace DigitalClock {
v.detach();

loading = false;

return 0;
}

void DigitalClock::formatTime() {
Expand Down Expand Up @@ -356,7 +358,7 @@ namespace DigitalClock {
return 0;
}

std::string DigitalClock::GetColorPreview() {
std::string DigitalClock::GetActiveColorPreview() {
for (const auto &v : colorsDigitalClock) {
if (v.second == color) {
return v.first;
Expand All @@ -365,4 +367,14 @@ namespace DigitalClock {

return DefaultColorPreview;
}

std::string DigitalClock::GetColorPreview(const std::string &c) {
for (const auto &v : colorsDigitalClock) {
if (v.second == c) {
return v.first;
}
}

return DefaultColorPreview;
}
} // namespace DigitalClock
5 changes: 3 additions & 2 deletions src/digital_clock/digital_clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace DigitalClock {

struct Config {
std::string color{};
void Default() { color = "Silver"; };
void Default() { color = "silver"; };
};

struct DigitalClockElements {
Expand Down Expand Up @@ -75,7 +75,8 @@ namespace DigitalClock {

void SetColor(std::string s) { newColor = std::move(s); };

std::string GetColorPreview();
std::string GetActiveColorPreview();
static std::string GetColorPreview(const std::string &);

DigitalClock() = default;

Expand Down
35 changes: 35 additions & 0 deletions src/magick/magick.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "magick.h"
#include "../util/util.h"
#include "MagickCore/draw.h"

void MyMagick::InitMagick() { Magick::InitializeMagick(""); }

Expand Down Expand Up @@ -68,6 +69,40 @@ void MyMagick::Crop(Magick::Image *image, Magick::RectangleInfo g) {
}
}

void MyMagick::Mask(Magick::Image *image, const std::vector<int> &pointlist) {
if (pointlist.size() % 2 != 0) {
DLOG("uneven point list\n");
return;
}

if (pointlist.empty()) {
return;
}

Magick::CoordinateList coords{};
Magick::Coordinate c;
for (int i = 0; i < pointlist.size(); i = i + 2) {
c.x((double)pointlist.at(i));
c.y((double)pointlist.at(i + 1));
coords.push_back(c);
}

Magick::Image mask;
mask.size("275x116");
mask.fillColor("#ffffff");
mask.backgroundColor("#000000");
mask.erase();
mask.strokeWidth(0);
// mask.strokeColor("#ff0000");

auto d = Magick::DrawablePolygon(coords);

mask.draw(d);
mask.write("bmp:/tmp/out.bmp");

image->composite(mask, "+0+0", MagickCore::MultiplyCompositeOp);
}

void MyMagick::FillRectangle(Magick::Image *image, Magick::RectangleInfo g, const Magick::Color &color) {
image->fillColor(color);
image->strokeWidth(0);
Expand Down
2 changes: 2 additions & 0 deletions src/magick/magick.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ namespace MyMagick {
void Crop(Magick::Image *image, Magick::RectangleInfo g);

void FillRectangle(Magick::Image *image, Magick::RectangleInfo g, const Magick::Color &color);

void Mask(Magick::Image *image, const std::vector<int> &pointlist);
} // namespace MyMagick

#endif
Loading

0 comments on commit 7e3bb77

Please sign in to comment.