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.
288 lines
16 KiB
288 lines
16 KiB
13 years ago
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
5 months ago
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/tqpainter.cpp:3138 -->
|
||
13 years ago
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
|
<title>TQPen 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 Classes</font></a>
|
||
|
| <a href="mainclasses.html">
|
||
|
<font color="#004faf">Main Classes</font></a>
|
||
|
| <a href="annotated.html">
|
||
|
<font color="#004faf">Annotated</font></a>
|
||
|
| <a href="groups.html">
|
||
|
<font color="#004faf">Grouped 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>TQPen Class Reference</h1>
|
||
|
|
||
|
<p>The TQPen class defines how a TQPainter should draw lines and outlines
|
||
|
of shapes.
|
||
|
<a href="#details">More...</a>
|
||
5 months ago
|
<p><tt>#include <<a href="tqpen-h.html">tqpen.h</a>></tt>
|
||
13 years ago
|
<p>Inherits <a href="ntqt.html">TQt</a>.
|
||
5 months ago
|
<p><a href="tqpen-members.html">List of all member functions.</a>
|
||
13 years ago
|
<h2>Public Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn><a href="#TQPen"><b>TQPen</b></a> ()</li>
|
||
|
<li class=fn><a href="#TQPen-2"><b>TQPen</b></a> ( PenStyle style )</li>
|
||
|
<li class=fn><a href="#TQPen-3"><b>TQPen</b></a> ( const TQColor & color, uint width = 0, PenStyle style = SolidLine )</li>
|
||
|
<li class=fn><a href="#TQPen-4"><b>TQPen</b></a> ( const TQColor & cl, uint w, PenStyle s, PenCapStyle c, PenJoinStyle j )</li>
|
||
|
<li class=fn><a href="#TQPen-5"><b>TQPen</b></a> ( const TQPen & p )</li>
|
||
|
<li class=fn><a href="#~TQPen"><b>~TQPen</b></a> ()</li>
|
||
|
<li class=fn>TQPen & <a href="#operator-eq"><b>operator=</b></a> ( const TQPen & p )</li>
|
||
|
<li class=fn>PenStyle <a href="#style"><b>style</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#setStyle"><b>setStyle</b></a> ( PenStyle s )</li>
|
||
|
<li class=fn>uint <a href="#width"><b>width</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#setWidth"><b>setWidth</b></a> ( uint w )</li>
|
||
|
<li class=fn>const TQColor & <a href="#color"><b>color</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#setColor"><b>setColor</b></a> ( const TQColor & c )</li>
|
||
|
<li class=fn>PenCapStyle <a href="#capStyle"><b>capStyle</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#setCapStyle"><b>setCapStyle</b></a> ( PenCapStyle c )</li>
|
||
|
<li class=fn>PenJoinStyle <a href="#joinStyle"><b>joinStyle</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#setJoinStyle"><b>setJoinStyle</b></a> ( PenJoinStyle j )</li>
|
||
|
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const TQPen & p ) const</li>
|
||
|
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const TQPen & p ) const</li>
|
||
|
</ul>
|
||
|
<h2>Related Functions</h2>
|
||
|
<ul>
|
||
|
<li class=fn>TQDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( TQDataStream & s, const TQPen & p )</li>
|
||
|
<li class=fn>TQDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( TQDataStream & s, TQPen & p )</li>
|
||
|
</ul>
|
||
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
||
|
|
||
|
|
||
5 months ago
|
The TQPen class defines how a <a href="tqpainter.html">TQPainter</a> should draw lines and outlines
|
||
13 years ago
|
of shapes.
|
||
|
<p>
|
||
|
|
||
|
|
||
|
|
||
|
<p> A pen has a style, width, color, cap style and join style.
|
||
13 years ago
|
<p> The pen style defines the line type. The default pen style is <a href="ntqt.html#PenStyle-enum">TQt::SolidLine</a>. Setting the style to <a href="ntqt.html#PenStyle-enum">NoPen</a> tells the painter to
|
||
13 years ago
|
not draw lines or outlines.
|
||
|
<p> When drawing 1 pixel wide diagonal lines you can either use a very
|
||
|
fast algorithm (specified by a line width of 0, which is the
|
||
|
default), or a slower but more accurate algorithm (specified by a
|
||
|
line width of 1). For horizontal and vertical lines a line width
|
||
|
of 0 is the same as a line width of 1. The cap and join style have
|
||
|
no effect on 0-width lines.
|
||
|
<p> The pen color defines the color of lines and text. The default
|
||
5 months ago
|
line color is black. The <a href="tqcolor.html">TQColor</a> documentation lists predefined
|
||
13 years ago
|
colors.
|
||
|
<p> The cap style defines how the end points of lines are drawn. The
|
||
|
join style defines how the joins between two lines are drawn when
|
||
5 months ago
|
multiple connected lines are drawn (<a href="tqpainter.html#drawPolyline">TQPainter::drawPolyline</a>()
|
||
13 years ago
|
etc.). The cap and join styles only apply to wide lines, i.e. when
|
||
|
the width is 1 or greater.
|
||
5 months ago
|
<p> Use the <a href="tqbrush.html">TQBrush</a> class to specify fill styles.
|
||
13 years ago
|
<p> Example:
|
||
|
<pre>
|
||
5 months ago
|
<a href="tqpainter.html">TQPainter</a> painter;
|
||
13 years ago
|
TQPen pen( red, 2 ); // red solid line, 2 pixels wide
|
||
5 months ago
|
painter.<a href="tqpainter.html#begin">begin</a>( &anyPaintDevice ); // paint something
|
||
|
painter.<a href="tqpainter.html#setPen">setPen</a>( pen ); // set the red, wide pen
|
||
|
painter.<a href="tqpainter.html#drawRect">drawRect</a>( 40,30, 200,100 ); // draw a rectangle
|
||
|
painter.<a href="tqpainter.html#setPen">setPen</a>( blue ); // set blue pen, 0 pixel width
|
||
|
painter.<a href="tqpainter.html#drawLine">drawLine</a>( 40,30, 240,130 ); // draw a diagonal in rectangle
|
||
|
painter.<a href="tqpainter.html#end">end</a>(); // painting done
|
||
13 years ago
|
</pre>
|
||
|
|
||
13 years ago
|
<p> See the <a href="ntqt.html#PenStyle-enum">TQt::PenStyle</a> enum type for a complete list of pen
|
||
13 years ago
|
styles.
|
||
|
<p> With reference to the end points of lines, for wide (non-0-width)
|
||
|
pens it depends on the cap style whether the end point is drawn or
|
||
5 months ago
|
not. <a href="tqpainter.html">TQPainter</a> will try to make sure that the end point is drawn
|
||
13 years ago
|
for 0-width pens, but this cannot be absolutely guaranteed because
|
||
|
the underlying drawing engine is free to use any (typically
|
||
|
accelerated) algorithm for drawing 0-width lines. On all tested
|
||
|
systems, however, the end point of at least all non-diagonal lines
|
||
|
are drawn.
|
||
|
<p> A pen's <a href="#color">color</a>(), <a href="#width">width</a>(), <a href="#style">style</a>(), <a href="#capStyle">capStyle</a>() and <a href="#joinStyle">joinStyle</a>() can
|
||
|
be set in the constructor or later with <a href="#setColor">setColor</a>(), <a href="#setWidth">setWidth</a>(),
|
||
|
<a href="#setStyle">setStyle</a>(), <a href="#setCapStyle">setCapStyle</a>() and <a href="#setJoinStyle">setJoinStyle</a>(). Pens may also be
|
||
|
compared and streamed.
|
||
|
<p> <center><img src="pen-styles.png" alt="Pen styles"></center>
|
||
5 months ago
|
<p> <p>See also <a href="tqpainter.html">TQPainter</a>, <a href="tqpainter.html#setPen">TQPainter::setPen</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>.
|
||
13 years ago
|
|
||
|
<hr><h2>Member Function Documentation</h2>
|
||
|
<h3 class=fn><a name="TQPen"></a>TQPen::TQPen ()
|
||
|
</h3>
|
||
|
Constructs a default black solid line pen with 0 width, which
|
||
|
renders lines 1 pixel wide (fast diagonals).
|
||
|
|
||
13 years ago
|
<h3 class=fn><a name="TQPen-2"></a>TQPen::TQPen ( <a href="ntqt.html#PenStyle-enum">PenStyle</a> style )
|
||
13 years ago
|
</h3>
|
||
|
Constructs a black pen with 0 width (fast diagonals) and style <em>style</em>.
|
||
|
<p> <p>See also <a href="#setStyle">setStyle</a>().
|
||
|
|
||
5 months ago
|
<h3 class=fn><a name="TQPen-3"></a>TQPen::TQPen ( const <a href="tqcolor.html">TQColor</a> & color, uint width = 0, <a href="ntqt.html#PenStyle-enum">PenStyle</a> style = SolidLine )
|
||
13 years ago
|
</h3>
|
||
|
Constructs a pen with the specified <em>color</em>, <em>width</em> and <em>style</em>.
|
||
|
<p> <p>See also <a href="#setWidth">setWidth</a>(), <a href="#setStyle">setStyle</a>(), and <a href="#setColor">setColor</a>().
|
||
|
|
||
5 months ago
|
<h3 class=fn><a name="TQPen-4"></a>TQPen::TQPen ( const <a href="tqcolor.html">TQColor</a> & cl, uint w, <a href="ntqt.html#PenStyle-enum">PenStyle</a> s, <a href="ntqt.html#PenCapStyle-enum">PenCapStyle</a> c, <a href="ntqt.html#PenJoinStyle-enum">PenJoinStyle</a> j )
|
||
13 years ago
|
</h3>
|
||
|
Constructs a pen with the specified color <em>cl</em> and width <em>w</em>.
|
||
|
The pen style is set to <em>s</em>, the pen cap style to <em>c</em> and the
|
||
|
pen join style to <em>j</em>.
|
||
|
<p> A line width of 0 will produce a 1 pixel wide line using a fast
|
||
|
algorithm for diagonals. A line width of 1 will also produce a 1
|
||
|
pixel wide line, but uses a slower more accurate algorithm for
|
||
|
diagonals. For horizontal and vertical lines a line width of 0 is
|
||
|
the same as a line width of 1. The cap and join style have no
|
||
|
effect on 0-width lines.
|
||
|
<p> <p>See also <a href="#setWidth">setWidth</a>(), <a href="#setStyle">setStyle</a>(), and <a href="#setColor">setColor</a>().
|
||
|
|
||
5 months ago
|
<h3 class=fn><a name="TQPen-5"></a>TQPen::TQPen ( const <a href="tqpen.html">TQPen</a> & p )
|
||
13 years ago
|
</h3>
|
||
|
Constructs a pen that is a copy of <em>p</em>.
|
||
|
|
||
|
<h3 class=fn><a name="~TQPen"></a>TQPen::~TQPen ()
|
||
|
</h3>
|
||
|
Destroys the pen.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqt.html#PenCapStyle-enum">PenCapStyle</a> <a name="capStyle"></a>TQPen::capStyle () const
|
||
13 years ago
|
</h3>
|
||
|
Returns the pen's cap style.
|
||
|
<p> <p>See also <a href="#setCapStyle">setCapStyle</a>().
|
||
|
|
||
5 months ago
|
<h3 class=fn>const <a href="tqcolor.html">TQColor</a> & <a name="color"></a>TQPen::color () const
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Returns the pen color.
|
||
|
<p> <p>See also <a href="#setColor">setColor</a>().
|
||
|
|
||
|
<p>Example: <a href="scribble-example.html#x902">scribble/scribble.h</a>.
|
||
13 years ago
|
<h3 class=fn><a href="ntqt.html#PenJoinStyle-enum">PenJoinStyle</a> <a name="joinStyle"></a>TQPen::joinStyle () const
|
||
13 years ago
|
</h3>
|
||
|
Returns the pen's join style.
|
||
|
<p> <p>See also <a href="#setJoinStyle">setJoinStyle</a>().
|
||
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="operator!-eq"></a>TQPen::operator!= ( const <a href="tqpen.html">TQPen</a> & p ) const
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Returns TRUE if the pen is different from <em>p</em>; otherwise returns
|
||
|
FALSE.
|
||
|
<p> Two pens are different if they have different styles, widths or
|
||
|
colors.
|
||
|
<p> <p>See also <a href="#operator-eq-eq">operator==</a>().
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqpen.html">TQPen</a> & <a name="operator-eq"></a>TQPen::operator= ( const <a href="tqpen.html">TQPen</a> & p )
|
||
13 years ago
|
</h3>
|
||
|
Assigns <em>p</em> to this pen and returns a reference to this pen.
|
||
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="operator-eq-eq"></a>TQPen::operator== ( const <a href="tqpen.html">TQPen</a> & p ) const
|
||
13 years ago
|
</h3>
|
||
|
Returns TRUE if the pen is equal to <em>p</em>; otherwise returns FALSE.
|
||
|
<p> Two pens are equal if they have equal styles, widths and colors.
|
||
|
<p> <p>See also <a href="#operator!-eq">operator!=</a>().
|
||
|
|
||
13 years ago
|
<h3 class=fn>void <a name="setCapStyle"></a>TQPen::setCapStyle ( <a href="ntqt.html#PenCapStyle-enum">PenCapStyle</a> c )
|
||
13 years ago
|
</h3>
|
||
|
Sets the pen's cap style to <em>c</em>.
|
||
13 years ago
|
<p> The default value is <a href="ntqt.html#PenCapStyle-enum">FlatCap</a>. The cap style has no effect on
|
||
13 years ago
|
0-width pens.
|
||
|
<p> <center><img src="pen-cap-styles.png" alt="Pen Cap Styles"></center>
|
||
|
<p> <b>Warning:</b> On Windows 95/98 and Macintosh, the cap style setting has
|
||
13 years ago
|
no effect. Wide lines are rendered as if the cap style was <a href="ntqt.html#PenCapStyle-enum">SquareCap</a>.
|
||
13 years ago
|
<p> <p>See also <a href="#capStyle">capStyle</a>().
|
||
|
|
||
|
<p>Example: <a href="themes-example.html#x226">themes/wood.cpp</a>.
|
||
5 months ago
|
<h3 class=fn>void <a name="setColor"></a>TQPen::setColor ( const <a href="tqcolor.html">TQColor</a> & c )
|
||
13 years ago
|
</h3>
|
||
|
Sets the pen color to <em>c</em>.
|
||
|
<p> <p>See also <a href="#color">color</a>().
|
||
|
|
||
|
<p>Examples: <a href="progress-example.html#x79">progress/progress.cpp</a> and <a href="scribble-example.html#x903">scribble/scribble.h</a>.
|
||
13 years ago
|
<h3 class=fn>void <a name="setJoinStyle"></a>TQPen::setJoinStyle ( <a href="ntqt.html#PenJoinStyle-enum">PenJoinStyle</a> j )
|
||
13 years ago
|
</h3>
|
||
|
Sets the pen's join style to <em>j</em>.
|
||
13 years ago
|
<p> The default value is <a href="ntqt.html#PenJoinStyle-enum">MiterJoin</a>. The join style has no effect on
|
||
13 years ago
|
0-width pens.
|
||
|
<p> <center><img src="pen-join-styles.png" alt="Pen Join Styles"></center>
|
||
|
<p> <b>Warning:</b> On Windows 95/98 and Macintosh, the join style setting
|
||
13 years ago
|
has no effect. Wide lines are rendered as if the join style was <a href="ntqt.html#PenJoinStyle-enum">BevelJoin</a>.
|
||
13 years ago
|
<p> <p>See also <a href="#joinStyle">joinStyle</a>().
|
||
|
|
||
|
<p>Example: <a href="themes-example.html#x227">themes/wood.cpp</a>.
|
||
13 years ago
|
<h3 class=fn>void <a name="setStyle"></a>TQPen::setStyle ( <a href="ntqt.html#PenStyle-enum">PenStyle</a> s )
|
||
13 years ago
|
</h3>
|
||
|
Sets the pen style to <em>s</em>.
|
||
13 years ago
|
<p> See the <a href="ntqt.html#PenStyle-enum">TQt::PenStyle</a> documentation for a list of all the
|
||
13 years ago
|
styles.
|
||
13 years ago
|
<p> <b>Warning:</b> On Mac OS X the style setting (other than <a href="ntqt.html#PenStyle-enum">NoPen</a> and <a href="ntqt.html#PenStyle-enum">SolidLine</a>) have no effect as they are not implemented by the
|
||
13 years ago
|
underlying system.
|
||
13 years ago
|
<p> <b>Warning:</b> On Windows 95/98, the style setting (other than <a href="ntqt.html#PenStyle-enum">NoPen</a>
|
||
|
and <a href="ntqt.html#PenStyle-enum">SolidLine</a>) has no effect for lines with width greater than
|
||
13 years ago
|
1.
|
||
|
<p> <p>See also <a href="#style">style</a>().
|
||
|
|
||
|
<p>Example: <a href="tutorial2-06.html#x2575">chart/chartform_canvas.cpp</a>.
|
||
|
<h3 class=fn>void <a name="setWidth"></a>TQPen::setWidth ( uint w )
|
||
|
</h3>
|
||
|
Sets the pen width to <em>w</em>.
|
||
|
<p> A line width of 0 will produce a 1 pixel wide line using a fast
|
||
|
algorithm for diagonals. A line width of 1 will also produce a 1
|
||
|
pixel wide line, but uses a slower more accurate algorithm for
|
||
|
diagonals. For horizontal and vertical lines a line width of 0 is
|
||
|
the same as a line width of 1. The cap and join style have no
|
||
|
effect on 0-width lines.
|
||
|
<p> <p>See also <a href="#width">width</a>().
|
||
|
|
||
6 months ago
|
<p>Examples: <a href="progress-example.html#x80">progress/progress.cpp</a>, and <a href="scribble-example.html#x904">scribble/scribble.h</a>.
|
||
13 years ago
|
<h3 class=fn><a href="ntqt.html#PenStyle-enum">PenStyle</a> <a name="style"></a>TQPen::style () const
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Returns the pen style.
|
||
|
<p> <p>See also <a href="#setStyle">setStyle</a>().
|
||
|
|
||
|
<h3 class=fn>uint <a name="width"></a>TQPen::width () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns the pen width.
|
||
|
<p> <p>See also <a href="#setWidth">setWidth</a>().
|
||
|
|
||
|
<p>Example: <a href="scribble-example.html#x905">scribble/scribble.h</a>.
|
||
|
<hr><h2>Related Functions</h2>
|
||
5 months ago
|
<h3 class=fn><a href="tqdatastream.html">TQDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="tqdatastream.html">TQDataStream</a> & s, const <a href="tqpen.html">TQPen</a> & p )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Writes the pen <em>p</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>.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqdatastream.html">TQDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="tqdatastream.html">TQDataStream</a> & s, <a href="tqpen.html">TQPen</a> & p )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Reads a pen from the stream <em>s</em> into <em>p</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 © 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 © 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>
|