You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/html/ntqbrush.html

240 lines
14 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qpainter.cpp:3567 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQBrush Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQBrush Class Reference</h1>
<p>The TQBrush class defines the fill pattern of shapes drawn by a TQPainter.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qbrush-h.html">ntqbrush.h</a>&gt;</tt>
<p>Inherits <a href="ntqt.html">TQt</a>.
<p><a href="qbrush-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQBrush"><b>TQBrush</b></a> ()</li>
<li class=fn><a href="#TQBrush-2"><b>TQBrush</b></a> ( BrushStyle&nbsp;style )</li>
<li class=fn><a href="#TQBrush-3"><b>TQBrush</b></a> ( const&nbsp;TQColor&nbsp;&amp;&nbsp;color, BrushStyle&nbsp;style = SolidPattern )</li>
<li class=fn><a href="#TQBrush-4"><b>TQBrush</b></a> ( const&nbsp;TQColor&nbsp;&amp;&nbsp;color, const&nbsp;TQPixmap&nbsp;&amp;&nbsp;pixmap )</li>
<li class=fn><a href="#TQBrush-5"><b>TQBrush</b></a> ( const&nbsp;TQBrush&nbsp;&amp;&nbsp;b )</li>
<li class=fn><a href="#~TQBrush"><b>~TQBrush</b></a> ()</li>
<li class=fn>TQBrush &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;TQBrush&nbsp;&amp;&nbsp;b )</li>
<li class=fn>BrushStyle <a href="#style"><b>style</b></a> () const</li>
<li class=fn>void <a href="#setStyle"><b>setStyle</b></a> ( BrushStyle&nbsp;s )</li>
<li class=fn>const TQColor &amp; <a href="#color"><b>color</b></a> () const</li>
<li class=fn>void <a href="#setColor"><b>setColor</b></a> ( const&nbsp;TQColor&nbsp;&amp;&nbsp;c )</li>
<li class=fn>TQPixmap * <a href="#pixmap"><b>pixmap</b></a> () const</li>
<li class=fn>void <a href="#setPixmap"><b>setPixmap</b></a> ( const&nbsp;TQPixmap&nbsp;&amp;&nbsp;pixmap )</li>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;TQBrush&nbsp;&amp;&nbsp;b ) const</li>
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;TQBrush&nbsp;&amp;&nbsp;b ) const</li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>TQDataStream &amp; <a href="#operator-lt-lt"><b>operator&lt;&lt;</b></a> ( TQDataStream&nbsp;&amp;&nbsp;s, const&nbsp;TQBrush&nbsp;&amp;&nbsp;b )</li>
<li class=fn>TQDataStream &amp; <a href="#operator-gt-gt"><b>operator&gt;&gt;</b></a> ( TQDataStream&nbsp;&amp;&nbsp;s, TQBrush&nbsp;&amp;&nbsp;b )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
<p> The TQBrush class defines the fill pattern of shapes drawn by a <a href="ntqpainter.html">TQPainter</a>.
<p>
<p> A brush has a style and a color. One of the brush styles is a
custom pattern, which is defined by a <a href="ntqpixmap.html">TQPixmap</a>.
<p> The brush style defines the fill pattern. The default brush style
is <a href="ntqt.html#BrushStyle-enum">NoBrush</a> (depending on how you construct a brush). This style
tells the painter to not fill shapes. The standard style for
filling is <a href="ntqt.html#BrushStyle-enum">SolidPattern</a>.
<p> The brush color defines the color of the fill pattern. The <a href="ntqcolor.html">TQColor</a>
documentation lists the predefined colors.
<p> Use the <a href="ntqpen.html">TQPen</a> class for specifying line/outline styles.
<p> Example:
<pre>
<a href="ntqpainter.html">TQPainter</a> painter;
TQBrush brush( yellow ); // yellow solid pattern
painter.<a href="ntqpainter.html#begin">begin</a>( &amp;anyPaintDevice ); // paint something
painter.<a href="ntqpainter.html#setBrush">setBrush</a>( brush ); // set the yellow brush
painter.<a href="ntqpainter.html#setPen">setPen</a>( <a href="ntqt.html#PenStyle-enum">NoPen</a> ); // do not draw outline
painter.<a href="ntqpainter.html#drawRect">drawRect</a>( 40,30, 200,100 ); // draw filled rectangle
painter.<a href="ntqpainter.html#setBrush">setBrush</a>( <a href="ntqt.html#BrushStyle-enum">NoBrush</a> ); // do not fill
painter.<a href="ntqpainter.html#setPen">setPen</a>( black ); // set black pen, 0 pixel width
painter.<a href="ntqpainter.html#drawRect">drawRect</a>( 10,10, 30,20 ); // draw rectangle outline
painter.<a href="ntqpainter.html#end">end</a>(); // painting done
</pre>
<p> See the <a href="#setStyle">setStyle</a>() function for a complete list of brush styles.
<p> <center><img src="brush-styles.png" alt="Brush Styles"></center>
<p> <p>See also <a href="ntqpainter.html">TQPainter</a>, <a href="ntqpainter.html#setBrush">TQPainter::setBrush</a>(), <a href="ntqpainter.html#setBrushOrigin">TQPainter::setBrushOrigin</a>(), <a href="graphics.html">Graphics Classes</a>, <a href="images.html">Image Processing Classes</a>, and <a href="shared.html">Implicitly and Explicitly Shared Classes</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQBrush"></a>TQBrush::TQBrush ()
</h3>
Constructs a default black brush with the style <a href="ntqt.html#BrushStyle-enum">NoBrush</a> (will
not fill shapes).
<h3 class=fn><a name="TQBrush-2"></a>TQBrush::TQBrush ( <a href="ntqt.html#BrushStyle-enum">BrushStyle</a>&nbsp;style )
</h3>
Constructs a black brush with the style <em>style</em>.
<p> <p>See also <a href="#setStyle">setStyle</a>().
<h3 class=fn><a name="TQBrush-3"></a>TQBrush::TQBrush ( const&nbsp;<a href="ntqcolor.html">TQColor</a>&nbsp;&amp;&nbsp;color, <a href="ntqt.html#BrushStyle-enum">BrushStyle</a>&nbsp;style = SolidPattern )
</h3>
Constructs a brush with the color <em>color</em> and the style <em>style</em>.
<p> <p>See also <a href="#setColor">setColor</a>() and <a href="#setStyle">setStyle</a>().
<h3 class=fn><a name="TQBrush-4"></a>TQBrush::TQBrush ( const&nbsp;<a href="ntqcolor.html">TQColor</a>&nbsp;&amp;&nbsp;color, const&nbsp;<a href="ntqpixmap.html">TQPixmap</a>&nbsp;&amp;&nbsp;pixmap )
</h3>
Constructs a brush with the color <em>color</em> and a custom pattern
stored in <em>pixmap</em>.
<p> The color will only have an effect for monochrome pixmaps, i.e.
for <a href="ntqpixmap.html#depth">TQPixmap::depth</a>() == 1.
<p> Pixmap brushes are currently not supported when printing on X11.
<p> <p>See also <a href="#setColor">setColor</a>() and <a href="#setPixmap">setPixmap</a>().
<h3 class=fn><a name="TQBrush-5"></a>TQBrush::TQBrush ( const&nbsp;<a href="ntqbrush.html">TQBrush</a>&nbsp;&amp;&nbsp;b )
</h3>
Constructs a brush that is a <a href="shclass.html">shallow
copy</a> of <em>b</em>.
<h3 class=fn><a name="~TQBrush"></a>TQBrush::~TQBrush ()
</h3>
Destroys the brush.
<h3 class=fn>const&nbsp;<a href="ntqcolor.html">TQColor</a>&nbsp;&amp; <a name="color"></a>TQBrush::color () const
</h3>
<p> Returns the brush color.
<p> <p>See also <a href="#setColor">setColor</a>().
<h3 class=fn>bool <a name="operator!-eq"></a>TQBrush::operator!= ( const&nbsp;<a href="ntqbrush.html">TQBrush</a>&nbsp;&amp;&nbsp;b ) const
</h3>
<p> Returns TRUE if the brush is different from <em>b</em>; otherwise
returns FALSE.
<p> Two brushes are different if they have different styles, colors or
pixmaps.
<p> <p>See also <a href="#operator-eq-eq">operator==</a>().
<h3 class=fn><a href="ntqbrush.html">TQBrush</a>&nbsp;&amp; <a name="operator-eq"></a>TQBrush::operator= ( const&nbsp;<a href="ntqbrush.html">TQBrush</a>&nbsp;&amp;&nbsp;b )
</h3>
Assigns <em>b</em> to this brush and returns a reference to this brush.
<h3 class=fn>bool <a name="operator-eq-eq"></a>TQBrush::operator== ( const&nbsp;<a href="ntqbrush.html">TQBrush</a>&nbsp;&amp;&nbsp;b ) const
</h3>
Returns TRUE if the brush is equal to <em>b</em>; otherwise returns
FALSE.
<p> Two brushes are equal if they have equal styles, colors and
pixmaps.
<p> <p>See also <a href="#operator!-eq">operator!=</a>().
<h3 class=fn><a href="ntqpixmap.html">TQPixmap</a>&nbsp;* <a name="pixmap"></a>TQBrush::pixmap () const
</h3>
<p> Returns a pointer to the custom brush pattern, or 0 if no custom
brush pattern has been set.
<p> <p>See also <a href="#setPixmap">setPixmap</a>().
<p>Example: <a href="richtext-example.html#x460">richtext/richtext.cpp</a>.
<h3 class=fn>void <a name="setColor"></a>TQBrush::setColor ( const&nbsp;<a href="ntqcolor.html">TQColor</a>&nbsp;&amp;&nbsp;c )
</h3>
Sets the brush color to <em>c</em>.
<p> <p>See also <a href="#color">color</a>() and <a href="#setStyle">setStyle</a>().
<p>Example: <a href="picture-example.html#x108">picture/picture.cpp</a>.
<h3 class=fn>void <a name="setPixmap"></a>TQBrush::setPixmap ( const&nbsp;<a href="ntqpixmap.html">TQPixmap</a>&nbsp;&amp;&nbsp;pixmap )
</h3>
Sets the brush pixmap to <em>pixmap</em>. The style is set to <a href="ntqt.html#BrushStyle-enum">CustomPattern</a>.
<p> The current brush color will only have an effect for monochrome
pixmaps, i.e. for <a href="ntqpixmap.html#depth">TQPixmap::depth</a>() == 1.
<p> Pixmap brushes are currently not supported when printing on X11.
<p> <p>See also <a href="#pixmap">pixmap</a>() and <a href="#color">color</a>().
<p>Example: <a href="richtext-example.html#x461">richtext/richtext.cpp</a>.
<h3 class=fn>void <a name="setStyle"></a>TQBrush::setStyle ( <a href="ntqt.html#BrushStyle-enum">BrushStyle</a>&nbsp;s )
</h3>
Sets the brush style to <em>s</em>.
<p> The brush styles are:
<center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Pattern <th valign="top">Meaning
<tr bgcolor="#f0f0f0"> <td valign="top">NoBrush <td valign="top">will not fill shapes (default).
<tr bgcolor="#d0d0d0"> <td valign="top">SolidPattern <td valign="top">solid (100%) fill pattern.
<tr bgcolor="#f0f0f0"> <td valign="top">Dense1Pattern <td valign="top" colspan="1" rowspan="1"> 94% fill pattern.
<tr bgcolor="#d0d0d0"> <td valign="top">Dense2Pattern <td valign="top" colspan="1" rowspan="1"> 88% fill pattern.
<tr bgcolor="#f0f0f0"> <td valign="top">Dense3Pattern <td valign="top" colspan="1" rowspan="1"> 63% fill pattern.
<tr bgcolor="#d0d0d0"> <td valign="top">Dense4Pattern <td valign="top" colspan="1" rowspan="1"> 50% fill pattern.
<tr bgcolor="#f0f0f0"> <td valign="top">Dense5Pattern <td valign="top" colspan="1" rowspan="1"> 37% fill pattern.
<tr bgcolor="#d0d0d0"> <td valign="top">Dense6Pattern <td valign="top" colspan="1" rowspan="1"> 12% fill pattern.
<tr bgcolor="#f0f0f0"> <td valign="top">Dense7Pattern <td valign="top" colspan="1" rowspan="1"> 6% fill pattern.
<tr bgcolor="#d0d0d0"> <td valign="top">HorPattern <td valign="top">horizontal lines pattern.
<tr bgcolor="#f0f0f0"> <td valign="top">VerPattern <td valign="top">vertical lines pattern.
<tr bgcolor="#d0d0d0"> <td valign="top">CrossPattern <td valign="top">crossing lines pattern.
<tr bgcolor="#f0f0f0"> <td valign="top">BDiagPattern <td valign="top">diagonal lines (directed /) pattern.
<tr bgcolor="#d0d0d0"> <td valign="top">FDiagPattern <td valign="top">diagonal lines (directed &#92;) pattern.
<tr bgcolor="#f0f0f0"> <td valign="top">DiagCrossPattern <td valign="top">diagonal crossing lines pattern.
<tr bgcolor="#d0d0d0"> <td valign="top">CustomPattern <td valign="top">set when a pixmap pattern is being used.
</table></center>
<p> On Windows, dense and custom patterns cannot be transparent.
<p> See the <a href="#details">Detailed Description</a> for a picture
of all the styles.
<p> <p>See also <a href="#style">style</a>().
<h3 class=fn><a href="ntqt.html#BrushStyle-enum">BrushStyle</a> <a name="style"></a>TQBrush::style () const
</h3>
<p> Returns the brush style.
<p> <p>See also <a href="#setStyle">setStyle</a>().
<hr><h2>Related Functions</h2>
<h3 class=fn><a href="ntqdatastream.html">TQDataStream</a>&nbsp;&amp; <a name="operator-lt-lt"></a>operator&lt;&lt; ( <a href="ntqdatastream.html">TQDataStream</a>&nbsp;&amp;&nbsp;s, const&nbsp;<a href="ntqbrush.html">TQBrush</a>&nbsp;&amp;&nbsp;b )
</h3>
<p> Writes the brush <em>b</em> to the stream <em>s</em> and returns a reference
to the stream.
<p> <p>See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>.
<h3 class=fn><a href="ntqdatastream.html">TQDataStream</a>&nbsp;&amp; <a name="operator-gt-gt"></a>operator&gt;&gt; ( <a href="ntqdatastream.html">TQDataStream</a>&nbsp;&amp;&nbsp;s, <a href="ntqbrush.html">TQBrush</a>&nbsp;&amp;&nbsp;b )
</h3>
<p> Reads the brush <em>b</em> from the stream <em>s</em> and returns a reference
to the stream.
<p> <p>See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>