<class name="QBrush" doc="/** <p>The <a href="QBrush.html#QBrush(com.trolltech.qt.gui.QImage)"><tt>QBrush</tt></a> class defines the fill pattern of shapes drawn by <a href="QPainter.html"><tt>QPainter</tt></a>.</p> <p>A brush has a style, a color, a gradient and a texture.</p> <p>The brush <a href="QBrush.html#style()"><tt>style</tt></a> defines the fill pattern using the Qt::BrushStyle enum. The default brush style is Qt::NoBrush (depending on how you construct a brush). This style tells the painter to not fill shapes. The standard style for filling is Qt::SolidPattern. The style can be set when the brush is created using the appropriate constructor, and in addition the <a href="QBrush.html#setStyle(com.trolltech.qt.core.Qt.BrushStyle)"><tt>setStyle</tt></a> function provides means for altering the style once the brush is constructed.</p> <p align="center"><img src="%2E%2E/images/brush-styles.png" alt="Brush Styles" /></p><p>The brush <a href="QBrush.html#color()"><tt>color</tt></a> defines the color of the fill pattern. The color can either be one of Qt's predefined colors, Qt::GlobalColor, or any other custom <a href="QColor.html"><tt>QColor</tt></a>. The currently set color can be retrieved and altered using the <a href="QBrush.html#color()"><tt>color</tt></a> and <a href="QBrush.html#setColor(com.trolltech.qt.gui.QColor)"><tt>setColor</tt></a> functions, respectively.</p> <p>The <a href="QBrush.html#gradient()"><tt>gradient</tt></a> defines the gradient fill used when the current style is either Qt::LinearGradientPattern, Qt::RadialGradientPattern or Qt::ConicalGradientPattern. Gradient brushes are created by giving a <a href="QGradient.html"><tt>QGradient</tt></a> as a constructor argument when creating the <a href="QBrush.html#QBrush(com.trolltech.qt.gui.QImage)"><tt>QBrush</tt></a>. Qt provides three different gradients: <a href="QLinearGradient.html"><tt>QLinearGradient</tt></a>, <a href="QConicalGradient.html"><tt>QConicalGradient</tt></a>, and <a href="QRadialGradient.html"><tt>QRadialGradient</tt></a> - all of which inherit <a href="QGradient.html"><tt>QGradient</tt></a>.</p> <pre> QRadialGradient gradient(50, 50, 50, 50, 50); gradient.setColorAt(0, QColor::fromRgbF(0, 1, 0, 1)); gradient.setColorAt(1, QColor::fromRgbF(0, 0, 0, 0)); QBrush brush(gradient);</pre> <p>The <a href="QBrush.html#texture()"><tt>texture</tt></a> defines the pixmap used when the current style is Qt::TexturePattern. You can create a brush with a texture by providing the pixmap when the brush is created or by using <a href="QBrush.html#setTexture(com.trolltech.qt.gui.QPixmap)"><tt>setTexture</tt></a>.</p> <p>Note that applying <a href="QBrush.html#setTexture(com.trolltech.qt.gui.QPixmap)"><tt>setTexture</tt></a> makes <a href="QBrush.html#style()"><tt>style</tt></a> == Qt::TexturePattern, regardless of previous style settings. Also, calling <a href="QBrush.html#setColor(com.trolltech.qt.gui.QColor)"><tt>setColor</tt></a> will not make a difference if the style is a gradient. The same is the case if the style is Qt::TexturePattern style unless the current texture is a <a href="QBitmap.html"><tt>QBitmap</tt></a>.</p> <p>The <a href="QBrush.html#isOpaque()"><tt>isOpaque</tt></a> function returns true if the brush is fully opaque otherwise false. A brush is considered opaque if:</p> <ul> <li>The alpha component of the <a href="QBrush.html#color()"><tt>color</tt></a> is 255.</li> <li>Its <a href="QBrush.html#texture()"><tt>texture</tt></a> does not have an alpha channel and is not a <a href="QBitmap.html"><tt>QBitmap</tt></a>.</li> <li>The colors in the <a href="QBrush.html#gradient()"><tt>gradient</tt></a> all have an alpha component that is 255.</li> </ul> <p><table width="100%" align="center" cellpadding="2" cellspacing="1" border="0"> <tr valign="top" class="odd"><td><img src="%2E%2E/images/brush-outline.png" alt="Outlines" /></td><td>To specify the style and color of lines and outlines, use the <a href="QPainter.html"><tt>QPainter</tt></a>'s <a href="QPen.html">pen</tt></a> combined with Qt::PenStyle and Qt::GlobalColor:<pre> QPainter painter(this); painter.setBrush(Qt::cyan); painter.setPen(Qt::darkCyan); painter.drawRect(0, 0, 100,100); painter.setBrush(Qt::NoBrush); painter.setPen(Qt::darkGreen); painter.drawRect(40, 40, 100, 100);</pre> <p>Note that, by default, <a href="QPainter.html"><tt>QPainter</tt></a> renders the outline (using the currently set pen) when drawing shapes. Use <tt>painter.setPen(Qt::NoPen)</tt> to disable this behavior.</p> </td></tr> </table></p> <p>For more information about painting in general, see <a href="%2E%2E/paintsystem.html">The Paint System</tt></a> documentation.</p> @see <tt>Qt::BrushStyle</tt> @see <a href="QPainter.html"><tt>QPainter</tt></a> @see <a href="QColor.html"><tt>QColor</tt></a> */"> <method name="public QBrush(com.trolltech.qt.gui.QPixmap pixmap)" doc="/** <p>Constructs a brush with a black color and a texture set to the given <tt>pixmap</tt>. The style is set to Qt::TexturePattern.</p> @see <a href="QBrush.html#setTexture(com.trolltech.qt.gui.QPixmap)"><tt>setTexture</tt></a> */"/> <method name="public QBrush(com.trolltech.qt.gui.QColor color, com.trolltech.qt.core.Qt.BrushStyle bs)" doc="/** <p>Constructs a brush with the given <tt>color</tt> and <tt>bs</tt>.</p> @see <a href="QBrush.html#setColor(com.trolltech.qt.gui.QColor)"><tt>setColor</tt></a> @see <a href="QBrush.html#setStyle(com.trolltech.qt.core.Qt.BrushStyle)"><tt>setStyle</tt></a> */"/> <method name="public QBrush(com.trolltech.qt.gui.QColor color)" doc="/** <p>Equivalent to <a href="QBrush.html#QBrush(com.trolltech.qt.gui.QImage)"><tt>QBrush</tt></a>(<tt>color</tt>, Qt::SolidPattern). */"/> <method name="public QBrush(com.trolltech.qt.gui.QColor color, com.trolltech.qt.gui.QPixmap pixmap)" doc="/** <p>Constructs a brush with the given <tt>color</tt> and the custom pattern stored in <tt>pixmap</tt>.</p> <p>The style is set to Qt::TexturePattern. The color will only have an effect for QBitmaps.</p> @see <a href="QBrush.html#setColor(com.trolltech.qt.gui.QColor)"><tt>setColor</tt></a> @see <tt>setPixmap</tt> */"/> <method name="public QBrush()" doc="/** <p>Constructs a default black brush with the style Qt::NoBrush (i.e&#x2e; this brush will not fill shapes).</p> */"/> <method name="public QBrush(com.trolltech.qt.gui.QBrush brush)" doc="/** <p>Constructs a copy of <tt>brush</tt>.</p> */"/> <method name="public QBrush(com.trolltech.qt.gui.QGradient gradient)" doc="/** <p>Constructs a brush based on the given <tt>gradient</tt>.</p> <p>The brush style is set to the corresponding gradient style (either Qt::LinearGradientPattern, Qt::RadialGradientPattern or Qt::ConicalGradientPattern).</p> */"/> <method name="public QBrush(com.trolltech.qt.core.Qt.BrushStyle bs)" doc="/** <p>Constructs a black brush with the given <tt>bs</tt>.</p> @see <a href="QBrush.html#setStyle(com.trolltech.qt.core.Qt.BrushStyle)"><tt>setStyle</tt></a> */"/> <method name="public QBrush(com.trolltech.qt.core.Qt.GlobalColor color, com.trolltech.qt.gui.QPixmap pixmap)" doc="/** <p>Constructs a brush with the given <tt>color</tt> and the custom pattern stored in <tt>pixmap</tt>.</p> <p>The style is set to Qt::TexturePattern. The color will only have an effect for QBitmaps.</p> @see <a href="QBrush.html#setColor(com.trolltech.qt.gui.QColor)"><tt>setColor</tt></a> @see <tt>setPixmap</tt> */"/> <method name="public QBrush(com.trolltech.qt.gui.QImage image)" doc="/** <p>Constructs a brush with a black color and a texture set to the given <tt>image</tt>. The style is set to Qt::TexturePattern.</p> @see <a href="QBrush.html#setTextureImage(com.trolltech.qt.gui.QImage)"><tt>setTextureImage</tt></a> */"/> <method name="public final com.trolltech.qt.gui.QColor color()" doc="/** <p>Returns the brush color.</p> @see <a href="QBrush.html#setColor(com.trolltech.qt.gui.QColor)"><tt>setColor</tt></a> */"/> <method name="public final com.trolltech.qt.gui.QGradient gradient()" doc="/** <p>Returns the gradient describing this brush.</p> */"/> <method name="public final boolean isOpaque()" doc="/** <p>Returns true if the brush is fully opaque otherwise false. A brush is considered opaque if:</p> <ul> <li>The alpha component of the <a href="QBrush.html#color()"><tt>color</tt></a> is 255.</li> <li>Its <a href="QBrush.html#texture()"><tt>texture</tt></a> does not have an alpha channel and is not a <a href="QBitmap.html"><tt>QBitmap</tt></a>.</li> <li>The colors in the <a href="QBrush.html#gradient()"><tt>gradient</tt></a> all have an alpha component that is 255.</li> </ul> */"/> <method name="public final com.trolltech.qt.gui.QMatrix matrix()" doc="/** <p>Returns the current transformation matrix for the brush.</p> @see <a href="QBrush.html#setMatrix(com.trolltech.qt.gui.QMatrix)"><tt>setMatrix</tt></a> */"/> <method name="public final void writeTo(com.trolltech.qt.core.QDataStream arg__1)"/> <method name="public final void readFrom(com.trolltech.qt.core.QDataStream arg__1)"/> <method name="public final void setColor(com.trolltech.qt.core.Qt.GlobalColor color)" doc="/** <p>Sets the brush color to the given <tt>color</tt>.</p> */"/> <method name="public final void setColor(com.trolltech.qt.gui.QColor color)" doc="/** <p>Sets the brush color to the given <tt>color</tt>.</p> <p>Note that calling <a href="QBrush.html#setColor(com.trolltech.qt.gui.QColor)"><tt>setColor</tt></a> will not make a difference if the style is a gradient. The same is the case if the style is Qt::TexturePattern style unless the current texture is a <a href="QBitmap.html"><tt>QBitmap</tt></a>.</p> @see <a href="QBrush.html#color()"><tt>color</tt></a> */"/> <method name="public final void setMatrix(com.trolltech.qt.gui.QMatrix mat)" doc="/** <p>Sets <tt>mat</tt> as an explicit transformation matrix on the current brush. The brush transformation matrix is merged with <a href="QPainter.html"><tt>QPainter</tt></a> transformation matrix to produce the final result.</p> @see <a href="QBrush.html#matrix()"><tt>matrix</tt></a> */"/> <method name="public final void setStyle(com.trolltech.qt.core.Qt.BrushStyle arg__1)" doc="/** <p>Sets the brush style to <tt>arg__1</tt>.</p> @see <a href="QBrush.html#style()"><tt>style</tt></a> */"/> <method name="public final void setTexture(com.trolltech.qt.gui.QPixmap pixmap)" doc="/** <p>Sets the brush pixmap to <tt>pixmap</tt>. The style is set to Qt::TexturePattern.</p> <p>The current brush color will only have an effect for monochrome pixmaps, i.e&#x2e; for QPixmap::depth() == 1 (<a href="QBitmap.html">QBitmaps</a>).</p> @see <a href="QBrush.html#texture()"><tt>texture</tt></a> */"/> <method name="public final void setTextureImage(com.trolltech.qt.gui.QImage image)" doc="/** <p>Sets the brush image to <tt>image</tt>. The style is set to Qt::TexturePattern.</p> <p>The current brush color will only have an effect for monochrome images, i.e&#x2e; for QImage::depth() == 1.</p> @see <a href="QBrush.html#textureImage()"><tt>textureImage</tt></a> */"/> <method name="public final void setTransform(com.trolltech.qt.gui.QTransform arg__1)" doc="/** <p>Sets <tt>arg__1</tt> as an explicit transformation matrix on the current brush. The brush transformation matrix is merged with <a href="QPainter.html"><tt>QPainter</tt></a> transformation matrix to produce the final result.</p> @see <a href="QBrush.html#transform()"><tt>transform</tt></a> */"/> <method name="public final com.trolltech.qt.core.Qt.BrushStyle style()" doc="/** <p>Returns the brush style.</p> @see <a href="QBrush.html#setStyle(com.trolltech.qt.core.Qt.BrushStyle)"><tt>setStyle</tt></a> */"/> <method name="public final com.trolltech.qt.gui.QPixmap texture()" doc="/** <p>Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set.</p> @see <a href="QBrush.html#setTexture(com.trolltech.qt.gui.QPixmap)"><tt>setTexture</tt></a> */"/> <method name="public final com.trolltech.qt.gui.QImage textureImage()" doc="/** <p>Returns the custom brush pattern, or a null image if no custom brush pattern has been set.</p> <p>If the texture was set as a <a href="QPixmap.html"><tt>QPixmap</tt></a> it will be converted to a <a href="QImage.html"><tt>QImage</tt></a>.</p> @see <a href="QBrush.html#setTextureImage(com.trolltech.qt.gui.QImage)"><tt>setTextureImage</tt></a> */"/> <method name="public final com.trolltech.qt.gui.QTransform transform()" doc="/** <p>Returns the current transformation matrix for the brush.</p> @see <a href="QBrush.html#setTransform(com.trolltech.qt.gui.QTransform)"><tt>setTransform</tt></a> */"/> </class>