[SOLVED] How would you set an alpha "texture" for QBrush?
-
I'm developing a custom color picker for an OpenGL application and I'm using QGraphicsView to preview the changes of color the user inputs. Since I have 4 sliders (one per channel) that alter the resulting color, I realized that if I moved the alpha one to zero, the preview will turn white. I would like it to turn something else, like that common squared texture from image editors like Gimp.
Is there any way to achieve this with QBrush?
-
Hi,
Are you thinking for something like :
@QBrush(QColor(0, 0, 255, 128))@
?It should give you a half-transparent blue brush.
-
Hi SGaist,
No, what I would like to achieve is to show a texture on the background as the alpha channel reduces.
Just as the background of this picture:
http://www.cgmotionbox.com/wp-content/uploads/2011/11/Rendering-A-File-With-An-Alpha-Channel-In-After-Effects.gif -
Then what about QBrush::setTexture ?
-
You're right.
I forgot I was using a QBrush for the background, so I could use one for the foreground too. By setting a texture for the background one and tweaking the foreground colors I achieved what I was looking for.
Thanks SGaist!