I am trying to create several similar visual styles for my programs, each with a different color theme. To do this, I have implemented the use of icons to represent the different states of JCheckBox
s and JRadioButton
s. Instead of making one full set of icons for every possible color, is there any way I can just take one set and change the hue/saturation/luminosity/alpha of the image before displaying it?
相关问题
- Views base64 encoded blob in HTML with PHP
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- How to get the background from multiple images by
I tried every solution on this page, had no luck. The Xor one (accepted answer) didn't work for me - tinted a weird yellow color instead of the color I was giving as an argument no matter what the argument. I finally found an approach that works for me, though it is a bit messy. Figured I'd add it in case anyone else is having the same issues I am with the other solutions. Cheers!
This isn't exactly tinting, its more like applying another layer on it but it works for me:
The easiest way to do this would be by using the Image Filters by JH Labs. You can simply adjust HSB by calling,
Because all methods I found didn't work for me for whatever reason, here is an easy way to approach this (no extra libs needed):
A black image will always stay black, but a white image will be the color you specify. This method goes through every pixel and multiply the red green and blue values of the image with parameters. This is the exact behavior of the OpenGL glColor3f() method. R, G and B params must be 0.0F to 1.0F.
This method has no problem with alpha values.
To calculate average for each color component and keep original alpha:
This works best for my case.