I have objects where the border color has already been determined.
Now I want the user to be able to set at least the opacity of the fill pattern. E.g., the border is blue. The user sets the opacity to 128, so the fill pattern is also drawn in blue, but half-transparent.
The next step would be to allow the user to also slightly adjust the color of the pattern. E.g.: “Use the border color, but make it half-transparent (alpha=128) and a little bit yellow-ish.”.
Is there a (useful) way to combine two colors where one does not have an alpha value set? Or would it make more sense to set an alpha value on the original color and combine it with an “overlay color” that also has an alpha value set?
And is there a function (or otherwise, can someone give a short code snippet) to combine the two QColor objects?
I would look at existing color pickers that are out there (Gimp, Photoshop, Paint, wwWidgets). Most of them deal with a few different ways of picking your color:
Saturation, Hue, Value, Brightness, Contrast, RGB, CMYK, HSV, Alpha/Opacity.
Qt handles a bunch of these right out of the box:
QColor
In order to combine two colors, I would probably average their different components together:
I hope that helps.
PS: Understanding Color Space can be helpful, too.