PDA

View Full Version : Adjusting contrast and brighness of QGraphicsView



olidem
17th March 2009, 19:14
Hi!

Is this possible somehow?

In the ideal case using a definable color conversion matrix?

Or is it possible to configure the QPainter to do what I want?

Best regards,Olli

lni
17th March 2009, 21:00
QGraphicsView is a QWidget, you can use QWidget::setBackgroundRole

olidem
17th March 2009, 23:27
This is not what I intend.

I woul like to be able to adjust the colors of *all* grpahical output of my view.

As an example, I would like to decrease the brightness by a factor of 0.5, or increase the contrast, gamma, hue, saturation,....

I think that the QGraphicsView class is the ideal point where to perform such changes.

aamer4yu
18th March 2009, 05:26
What does your view contain ? If its a single picture, you can use QImage to perform the operations.
There was some demo on Qt Labs about how to increase the brightness, etc.

If your view contains multiple items, it will be tricky and you will have to decide some algo how to adjust those features...

olidem
18th March 2009, 09:49
I found this article, but what they propose is just a workaround.
Does QPainter offer a possibility to adjust the contrast etc ?

aamer4yu
18th March 2009, 09:58
No, QPainter is a painter which helps you draw shapes... it doesnt have intelligence to know what is being drawn..

olidem
18th March 2009, 10:23
But this would really be a nice feature.

There is also not really intelligence necessary. One would just specify a transformation matrix that is to be multiplied with the color to be used.