<class name="QGradient" doc="/** <p>The <a href="QGradient.html#QGradient()"><tt>QGradient</tt></a> class is used in combination with <a href="QBrush.html"><tt>QBrush</tt></a> to specify gradient fills.</p> <p>Qt currently supports three types of gradient fills:</p> <ul> <li><i>Linear</i> gradients interpolate colors between start and end points.</li> <li><i>Radial</i> gradients interpolate colors between a focal point and end points on a circle surrounding it.</li> <li><i>Conical</i> gradients interpolate colors around a center point.</li> </ul> <p>A gradient's type can be retrieved using the <a href="QGradient.html#type()"><tt>type</tt></a> function. Each of the types is represented by a subclass of <a href="QGradient.html#QGradient()"><tt>QGradient</tt></a>:</p> <p><table align="center" cellpadding="2" cellspacing="1" border="0"> <tr valign="top" class="odd"><td><img src="%2E%2E/images/qgradient-linear.png" /></td><td><img src="%2E%2E/images/qgradient-radial.png" /></td><td><img src="%2E%2E/images/qgradient-conical.png" /></td></tr> <thead><tr valign="top" class="qt-style"><th><a href="QLinearGradient.html"><tt>QLinearGradient</tt></a></th><th><a href="QRadialGradient.html"><tt>QRadialGradient</tt></a></th><th><a href="QConicalGradient.html"><tt>QConicalGradient</tt></a></th></tr></thead> </table></p> <p>The colors in a gradient is defined using stop points of the QGradientStop type, i.e&#x2e; a position and a color. Use the <a href="QGradient.html#setColorAt(double, com.trolltech.qt.gui.QColor)"><tt>setColorAt</tt></a> function to define a single stop point. Alternatively, use the <a href="QGradient.html#setStops(com.trolltech.qt.gui.QColor>>)"><tt>setStops</tt></a> function to define several stop points in one go. Note that the latter function <i>replaces</i> the current set of stop points.</p> <p>It is the gradient's complete set of stop points (accessible through the <a href="QGradient.html#stops()"><tt>stops</tt></a> function) that describes how the gradient area should be filled. If no stop points have been specified, a gradient of black at 0 to white at 1 is used.</p> <p>A diagonal linear gradient from black at (100, 100) to white at (200, 200) could be specified like this:</p> <pre> QLinearGradient linearGrad(QPointF(100, 100), QPointF(200, 200)); linearGrad.setColorAt(0, Qt::black); linearGrad.setColorAt(1, Qt::white);</pre> <p>A gradient can have an arbitrary number of stop points. The following would create a radial gradient starting with red in the center, blue and then green on the edges:</p> <pre> QRadialGradient radialGrad(QPointF(100, 100), 100); radialGrad.setColorAt(0, Qt::red); radialGrad.setColorAt(0.5, Qt::blue); radialGrad.setColorAt(1, Qt::green);</pre> <p>It is possible to repeat or reflect the gradient outside its area by specifiying the spread method</tt> using the <a href="QGradient.html#setSpread(com.trolltech.qt.gui.QGradient.Spread)"><tt>setSpread</tt></a> function. The default is to pad the outside area with the color at the closest stop point. The currently set spread method</tt> can be retrieved using the <a href="QGradient.html#spread()"><tt>spread</tt></a> function. The QGradient::Spread enum defines three different methods:</p> <p><table align="center" cellpadding="2" cellspacing="1" border="0"> <tr valign="top" class="odd"><td><img src="%2E%2E/images/qradialgradient-pad.png" /></td><td><img src="%2E%2E/images/qradialgradient-repeat.png" /></td><td><img src="%2E%2E/images/qradialgradient-reflect.png" /></td></tr> <tr valign="top" class="even"><td>PadSpread</td><td>RepeatSpread</td><td>ReflectSpread</td></tr> </table></p> <p>Note that the <a href="QGradient.html#setSpread(com.trolltech.qt.gui.QGradient.Spread)"><tt>setSpread</tt></a> function only has effect for linear and radial gradients. The reason is that the conical gradient is closed by definition, i.e&#x2e; the <i>conical</i> gradient fills the entire circle from 0 - 360 degrees, while the boundary of a radial or a linear gradient can be specified through its radius or final stop points, respectively.</p> @see The Gradients Demo</tt> @see <a href="QBrush.html"><tt>QBrush</tt></a> */"> <method name="public QGradient()" doc="/** <p>This method is used internally by Qt Jambi. Do not use it in your applications.</p> */"/> <method name="public final com.trolltech.qt.gui.QGradient.CoordinateMode coordinateMode()" doc="/** <p>This method is used internally by Qt Jambi. Do not use it in your applications.</p> @see <a href="QGradient.html#setCoordinateMode(com.trolltech.qt.gui.QGradient.CoordinateMode)"><tt>setCoordinateMode</tt></a> */"/> <method name="public final void setColorAt(double pos, com.trolltech.qt.gui.QColor color)" doc="/** <p>Creates a stop point at the given <tt>pos</tt> with the given <tt>color</tt>. The given <tt>pos</tt> must be in the range 0 to 1.</p> @see <a href="QGradient.html#setStops(com.trolltech.qt.gui.QColor>>)"><tt>setStops</tt></a> @see <a href="QGradient.html#stops()"><tt>stops</tt></a> */"/> <method name="public final void setCoordinateMode(com.trolltech.qt.gui.QGradient.CoordinateMode mode)" doc="/** <p>This method is used internally by Qt Jambi. Do not use it in your applications.</p> @see <a href="QGradient.html#coordinateMode()"><tt>coordinateMode</tt></a> */"/> <method name="public final void setSpread(com.trolltech.qt.gui.QGradient.Spread spread)" doc="/** <p>Specifies the spread <tt>spread</tt> that should be used for this gradient.</p> <p>Note that this function only has effect for linear and radial gradients.</p> @see <a href="QGradient.html#spread()"><tt>spread</tt></a> */"/> <method name="public final void setStops(com.trolltech.qt.gui.QColor>> stops)" doc="/** <p>Replaces the current set of stop points with the given <tt>stops</tt>. The positions of the points must be in the range 0 to 1, and must be sorted with the lowest point first.</p> @see <a href="QGradient.html#setColorAt(double, com.trolltech.qt.gui.QColor)"><tt>setColorAt</tt></a> @see <a href="QGradient.html#stops()"><tt>stops</tt></a> */"/> <method name="public final com.trolltech.qt.gui.QGradient.Spread spread()" doc="/** <p>Returns the spread method use by this gradient. The default is <a href="QGradient.html#Spread-enum"><tt>PadSpread</tt></a>.</p> @see <a href="QGradient.html#setSpread(com.trolltech.qt.gui.QGradient.Spread)"><tt>setSpread</tt></a> */"/> <method name="public final java.util.List<com.trolltech.qt.QPair<java.lang.Double, com.trolltech.qt.gui.QColor>> stops()" doc="/** <p>Returns the stop points for this gradient.</p> <p>If no stop points have been specified, a gradient of black at 0 to white at 1 is used.</p> @see <a href="QGradient.html#setStops(com.trolltech.qt.gui.QColor>>)"><tt>setStops</tt></a> @see <a href="QGradient.html#setColorAt(double, com.trolltech.qt.gui.QColor)"><tt>setColorAt</tt></a> */"/> <method name="public final com.trolltech.qt.gui.QGradient.Type type()" doc="/** <p>Returns the type of gradient.</p> */"/> <enum name="CoordinateMode" doc="/** <p>This enum specifies how gradient coordinates map to the paint device on which the gradient is used.</p> */"> <enum-value name="LogicalMode" doc="/** Internal. */"/> <enum-value name="StretchToDeviceMode" doc="/** Internal. */"/> <enum-value name="ObjectBoundingMode" doc="/** Internal. */"/> </enum> <enum name="Spread" doc="/** <p>Specifies how the area outside the gradient area should be filled.</p> @see <a href="QGradient.html#spread()"><tt>spread</tt></a> @see <a href="QGradient.html#setSpread(com.trolltech.qt.gui.QGradient.Spread)"><tt>setSpread</tt></a> */"> <enum-value name="PadSpread" doc="/** <p>The area is filled with the closest stop color. This is the default.</p> */"/> <enum-value name="ReflectSpread" doc="/** <p>The gradient is reflected outside the gradient area.</p> */"/> <enum-value name="RepeatSpread" doc="/** <p>The gradient is repeated outside the gradient area.</p> */"/> </enum> <enum name="Type" doc="/** <p>Specifies the type of gradient.</p> @see <a href="QGradient.html#type()"><tt>type</tt></a> */"> <enum-value name="LinearGradient" doc="/** <p>Interpolates colors between start and end points (<a href="QLinearGradient.html"><tt>QLinearGradient</tt></a>).</p> */"/> <enum-value name="RadialGradient" doc="/** <p>Interpolate colors between a focal point and end points on a circle surrounding it (<a href="QRadialGradient.html"><tt>QRadialGradient</tt></a>).</p> */"/> <enum-value name="ConicalGradient" doc="/** <p>Interpolate colors around a center point (<a href="QConicalGradient.html"><tt>QConicalGradient</tt></a>).</p> */"/> <enum-value name="NoGradient" doc="/** <p>No gradient is used.</p> */"/> </enum> </class>