It is currently September 17th, 2021, 2:02 pm

Plugin: Chameleon

Plugins and Addons popular with the Community
User avatar
jsmorley
Developer
Posts: 22270
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Plugin: Chameleon

Post by jsmorley »

Socks the Fox wrote:It's actually pretty easy :3 Right now on Github the plugin's "rainmeter" project in the Chameleon solution is set up so that if you right-click it in the project list and select "Debug->Start New Instance" it'll launch C:\Program Files\Rainmeter\Rainmeter.exe via the Visual Studio debugger. All you need to do is have Rainmeter use the Debug version of the plugin instead of the Release one (which I do by copying the plugin DLL into the Rainmeter plugins directory like I had people doing early on, you'd probably need to overwrite the one that Rainmeter copies to wherever it puts the one it gets from the skin). You don't even need a debug version of Rainmeter (though it will definitely help), breakpoints in Chameleon still work.

If you need to change it, you can go in to the project's properties and set the "Command" setting under the "Debugging" config property.

Edit: Don't forget to close down existing instances of Rainmeter before starting a new instance or wonky things might happen...
Yeah, not working for me. If I load your project in VS and "Start new instance" on the Rainmeter component, I just get errors for missing resources.

Error 1 error C1083: Cannot open include file: 'RainmeterAPI.h': No such file or directory C:\Chameleon-master\rainmeter\Chameleon.cpp 14 1 rainmeter
User avatar
Socks the Fox
Posts: 104
Joined: August 25th, 2015, 6:40 pm

Re: Plugin: Chameleon

Post by Socks the Fox »

The plugin has 2 dependencies: libPNG, solely for the 16-bit-per-channel PNGs because STBI doesn't support them, and the Rainmeter SDK.
By default it expects a setup like this:

whatever_src_dir/
-lpng1618/
--[libPNG's stuff]
-chameleon/
--[chameleon's stuff]
-rainmeter/
--rainmeter/API/

If you have the libraries in other places you'll need to adjust the VC++ Directories in the project's properties to point to them (and obviously you'll need to have them built, I think libPNG was a bit of a pain last time I built it). You might be able to stub out loadPNG16() to set *w to -1 and return nullptr to eliminate the libPNG dependency.
Author of Chameleon :: Like my plugin? Consider donating! I don't need much :3
User avatar
jsmorley
Developer
Posts: 22270
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Plugin: Chameleon

Post by jsmorley »

Socks the Fox wrote:The plugin has 2 dependencies: libPNG, solely for the 16-bit-per-channel PNGs because STBI doesn't support them, and the Rainmeter SDK.
By default it expects a setup like this:

whatever_src_dir/
-lpng1618/
--[libPNG's stuff]
-chameleon/
--[chameleon's stuff]
-rainmeter/
--rainmeter/API/

If you have the libraries in other places you'll need to adjust the VC++ Directories in the project's properties to point to them (and obviously you'll need to have them built, I think libPNG was a bit of a pain last time I built it). You might be able to stub out loadPNG16() to set *w to -1 and return nullptr to eliminate the libPNG dependency.
So this is your definition of "it's actually pretty easy :3"... ;-)

Yeah, you just entirely lost me. Sorry, perhaps Brian or Poiru will check in here at some point and have some time.
User avatar
dgrace
Developer
Posts: 265
Joined: June 28th, 2014, 8:32 am
Location: Tokyo, Japan

Re: Plugin: Chameleon

Post by dgrace »

BTW I hadn't checked out this thread at all, but just read through it and wanted to say "cool"! I just have a solid color desktop anyway so I'm probably not a good test candidate, but it's a neat idea. ;)

dave
User avatar
Socks the Fox
Posts: 104
Joined: August 25th, 2015, 6:40 pm

Re: Plugin: Chameleon

Post by Socks the Fox »

Rawr! I've identified one major memory leak (it's small, but gets called up to once for each monitor you have plus once to get the wallpaper path, on every update, so for me with 4 skins checking 4 monitors updating at 40fps on my cross-fading skin it adds up to 5GB leaked quickly).

I'm still not sure I've fixed it 100% since Task Manager shows the RAM usage still slowly creeping up so I'm going to hold off on declaring it fixed and releasing it until I've had a chance to double check all my code.

Until then, having a low update rate (on the order of 1-2 times per second instead of 20-40) drastically reduces the amount leaked due to where the leak happens.
Author of Chameleon :: Like my plugin? Consider donating! I don't need much :3
User avatar
Socks the Fox
Posts: 104
Joined: August 25th, 2015, 6:40 pm

Re: Plugin: Chameleon

Post by Socks the Fox »

Another update: I've figured out that my previous fix didn't actually fix the memory leak, it just stemmed it down. Turns out the call to free some memory wasn't being reached on the last iteration of a loop, so instead of leaking 4 monitor descriptors per update I was leaking 1...

I got that fixed and now Rainmeter is holding steady at less than 10MB of RAM used instead of steadily climbing to the 5GB like I found it at that one time.

I've just got one last little thing to do before I package everything up for 1.3.1!

I've just released 1.3.1! Other than fixing the memory leak, I've trimmed a bit of redundant code and added a cross-fade feature to the example skin, with a touch of info in the lua script on how to use it.
Author of Chameleon :: Like my plugin? Consider donating! I don't need much :3
User avatar
Socks the Fox
Posts: 104
Joined: August 25th, 2015, 6:40 pm

Re: Plugin: Chameleon

Post by Socks the Fox »

Right. It's been too long! The person maintaining the image library I use wants to wait until they have more stuff before they release a version update integrating my changes, so I'm going to go ahead and release 1.4 now with an unofficial version instead of waiting for the official release (I added 16 bit PNG support to it so I could drop the requirement for libPNG).

1.4 adds some better error handling, so hopefully those of you experiencing the crashes I can't reproduce won't experience them any more; and if you do I also added better logging so maybe I can track down what's happening now.

I also made a few big changes to the color picking code. In some cases, it now picks better colors, and in the ones where it can't pick a good foreground color (mainly low contrast images) it now tries to force a higher contrast version before falling back to black or white (it kind of did this before but by blending with white; now instead of, say, pink you're more likely to get red). It also takes into account the average color of the image when picking the main background color.

Downloads available as usual at https://software.socksthefox.net/chameleon/ and pls donate pls. Pls?
Author of Chameleon :: Like my plugin? Consider donating! I don't need much :3
User avatar
jsmorley
Developer
Posts: 22270
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Plugin: Chameleon

Post by jsmorley »

Outstanding... Thanks Socks the Fox!
ChameleonTester_1.4.rmskin
1.png
This really is one of the better Rainmeter plugins I have ever seen. Really clever and useful.
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Plugin: Chameleon

Post by eclectic-tech »

Thanks Socks!!

V1.3.1 worked fine but I received "Error 126" with the version 1.4 ...

Looking at my apps, I realized I did not have the latest Visual C ++ 2015 Redistributable installed (only Visual C++ 2013).

Installing those got everything working again!

I really like the results with your new color selection approach! :thumbup:
cam1.png
You do not have the required permissions to view the files attached to this post.
User avatar
Virginityrocks
Posts: 478
Joined: February 26th, 2011, 10:22 pm

Re: Plugin: Chameleon

Post by Virginityrocks »

Not working here. Windows 10 x64.

Displaying in white only.