-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
White line rendered on left edge of wallpaper #30
Comments
To be honest I have no idea why this might happen. The utility does not draw a white line there. Must be some macOS rendering thing. |
Maybe #33 might help if you run a display with some scaling. |
i have the same issue on one of my 3 displays. its a 1440p screen that runs in 1080p hdpi mode. however the issue remains if i set the display to 1080p non-dpi. strangely enough, if i run it without scaling at native 1440p, the menu bar size is about one third of the screen. other two displays without issues (both running at non-2x dpi modes). |
I created a Xcode project and imported all swift files and added all dependencies (Files, ArgumentParser and Rainbow) to debug this stuff. The fractional values are set directly after loadWallpaperImage() of Commands.swift loads them with NSImage().
Continuing with those fractional dimension values instead of the original integer dimensions for further calculations will then of cause lead to a hole bunch of unwanted side effects in the rest of the code. I searched for this issue that NSImage did not give the real size values for some pictures and found this thread here: They confirmed the issue that NSImage size method returns size information that is screen resolution dependent and they have an example code that uses NSBitmapImageRep to detect the real size of an image. A second example uses the attribute "representations" of NSImage that is an array of NSImageRep and iterate over it to get the real image size. |
@Waitsnake thanks for the research, the link to SO looks promising. I will take a look. Feel free to open a PR if you want to tackle it yourself. |
Adding those 3 lines of quick and dirty code after loading the image and that already fixed it for me when running the program in Xcode.
I pushed it on my fork to try it with mint but in mint I had the same effect as before? It will be much more time intensive to the debug the code in mint by only using log entries then using a real debugger from Xcode. |
I think with mint you need to have a version tagged, it will not just take the latest commit from the master branch. If it works fine from Xcode it should be fine, you can also try running it from terminal via |
I'm not so familiar with mint apart from using it. So I don't know the exact step for deployment yet. Edit later: So the fix in principal works. I know my code was just quick and dirty to quickly see if it fixes the issue or not. But it can be done more bullet prof with some guards and also not just picking the first element of the array via representations[0] (I saw this in one of the examples but I'm not sure if "0" contains always the biggest size of the image), but rather iterating over the complete array using representations.count and then find the biggest size for the image. |
Hopefully 63dd5d6 fixes the this problem as suggested. |
On my late-2016 13" MacBook Pro, wallpapers processed through ChangeMenuBarColor always render a single-pixel wide white line along the left edge of the wallpaper. Doesn't matter if the source image was a dynamic wallpaper or normal static image.
I have the screen res scaled at "More Space" 1680x1050 in System Preferences (up from the native res of 1440x900).
However on my desktop Mac running Catalina on a non-retina (native res) screen, this doesn't happen.
Without digging into the source code, I'm not sure what causes this but it may be related to subpixel coordinate rounding?
Zoomed in. You can see a solid white line 1 pixel wide, then a mid-point alpha blend of 1 pixel wide next to it.
The text was updated successfully, but these errors were encountered: