Results 1 to 5 of 5

Thread: QLinearGradient with custom interpolation between QGradientStops

  1. #1
    Join Date
    Mar 2010
    Location
    Berlin
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default QLinearGradient with custom interpolation between QGradientStops

    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

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: QLinearGradient with custom interpolation between QGradientStops

    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
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QLinearGradient with custom interpolation between QGradientStops

    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
    "Behind every great fortune lies a crime" - Balzac

  4. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: QLinearGradient with custom interpolation between QGradientStops

    Quote Originally Posted by wagmare
    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.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  5. #5
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QLinearGradient with custom interpolation between QGradientStops

    Quote Originally Posted by Santosh Reddy View Post
    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 ..
    "Behind every great fortune lies a crime" - Balzac

Similar Threads

  1. Qwt Interpolation
    By Mr_Cloud in forum Qwt
    Replies: 8
    Last Post: 4th July 2012, 07:41
  2. Question about periodic spline interpolation
    By kaidiethelm in forum Qwt
    Replies: 0
    Last Post: 4th June 2012, 13:11
  3. Replies: 3
    Last Post: 23rd February 2011, 07:29
  4. Replies: 0
    Last Post: 7th March 2010, 13:13
  5. resizing an image without interpolation
    By mattei in forum Qt Programming
    Replies: 3
    Last Post: 9th December 2009, 11:10

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.