It is currently November 13th, 2019, 6:00 am

Plugin: Chameleon

Plugins and Addons popular with the Community
User avatar
Socks the Fox
Posts: 93
Joined: August 25th, 2015, 6:40 pm

Re: Plugin: Chameleon

Socks the Fox » October 17th, 2019, 11:09 pm

Well right now the reason cropping is probably broken is that the plugin caches the values when it samples an image so it doesn't have to run all the calculations every time the plugin updates (and assuming I managed to get that correct, actually caches the desktop values on a global level, per screen), and I didn't think to invalidate the cache when the crop values change (right now it only resamples if the supplied file path, or the file modified time changes). It should be a fairly simple change, so I might look into it.

There may be ways to sample the actual desktop "window" that Windows uses for the background, so if that works I will probably convert Chameleon over to using that for desktop sampling. It should otherwise mostly be a drop in replacement, where I just sample from that buffer instead of one made from the image file directly.

If I can't get that working I may just go ahead and outright re-implement the scaling and cropping stuff, since it only needs to happen when the cache is invalidated. I think I technically already handle the most annoying edge case (where the sample area lies partially outside the area of the image being sampled, such as with tiled backgrounds).
Author of Chameleon :: Like my plugin? Consider donating! I don't need much :3
User avatar
jsmorley
Developer
Posts: 19706
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Plugin: Chameleon

jsmorley » October 17th, 2019, 11:10 pm

Socks the Fox wrote:
October 17th, 2019, 11:09 pm
Well right now the reason cropping is probably broken is that the plugin caches the values when it samples an image so it doesn't have to run all the calculations every time the plugin updates (and assuming I managed to get that correct, actually caches the desktop values on a global level, per screen), and I didn't think to invalidate the cache when the crop values change (right now it only resamples if the supplied file path, or the file modified time changes). It should be a fairly simple change, so I might look into it.

There may be ways to sample the actual desktop "window" that Windows uses for the background, so if that works I will probably convert Chameleon over to using that for desktop sampling. It should otherwise mostly be a drop in replacement, where I just sample from that buffer instead of one made from the image file directly.

If I can't get that working I may just go ahead and outright re-implement the scaling and cropping stuff, since it only needs to happen when the cache is invalidated. I think I technically already handle the most annoying edge case (where the sample area lies partially outside the area of the image being sampled, such as with tiled backgrounds).
Very cool!
User avatar
jsmorley
Developer
Posts: 19706
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Plugin: Chameleon

jsmorley » October 17th, 2019, 11:20 pm

My thinking on using this is that I might use two "parent" measures.

One would sample the entire background, and offer what it does now. "light" and "dark" variants. So I have those colors to choose from. This would be static and won't change unless the image does.

One would sample just an area under the skin in question, so I can get as accurate a value for "luminance" as I can for that area. This would follow the skin if it is moved, so it would need to be somewhat "dynamic". I will need to be sure I only poke the plugin when I actually move the skin.

I would use that value to determine if I want the "light" or "dark" color variants. If I move the skin to a dark area of the screen, use the light color, if I move the skin to a light area of the screen, use the dark color...

This would be true and would work even if I don't move the skin, but instead change the wallpaper. It would still determine the luminance of the area under the skin instead of a more "average" of the entire screen.

Point is that I want the colors determined by the entire image, so it is as robust as possible, while basing the luminance on a small area.
User avatar
Socks the Fox
Posts: 93
Joined: August 25th, 2015, 6:40 pm

Re: Plugin: Chameleon

Socks the Fox » October 17th, 2019, 11:29 pm

Actually I was considering something like that. I'd have a new Type value of `window` and probably have a new `Sampling` option that can be either `strict` which will ONLY sample underneath the window, or `loose` that will sample the entire desktop, and offer preference to the values found underneath the window.

I'd also probably have the Sampling option for `desktop` type measures where `strict` samples the "Desktop Window" directly, and `loose` samples the image file that windows reports the desktop background to be.
Author of Chameleon :: Like my plugin? Consider donating! I don't need much :3
User avatar
jsmorley
Developer
Posts: 19706
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Plugin: Chameleon

jsmorley » October 17th, 2019, 11:31 pm

Socks the Fox wrote:
October 17th, 2019, 11:29 pm
Actually I was considering something like that. I'd have a new Type value of `window` and probably have a new `Sampling` option that can be either `strict` which will ONLY sample underneath the window, or `loose` that will sample the entire desktop, and offer preference to the values found underneath the window.

I'd also probably have the Sampling option for `desktop` type measures where `strict` samples the "Desktop Window" directly, and `loose` samples the image file that windows reports the desktop background to be.
That sounds pretty good. Like I said above, I might use two, as I like that the "colors" are based on the entire image, but have the "luminance" based on some smaller area. If I base the "colors" on the small area, it's likely to be boring...

The problem today isn't that it doesn't pick the right colors, it does... The problem is that there is no good way to decide if you want to use the "light" or "dark" variants of the colors based on where the skin is. The "luminance" is more or less an average of the entire screen, and often isn't terribly useful.
User avatar
jsmorley
Developer
Posts: 19706
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Plugin: Chameleon

jsmorley » October 17th, 2019, 11:40 pm

I will point out that having the option to base it on the skin "window" is interesting, but may not be the most flexible.

I like the current idea of CropX/CropY/CropW/CropH, which in theory could sample under an individual meter in the skin.

CropX=(#CURRENTCONFIGX#+[myMeter:X])
CropY=(#CURRENTCONFIGY#+[myMeter:Y])
CropW=[myMeter:W]
CropH=[myMeter:H]
DynamicVariables=1

I actually think that if you can fix the "dynamic" issue with the Crop... options, and have an option to use the "screen" rather than the "file" for Desktop sampling, to correct the measurements issue, you are there...
Cariboudjan
Posts: 25
Joined: May 12th, 2019, 8:55 am

Re: Plugin: Chameleon

Cariboudjan » October 29th, 2019, 3:30 am

Would anyone happen to know whether this plugin could grab color information from a Wallpaper Engine background?

It would be nice if the application saved a single screenshot whenever a Wallpaper Engine background were loaded, allowing people to use that jpeg to pull color information easily for other apps. Anyone know if it does this?
User avatar
Socks the Fox
Posts: 93
Joined: August 25th, 2015, 6:40 pm

Re: Plugin: Chameleon

Socks the Fox » October 29th, 2019, 3:34 am

I do not have any integration with any other app. If you can find a way to get the file name you can pass that in to the plugin, but the only thing Chameleon tries to figure out on it's own is the Windows desktop. Unfortunately I have no plans on adding integration with any other apps either, I just don't have time to maintain it all.
Author of Chameleon :: Like my plugin? Consider donating! I don't need much :3
Cariboudjan
Posts: 25
Joined: May 12th, 2019, 8:55 am

Re: Plugin: Chameleon

Cariboudjan » October 29th, 2019, 3:36 am

That's fine. I was mostly wondering if Wallpaper Engine saved a jpeg image somewhere each time a new wallpaper is loaded, like the Windows desktop wallpaper does. If it did, then I could just use that filename and directory as the source image and go from there. This is something I'll suggest to the devs of wallpaper engine.
Cariboudjan
Posts: 25
Joined: May 12th, 2019, 8:55 am

Re: Plugin: Chameleon

Cariboudjan » October 29th, 2019, 4:16 am

Socks The Fox, if you'd like to say something, maybe the devs will take a look. I've posted to their suggestion board here: https://steamcommunity.com/app/431960/discussions/0/1697221160916833027/