PDA

View Full Version : QLinearGradient with custom interpolation between QGradientStops



SElsner
24th August 2013, 12:01
Hello,

I am looking for a method to create a QLinearGradient which does use a different interpolation mode between stops. With the standard QLinearGradient the QColors between the QGradientStops are interpolated linearly. I would like to be able to interpolate logarithmically between the QGradientStops.

I have looked into the source of QGradient and QBrush, but I could not find a method where the color is interpolated. Neither QGradient or QLinearGradient seem to provide the info how to render in their classes. Its somehow mangeled in the QBrush, I guess. Can someone please give me a hint if I can achieve this by subclassing or do I need to edit the Qt source code?

Thank you

Sebastian

Santosh Reddy
26th August 2013, 12:26
Your question not very clear to me, do you want the path of the gradiant to be like a log curve? or do you want the color to be changing logarithmically? in case if it is later, then you can calculate the stop points based on the some custom logic (logarithmic, exponential or whatever) using normal QLinearGradient

wagmare
26th August 2013, 12:49
there is no option for set positioning (X,Y) the gradient stops.
QGradientStop -Typedef for QPair<qreal, QColor> , only qreal is allowed to set stop points not QPoint

Santosh Reddy
26th August 2013, 13:03
there is no option for set positioning (X,Y) the gradient stops.
QGradientStop -Typedef for QPair<qreal, QColor> , only qreal is allowed to set stop points not QPoint
By point i meant gradient stop point (0 to 1), not QPoint.

wagmare
26th August 2013, 13:05
By point i meant gradient stop point (0 to 1), not QPoint.

sorry im saying it to him
SElsner and not on your comment ..infact i not read ur comment before .. ur right with ur post ..