summaryrefslogtreecommitdiffstats
path: root/doc/html/tqbrush.html
blob: 09707e779f96ce6b31212b9220f090c6f39bb27c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<!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/tqpainter.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="tqbrush-h.html">tqbrush.h</a>&gt;</tt>
<p>Inherits <a href="tqt.html">TQt</a>.
<p><a href="tqbrush-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="tqpainter.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="tqpixmap.html">TQPixmap</a>.
<p> The brush style defines the fill pattern. The default brush style
is <a href="tqt.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="tqt.html#BrushStyle-enum">SolidPattern</a>.
<p> The brush color defines the color of the fill pattern. The <a href="tqcolor.html">TQColor</a>
documentation lists the predefined colors.
<p> Use the <a href="tqpen.html">TQPen</a> class for specifying line/outline styles.
<p> Example:
<pre>
        <a href="tqpainter.html">TQPainter</a> painter;
        TQBrush   brush( yellow );           // yellow solid pattern
        painter.<a href="tqpainter.html#begin">begin</a>( &amp;anyPaintDevice );   // paint something
        painter.<a href="tqpainter.html#setBrush">setBrush</a>( brush );          // set the yellow brush
        painter.<a href="tqpainter.html#setPen">setPen</a>( <a href="tqt.html#PenStyle-enum">NoPen</a> );            // do not draw outline
        painter.<a href="tqpainter.html#drawRect">drawRect</a>( 40,30, 200,100 ); // draw filled rectangle
        painter.<a href="tqpainter.html#setBrush">setBrush</a>( <a href="tqt.html#BrushStyle-enum">NoBrush</a> );        // do not fill
        painter.<a href="tqpainter.html#setPen">setPen</a>( black );            // set black pen, 0 pixel width
        painter.<a href="tqpainter.html#drawRect">drawRect</a>( 10,10, 30,20 );   // draw rectangle outline
        painter.<a href="tqpainter.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="tqpainter.html">TQPainter</a>, <a href="tqpainter.html#setBrush">TQPainter::setBrush</a>(), <a href="tqpainter.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="tqt.html#BrushStyle-enum">NoBrush</a> (will
not fill shapes).

<h3 class=fn><a name="TQBrush-2"></a>TQBrush::TQBrush ( <a href="tqt.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="tqcolor.html">TQColor</a>&nbsp;&amp;&nbsp;color, <a href="tqt.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="tqcolor.html">TQColor</a>&nbsp;&amp;&nbsp;color, const&nbsp;<a href="tqpixmap.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="tqpixmap.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="tqbrush.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="tqcolor.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="tqbrush.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="tqbrush.html">TQBrush</a>&nbsp;&amp; <a name="operator-eq"></a>TQBrush::operator= ( const&nbsp;<a href="tqbrush.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="tqbrush.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="tqpixmap.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="tqcolor.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="tqpixmap.html">TQPixmap</a>&nbsp;&amp;&nbsp;pixmap )
</h3>
Sets the brush pixmap to <em>pixmap</em>. The style is set to <a href="tqt.html#BrushStyle-enum">CustomPattern</a>.
<p> The current brush color will only have an effect for monochrome
pixmaps, i.e. for <a href="tqpixmap.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="tqt.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="tqt.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="tqdatastream.html">TQDataStream</a>&nbsp;&amp; <a name="operator-lt-lt"></a>operator&lt;&lt; ( <a href="tqdatastream.html">TQDataStream</a>&nbsp;&amp;&nbsp;s, const&nbsp;<a href="tqbrush.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="tqdatastream.html">TQDataStream</a>&nbsp;&amp; <a name="operator-gt-gt"></a>operator&gt;&gt; ( <a href="tqdatastream.html">TQDataStream</a>&nbsp;&amp;&nbsp;s, <a href="tqbrush.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>