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.
1627 lines
117 KiB
1627 lines
117 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:68 -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>TQPainter 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>TQPainter Class Reference</h1>
|
|
|
|
<p>The TQPainter class does low-level painting e.g. on widgets.
|
|
<a href="#details">More...</a>
|
|
<p><tt>#include <<a href="qpainter-h.html">ntqpainter.h</a>></tt>
|
|
<p>Inherits <a href="ntqt.html">TQt</a>.
|
|
<p>Inherited by <a href="qdirectpainter.html">TQDirectPainter</a>.
|
|
<p><a href="qpainter-members.html">List of all member functions.</a>
|
|
<h2>Public Members</h2>
|
|
<ul>
|
|
<li class=fn>enum <a href="#CoordinateMode-enum"><b>CoordinateMode</b></a> { CoordDevice, CoordPainter }</li>
|
|
<li class=fn><a href="#TQPainter"><b>TQPainter</b></a> ()</li>
|
|
<li class=fn><a href="#TQPainter-2"><b>TQPainter</b></a> ( const TQPaintDevice * pd, bool unclipped = FALSE )</li>
|
|
<li class=fn><a href="#TQPainter-3"><b>TQPainter</b></a> ( const TQPaintDevice * pd, const TQWidget * copyAttributes, bool unclipped = FALSE )</li>
|
|
<li class=fn><a href="#~TQPainter"><b>~TQPainter</b></a> ()</li>
|
|
<li class=fn>bool <a href="#begin"><b>begin</b></a> ( const TQPaintDevice * pd, bool unclipped = FALSE )</li>
|
|
<li class=fn>bool <a href="#begin-2"><b>begin</b></a> ( const TQPaintDevice * pd, const TQWidget * copyAttributes, bool unclipped = FALSE )</li>
|
|
<li class=fn>bool <a href="#end"><b>end</b></a> ()</li>
|
|
<li class=fn>TQPaintDevice * <a href="#device"><b>device</b></a> () const</li>
|
|
<li class=fn>bool <a href="#isActive"><b>isActive</b></a> () const</li>
|
|
<li class=fn>void <a href="#flush"><b>flush</b></a> ( const TQRegion & region, CoordinateMode cm = CoordDevice )</li>
|
|
<li class=fn>void <a href="#flush-2"><b>flush</b></a> ()</li>
|
|
<li class=fn>void <a href="#save"><b>save</b></a> ()</li>
|
|
<li class=fn>void <a href="#restore"><b>restore</b></a> ()</li>
|
|
<li class=fn>TQFontMetrics <a href="#fontMetrics"><b>fontMetrics</b></a> () const</li>
|
|
<li class=fn>TQFontInfo <a href="#fontInfo"><b>fontInfo</b></a> () const</li>
|
|
<li class=fn>const TQFont & <a href="#font"><b>font</b></a> () const</li>
|
|
<li class=fn>void <a href="#setFont"><b>setFont</b></a> ( const TQFont & font )</li>
|
|
<li class=fn>const TQPen & <a href="#pen"><b>pen</b></a> () const</li>
|
|
<li class=fn>void <a href="#setPen"><b>setPen</b></a> ( const TQPen & pen )</li>
|
|
<li class=fn>void <a href="#setPen-2"><b>setPen</b></a> ( PenStyle style )</li>
|
|
<li class=fn>void <a href="#setPen-3"><b>setPen</b></a> ( const TQColor & color )</li>
|
|
<li class=fn>const TQBrush & <a href="#brush"><b>brush</b></a> () const</li>
|
|
<li class=fn>void <a href="#setBrush-2"><b>setBrush</b></a> ( const TQBrush & brush )</li>
|
|
<li class=fn>void <a href="#setBrush"><b>setBrush</b></a> ( BrushStyle style )</li>
|
|
<li class=fn>void <a href="#setBrush-3"><b>setBrush</b></a> ( const TQColor & color )</li>
|
|
<li class=fn>TQPoint pos () const <em>(obsolete)</em></li>
|
|
<li class=fn>const TQColor & <a href="#backgroundColor"><b>backgroundColor</b></a> () const</li>
|
|
<li class=fn>void <a href="#setBackgroundColor"><b>setBackgroundColor</b></a> ( const TQColor & c )</li>
|
|
<li class=fn>BGMode <a href="#backgroundMode"><b>backgroundMode</b></a> () const</li>
|
|
<li class=fn>void <a href="#setBackgroundMode"><b>setBackgroundMode</b></a> ( BGMode m )</li>
|
|
<li class=fn>RasterOp <a href="#rasterOp"><b>rasterOp</b></a> () const</li>
|
|
<li class=fn>void <a href="#setRasterOp"><b>setRasterOp</b></a> ( RasterOp r )</li>
|
|
<li class=fn>const TQPoint & <a href="#brushOrigin"><b>brushOrigin</b></a> () const</li>
|
|
<li class=fn>void <a href="#setBrushOrigin"><b>setBrushOrigin</b></a> ( int x, int y )</li>
|
|
<li class=fn>void <a href="#setBrushOrigin-2"><b>setBrushOrigin</b></a> ( const TQPoint & p )</li>
|
|
<li class=fn>bool <a href="#hasViewXForm"><b>hasViewXForm</b></a> () const</li>
|
|
<li class=fn>bool <a href="#hasWorldXForm"><b>hasWorldXForm</b></a> () const</li>
|
|
<li class=fn>void <a href="#setViewXForm"><b>setViewXForm</b></a> ( bool enable )</li>
|
|
<li class=fn>TQRect <a href="#window"><b>window</b></a> () const</li>
|
|
<li class=fn>void <a href="#setWindow-2"><b>setWindow</b></a> ( const TQRect & r )</li>
|
|
<li class=fn>void <a href="#setWindow"><b>setWindow</b></a> ( int x, int y, int w, int h )</li>
|
|
<li class=fn>TQRect <a href="#viewport"><b>viewport</b></a> () const</li>
|
|
<li class=fn>void <a href="#setViewport-2"><b>setViewport</b></a> ( const TQRect & r )</li>
|
|
<li class=fn>void <a href="#setViewport"><b>setViewport</b></a> ( int x, int y, int w, int h )</li>
|
|
<li class=fn>void <a href="#setWorldXForm"><b>setWorldXForm</b></a> ( bool enable )</li>
|
|
<li class=fn>const TQWMatrix & <a href="#worldMatrix"><b>worldMatrix</b></a> () const</li>
|
|
<li class=fn>void <a href="#setWorldMatrix"><b>setWorldMatrix</b></a> ( const TQWMatrix & m, bool combine = FALSE )</li>
|
|
<li class=fn>void saveWorldMatrix () <em>(obsolete)</em></li>
|
|
<li class=fn>void restoreWorldMatrix () <em>(obsolete)</em></li>
|
|
<li class=fn>void <a href="#scale"><b>scale</b></a> ( double sx, double sy )</li>
|
|
<li class=fn>void <a href="#shear"><b>shear</b></a> ( double sh, double sv )</li>
|
|
<li class=fn>void <a href="#rotate"><b>rotate</b></a> ( double a )</li>
|
|
<li class=fn>void <a href="#translate"><b>translate</b></a> ( double dx, double dy )</li>
|
|
<li class=fn>void <a href="#resetXForm"><b>resetXForm</b></a> ()</li>
|
|
<li class=fn>TQPoint <a href="#xForm"><b>xForm</b></a> ( const TQPoint & pv ) const</li>
|
|
<li class=fn>TQRect <a href="#xForm-2"><b>xForm</b></a> ( const TQRect & rv ) const</li>
|
|
<li class=fn>TQPointArray <a href="#xForm-3"><b>xForm</b></a> ( const TQPointArray & av ) const</li>
|
|
<li class=fn>TQPointArray <a href="#xForm-4"><b>xForm</b></a> ( const TQPointArray & av, int index, int npoints ) const</li>
|
|
<li class=fn>TQPoint <a href="#xFormDev-2"><b>xFormDev</b></a> ( const TQPoint & pd ) const</li>
|
|
<li class=fn>TQRect <a href="#xFormDev"><b>xFormDev</b></a> ( const TQRect & rd ) const</li>
|
|
<li class=fn>TQPointArray <a href="#xFormDev-3"><b>xFormDev</b></a> ( const TQPointArray & ad ) const</li>
|
|
<li class=fn>TQPointArray <a href="#xFormDev-4"><b>xFormDev</b></a> ( const TQPointArray & ad, int index, int npoints ) const</li>
|
|
<li class=fn>void <a href="#setClipping"><b>setClipping</b></a> ( bool enable )</li>
|
|
<li class=fn>bool <a href="#hasClipping"><b>hasClipping</b></a> () const</li>
|
|
<li class=fn>TQRegion <a href="#clipRegion"><b>clipRegion</b></a> ( CoordinateMode m = CoordDevice ) const</li>
|
|
<li class=fn>void <a href="#setClipRect-2"><b>setClipRect</b></a> ( const TQRect & r, CoordinateMode m = CoordDevice )</li>
|
|
<li class=fn>void <a href="#setClipRect"><b>setClipRect</b></a> ( int x, int y, int w, int h, CoordinateMode m = CoordDevice )</li>
|
|
<li class=fn>void <a href="#setClipRegion"><b>setClipRegion</b></a> ( const TQRegion & rgn, CoordinateMode m = CoordDevice )</li>
|
|
<li class=fn>void <a href="#drawPoint"><b>drawPoint</b></a> ( int x, int y )</li>
|
|
<li class=fn>void <a href="#drawPoint-2"><b>drawPoint</b></a> ( const TQPoint & p )</li>
|
|
<li class=fn>void <a href="#drawPoints"><b>drawPoints</b></a> ( const TQPointArray & a, int index = 0, int npoints = -1 )</li>
|
|
<li class=fn>void moveTo ( int x, int y ) <em>(obsolete)</em></li>
|
|
<li class=fn>void moveTo ( const TQPoint & p ) <em>(obsolete)</em></li>
|
|
<li class=fn>void lineTo ( int x, int y ) <em>(obsolete)</em></li>
|
|
<li class=fn>void lineTo ( const TQPoint & p ) <em>(obsolete)</em></li>
|
|
<li class=fn>void <a href="#drawLine"><b>drawLine</b></a> ( int x1, int y1, int x2, int y2 )</li>
|
|
<li class=fn>void <a href="#drawLine-2"><b>drawLine</b></a> ( const TQPoint & p1, const TQPoint & p2 )</li>
|
|
<li class=fn>void <a href="#drawRect"><b>drawRect</b></a> ( int x, int y, int w, int h )</li>
|
|
<li class=fn>void <a href="#drawRect-2"><b>drawRect</b></a> ( const TQRect & r )</li>
|
|
<li class=fn>void <a href="#drawWinFocusRect-2"><b>drawWinFocusRect</b></a> ( int x, int y, int w, int h )</li>
|
|
<li class=fn>void <a href="#drawWinFocusRect"><b>drawWinFocusRect</b></a> ( int x, int y, int w, int h, const TQColor & bgColor )</li>
|
|
<li class=fn>void <a href="#drawWinFocusRect-3"><b>drawWinFocusRect</b></a> ( const TQRect & r )</li>
|
|
<li class=fn>void <a href="#drawWinFocusRect-4"><b>drawWinFocusRect</b></a> ( const TQRect & r, const TQColor & bgColor )</li>
|
|
<li class=fn>void <a href="#drawRoundRect"><b>drawRoundRect</b></a> ( int x, int y, int w, int h, int xRnd = 25, int yRnd = 25 )</li>
|
|
<li class=fn>void <a href="#drawRoundRect-2"><b>drawRoundRect</b></a> ( const TQRect & r, int xRnd = 25, int yRnd = 25 )</li>
|
|
<li class=fn>void <a href="#drawEllipse"><b>drawEllipse</b></a> ( int x, int y, int w, int h )</li>
|
|
<li class=fn>void <a href="#drawEllipse-2"><b>drawEllipse</b></a> ( const TQRect & r )</li>
|
|
<li class=fn>void <a href="#drawArc"><b>drawArc</b></a> ( int x, int y, int w, int h, int a, int alen )</li>
|
|
<li class=fn>void <a href="#drawArc-2"><b>drawArc</b></a> ( const TQRect & r, int a, int alen )</li>
|
|
<li class=fn>void <a href="#drawPie"><b>drawPie</b></a> ( int x, int y, int w, int h, int a, int alen )</li>
|
|
<li class=fn>void <a href="#drawPie-2"><b>drawPie</b></a> ( const TQRect & r, int a, int alen )</li>
|
|
<li class=fn>void <a href="#drawChord"><b>drawChord</b></a> ( int x, int y, int w, int h, int a, int alen )</li>
|
|
<li class=fn>void <a href="#drawChord-2"><b>drawChord</b></a> ( const TQRect & r, int a, int alen )</li>
|
|
<li class=fn>void <a href="#drawLineSegments"><b>drawLineSegments</b></a> ( const TQPointArray & a, int index = 0, int nlines = -1 )</li>
|
|
<li class=fn>void <a href="#drawPolyline"><b>drawPolyline</b></a> ( const TQPointArray & a, int index = 0, int npoints = -1 )</li>
|
|
<li class=fn>void <a href="#drawPolygon"><b>drawPolygon</b></a> ( const TQPointArray & a, bool winding = FALSE, int index = 0, int npoints = -1 )</li>
|
|
<li class=fn>void <a href="#drawConvexPolygon"><b>drawConvexPolygon</b></a> ( const TQPointArray & pa, int index = 0, int npoints = -1 )</li>
|
|
<li class=fn>void <a href="#drawCubicBezier"><b>drawCubicBezier</b></a> ( const TQPointArray & a, int index = 0 )</li>
|
|
<li class=fn>void <a href="#drawPixmap"><b>drawPixmap</b></a> ( int x, int y, const TQPixmap & pixmap, int sx = 0, int sy = 0, int sw = -1, int sh = -1 )</li>
|
|
<li class=fn>void <a href="#drawPixmap-2"><b>drawPixmap</b></a> ( const TQPoint & p, const TQPixmap & pm, const TQRect & sr )</li>
|
|
<li class=fn>void <a href="#drawPixmap-3"><b>drawPixmap</b></a> ( const TQPoint & p, const TQPixmap & pm )</li>
|
|
<li class=fn>void <a href="#drawPixmap-4"><b>drawPixmap</b></a> ( const TQRect & r, const TQPixmap & pm )</li>
|
|
<li class=fn>void <a href="#drawImage"><b>drawImage</b></a> ( int x, int y, const TQImage & image, int sx = 0, int sy = 0, int sw = -1, int sh = -1, int conversionFlags = 0 )</li>
|
|
<li class=fn>void <a href="#drawImage-2"><b>drawImage</b></a> ( const TQPoint &, const TQImage &, const TQRect & sr, int conversionFlags = 0 )</li>
|
|
<li class=fn>void <a href="#drawImage-3"><b>drawImage</b></a> ( const TQPoint & p, const TQImage & i, int conversion_flags = 0 )</li>
|
|
<li class=fn>void <a href="#drawImage-4"><b>drawImage</b></a> ( const TQRect & r, const TQImage & i )</li>
|
|
<li class=fn>void <a href="#drawTiledPixmap"><b>drawTiledPixmap</b></a> ( int x, int y, int w, int h, const TQPixmap & pixmap, int sx = 0, int sy = 0 )</li>
|
|
<li class=fn>void <a href="#drawTiledPixmap-2"><b>drawTiledPixmap</b></a> ( const TQRect & r, const TQPixmap & pm, const TQPoint & sp )</li>
|
|
<li class=fn>void <a href="#drawTiledPixmap-3"><b>drawTiledPixmap</b></a> ( const TQRect & r, const TQPixmap & pm )</li>
|
|
<li class=fn>void drawPicture ( const TQPicture & pic ) <em>(obsolete)</em></li>
|
|
<li class=fn>void <a href="#drawPicture"><b>drawPicture</b></a> ( int x, int y, const TQPicture & pic )</li>
|
|
<li class=fn>void <a href="#drawPicture-3"><b>drawPicture</b></a> ( const TQPoint & p, const TQPicture & pic )</li>
|
|
<li class=fn>void <a href="#fillRect"><b>fillRect</b></a> ( int x, int y, int w, int h, const TQBrush & brush )</li>
|
|
<li class=fn>void <a href="#fillRect-2"><b>fillRect</b></a> ( const TQRect & r, const TQBrush & brush )</li>
|
|
<li class=fn>void <a href="#eraseRect"><b>eraseRect</b></a> ( int x, int y, int w, int h )</li>
|
|
<li class=fn>void <a href="#eraseRect-2"><b>eraseRect</b></a> ( const TQRect & r )</li>
|
|
<li class=fn>enum <a href="#TextDirection-enum"><b>TextDirection</b></a> { Auto, RTL, LTR }</li>
|
|
<li class=fn>void <a href="#drawText-2"><b>drawText</b></a> ( int x, int y, const TQString &, int len = -1, TextDirection dir = Auto )</li>
|
|
<li class=fn>void <a href="#drawText-3"><b>drawText</b></a> ( const TQPoint &, const TQString &, int len = -1, TextDirection dir = Auto )</li>
|
|
<li class=fn>void <a href="#drawText-4"><b>drawText</b></a> ( int x, int y, const TQString &, int pos, int len, TextDirection dir = Auto )</li>
|
|
<li class=fn>void <a href="#drawText"><b>drawText</b></a> ( const TQPoint & p, const TQString &, int pos, int len, TextDirection dir = Auto )</li>
|
|
<li class=fn>void <a href="#drawText-5"><b>drawText</b></a> ( int x, int y, int w, int h, int flags, const TQString &, int len = -1, TQRect * br = 0, TQTextParag ** internal = 0 )</li>
|
|
<li class=fn>void <a href="#drawText-6"><b>drawText</b></a> ( const TQRect & r, int tf, const TQString & str, int len = -1, TQRect * brect = 0, TQTextParag ** internal = 0 )</li>
|
|
<li class=fn>TQRect <a href="#boundingRect"><b>boundingRect</b></a> ( int x, int y, int w, int h, int flags, const TQString &, int len = -1, TQTextParag ** intern = 0 )</li>
|
|
<li class=fn>TQRect <a href="#boundingRect-2"><b>boundingRect</b></a> ( const TQRect & r, int flags, const TQString & str, int len = -1, TQTextParag ** internal = 0 )</li>
|
|
<li class=fn>int <a href="#tabStops"><b>tabStops</b></a> () const</li>
|
|
<li class=fn>void <a href="#setTabStops"><b>setTabStops</b></a> ( int ts )</li>
|
|
<li class=fn>int * <a href="#tabArray"><b>tabArray</b></a> () const</li>
|
|
<li class=fn>void <a href="#setTabArray"><b>setTabArray</b></a> ( int * ta )</li>
|
|
<li class=fn>HDC <a href="#handle"><b>handle</b></a> () const</li>
|
|
</ul>
|
|
<h2>Static Public Members</h2>
|
|
<ul>
|
|
<li class=fn>void <a href="#redirect"><b>redirect</b></a> ( TQPaintDevice * pdev, TQPaintDevice * replacement )</li>
|
|
</ul>
|
|
<h2>Related Functions</h2>
|
|
<ul>
|
|
<li class=fn>void <a href="#qDrawShadeLine"><b>qDrawShadeLine</b></a> ( TQPainter * p, int x1, int y1, int x2, int y2, const TQColorGroup & g, bool sunken, int lineWidth, int midLineWidth )</li>
|
|
<li class=fn>void <a href="#qDrawShadeRect"><b>qDrawShadeRect</b></a> ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, bool sunken, int lineWidth, int midLineWidth, const TQBrush * fill )</li>
|
|
<li class=fn>void <a href="#qDrawShadePanel"><b>qDrawShadePanel</b></a> ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, bool sunken, int lineWidth, const TQBrush * fill )</li>
|
|
<li class=fn>void <a href="#qDrawWinButton"><b>qDrawWinButton</b></a> ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, bool sunken, const TQBrush * fill )</li>
|
|
<li class=fn>void <a href="#qDrawWinPanel"><b>qDrawWinPanel</b></a> ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, bool sunken, const TQBrush * fill )</li>
|
|
<li class=fn>void <a href="#qDrawPlainRect"><b>qDrawPlainRect</b></a> ( TQPainter * p, int x, int y, int w, int h, const TQColor & c, int lineWidth, const TQBrush * fill )</li>
|
|
</ul>
|
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
|
|
|
|
|
The TQPainter class does low-level painting e.g. on widgets.
|
|
<p>
|
|
|
|
|
|
<p> The painter provides highly optimized functions to do most of the
|
|
drawing GUI programs require. TQPainter can draw everything from
|
|
simple lines to complex shapes like pies and chords. It can also
|
|
draw aligned text and pixmaps. Normally, it draws in a "natural"
|
|
coordinate system, but it can also do view and world
|
|
transformation.
|
|
<p> The typical use of a painter is:
|
|
<p> <ul>
|
|
<li> Construct a painter.
|
|
<li> Set a pen, a brush etc.
|
|
<li> Draw.
|
|
<li> Destroy the painter.
|
|
</ul>
|
|
<p> Mostly, all this is done inside a paint event. (In fact, 99% of
|
|
all TQPainter use is in a reimplementation of
|
|
<a href="tqwidget.html#paintEvent">TQWidget::paintEvent</a>(), and the painter is heavily optimized for
|
|
such use.) Here's one very simple example:
|
|
<p> <pre>
|
|
void SimpleExampleWidget::paintEvent()
|
|
{
|
|
TQPainter paint( this );
|
|
paint.<a href="#setPen">setPen</a>( TQt::blue );
|
|
paint.<a href="#drawText">drawText</a>( rect(), AlignCenter, "The Text" );
|
|
}
|
|
</pre>
|
|
|
|
<p> Usage is simple, and there are many settings you can use:
|
|
<p> <ul>
|
|
<p> <li> <a href="#font">font</a>() is the currently set font. If you set a font that isn't
|
|
available, TQt finds a close match. In fact font() returns what
|
|
you set using <a href="#setFont">setFont</a>() and <a href="#fontInfo">fontInfo</a>() returns the font actually
|
|
being used (which may be the same).
|
|
<p> <li> <a href="#brush">brush</a>() is the currently set brush; the color or pattern that's
|
|
used for filling e.g. circles.
|
|
<p> <li> <a href="#pen">pen</a>() is the currently set pen; the color or stipple that's
|
|
used for drawing lines or boundaries.
|
|
<p> <li> <a href="#backgroundMode">backgroundMode</a>() is <tt>Opaque</tt> or <tt>Transparent</tt>, i.e. whether
|
|
<a href="#backgroundColor">backgroundColor</a>() is used or not.
|
|
<p> <li> backgroundColor() only applies when backgroundMode() is Opaque
|
|
and pen() is a stipple. In that case, it describes the color of
|
|
the background pixels in the stipple.
|
|
<p> <li> <a href="#rasterOp">rasterOp</a>() is how pixels drawn interact with the pixels already
|
|
there.
|
|
<p> <li> <a href="#brushOrigin">brushOrigin</a>() is the origin of the tiled brushes, normally the
|
|
origin of the window.
|
|
<p> <li> <a href="#viewport">viewport</a>(), <a href="#window">window</a>(), <a href="#worldMatrix">worldMatrix</a>() and many more make up the
|
|
painter's coordinate transformation system. See <a href="coordsys.html">The Coordinate System</a> for an explanation of
|
|
this, or see below for a very brief overview of the functions.
|
|
<p> <li> <a href="#hasClipping">hasClipping</a>() is whether the painter clips at all. (The paint
|
|
device clips, too.) If the painter clips, it clips to <a href="#clipRegion">clipRegion</a>().
|
|
<p> <li> <a href="#pos">pos</a>() is the current position, set by <a href="#moveTo">moveTo</a>() and used by
|
|
<a href="#lineTo">lineTo</a>().
|
|
<p> </ul>
|
|
<p> Note that some of these settings mirror settings in some paint
|
|
devices, e.g. <a href="tqwidget.html#font">TQWidget::font</a>(). <a href="#begin">TQPainter::begin</a>() (or the TQPainter
|
|
constructor) copies these attributes from the paint device.
|
|
Calling, for example, <a href="tqwidget.html#setFont">TQWidget::setFont</a>() doesn't take effect until
|
|
the next time a painter begins painting on it.
|
|
<p> <a href="#save">save</a>() saves all of these settings on an internal stack, <a href="#restore">restore</a>()
|
|
pops them back.
|
|
<p> The core functionality of TQPainter is drawing, and there are
|
|
functions to draw most primitives: <a href="#drawPoint">drawPoint</a>(), <a href="#drawPoints">drawPoints</a>(),
|
|
<a href="#drawLine">drawLine</a>(), <a href="#drawRect">drawRect</a>(), <a href="#drawWinFocusRect">drawWinFocusRect</a>(), <a href="#drawRoundRect">drawRoundRect</a>(),
|
|
<a href="#drawEllipse">drawEllipse</a>(), <a href="#drawArc">drawArc</a>(), <a href="#drawPie">drawPie</a>(), <a href="#drawChord">drawChord</a>(),
|
|
<a href="#drawLineSegments">drawLineSegments</a>(), <a href="#drawPolyline">drawPolyline</a>(), <a href="#drawPolygon">drawPolygon</a>(),
|
|
<a href="#drawConvexPolygon">drawConvexPolygon</a>() and <a href="#drawCubicBezier">drawCubicBezier</a>(). All of these functions
|
|
take integer coordinates; there are no floating-point versions
|
|
since we want drawing to be as fast as possible.
|
|
<p> There are functions to draw pixmaps/images, namely <a href="#drawPixmap">drawPixmap</a>(),
|
|
<a href="#drawImage">drawImage</a>() and <a href="#drawTiledPixmap">drawTiledPixmap</a>(). drawPixmap() and drawImage()
|
|
produce the same result, except that drawPixmap() is faster
|
|
on-screen and drawImage() faster and sometimes better on <a href="ntqprinter.html">TQPrinter</a>
|
|
and <a href="ntqpicture.html">TQPicture</a>.
|
|
<p> Text drawing is done using <a href="#drawText">drawText</a>(), and when you need
|
|
fine-grained positioning, <a href="#boundingRect">boundingRect</a>() tells you where a given
|
|
drawText() command would draw.
|
|
<p> There is a <a href="#drawPicture">drawPicture</a>() function that draws the contents of an
|
|
entire TQPicture using this painter. drawPicture() is the only
|
|
function that disregards all the painter's settings: the TQPicture
|
|
has its own settings.
|
|
<p> Normally, the TQPainter operates on the device's own coordinate
|
|
system (usually pixels), but TQPainter has good support for
|
|
coordinate transformation. See <a href="coordsys.html">The Coordinate
|
|
System</a> for a more general overview and a simple example.
|
|
<p> The most common functions used are <a href="#scale">scale</a>(), <a href="#rotate">rotate</a>(), <a href="#translate">translate</a>()
|
|
and <a href="#shear">shear</a>(), all of which operate on the <a href="#worldMatrix">worldMatrix</a>().
|
|
<a href="#setWorldMatrix">setWorldMatrix</a>() can replace or add to the currently set
|
|
worldMatrix().
|
|
<p> <a href="#setViewport">setViewport</a>() sets the rectangle on which TQPainter operates. The
|
|
default is the entire device, which is usually fine, except on
|
|
printers. <a href="#setWindow">setWindow</a>() sets the coordinate system, that is, the
|
|
rectangle that maps to <a href="#viewport">viewport</a>(). What's drawn inside the
|
|
<a href="#window">window</a>() ends up being inside the viewport(). The window's
|
|
default is the same as the viewport, and if you don't use the
|
|
transformations, they are optimized away, gaining another little
|
|
bit of speed.
|
|
<p> After all the coordinate transformation is done, TQPainter can clip
|
|
the drawing to an arbitrary rectangle or region. <a href="#hasClipping">hasClipping</a>() is
|
|
TRUE if TQPainter clips, and <a href="#clipRegion">clipRegion</a>() returns the clip region.
|
|
You can set it using either <a href="#setClipRegion">setClipRegion</a>() or <a href="#setClipRect">setClipRect</a>().
|
|
Note that the clipping can be slow. It's all system-dependent,
|
|
but as a rule of thumb, you can assume that drawing speed is
|
|
inversely proportional to the number of rectangles in the clip
|
|
region.
|
|
<p> After TQPainter's clipping, the paint device may also clip. For
|
|
example, most widgets clip away the pixels used by child widgets,
|
|
and most printers clip away an area near the edges of the paper.
|
|
This additional clipping is not reflected by the return value of
|
|
clipRegion() or hasClipping().
|
|
<p> TQPainter also includes some less-used functions that are very
|
|
useful on those occasions when they're needed.
|
|
<p> <a href="#isActive">isActive</a>() indicates whether the painter is active. <a href="#begin">begin</a>() (and
|
|
the most usual constructor) makes it active. <a href="#end">end</a>() (and the
|
|
destructor) deactivates it. If the painter is active, <a href="#device">device</a>()
|
|
returns the paint device on which the painter paints.
|
|
<p> Sometimes it is desirable to make someone else paint on an unusual
|
|
<a href="ntqpaintdevice.html">TQPaintDevice</a>. TQPainter supports a static function to do this,
|
|
<a href="#redirect">redirect</a>(). We recommend not using it, but for some hacks it's
|
|
perfect.
|
|
<p> <a href="#setTabStops">setTabStops</a>() and <a href="#setTabArray">setTabArray</a>() can change where the tab stops
|
|
are, but these are very seldomly used.
|
|
<p> <b>Warning:</b> Note that TQPainter does not attempt to work around
|
|
coordinate limitations in the underlying window system. Some
|
|
platforms may behave incorrectly with coordinates as small as
|
|
+/-4000.
|
|
|
|
<p> <p>See also <a href="ntqpaintdevice.html">TQPaintDevice</a>, <a href="tqwidget.html">TQWidget</a>, <a href="ntqpixmap.html">TQPixmap</a>, <a href="ntqprinter.html">TQPrinter</a>, <a href="ntqpicture.html">TQPicture</a>, <a href="simple-application.html">Application Walkthrough</a>, <a href="coordsys.html">Coordinate System Overview</a>, <a href="graphics.html">Graphics Classes</a>, and <a href="images.html">Image Processing Classes</a>.
|
|
|
|
<hr><h2>Member Type Documentation</h2>
|
|
<h3 class=fn><a name="CoordinateMode-enum"></a>TQPainter::CoordinateMode</h3>
|
|
|
|
<ul>
|
|
<li><tt>TQPainter::CoordDevice</tt>
|
|
<li><tt>TQPainter::CoordPainter</tt>
|
|
</ul><p> <p>See also <a href="#clipRegion">clipRegion</a>().
|
|
|
|
<h3 class=fn><a name="TextDirection-enum"></a>TQPainter::TextDirection</h3>
|
|
|
|
<ul>
|
|
<li><tt>TQPainter::Auto</tt>
|
|
<li><tt>TQPainter::RTL</tt> - right to left
|
|
<li><tt>TQPainter::LTR</tt> - left to right
|
|
</ul><p> <p>See also <a href="#drawText">drawText</a>().
|
|
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<h3 class=fn><a name="TQPainter"></a>TQPainter::TQPainter ()
|
|
</h3>
|
|
Constructs a painter.
|
|
<p> Notice that all painter settings (setPen, setBrush etc.) are reset
|
|
to default values when <a href="#begin">begin</a>() is called.
|
|
<p> <p>See also <a href="#begin">begin</a>() and <a href="#end">end</a>().
|
|
|
|
<h3 class=fn><a name="TQPainter-2"></a>TQPainter::TQPainter ( const <a href="ntqpaintdevice.html">TQPaintDevice</a> * pd, bool unclipped = FALSE )
|
|
</h3>
|
|
Constructs a painter that begins painting the paint device <em>pd</em>
|
|
immediately. Depending on the underlying graphic system the
|
|
painter will paint over children of the paintdevice if <em>unclipped</em> is TRUE.
|
|
<p> This constructor is convenient for short-lived painters, e.g. in a
|
|
<a href="tqwidget.html#paintEvent">paint event</a> and should be used
|
|
only once. The constructor calls <a href="#begin">begin</a>() for you and the TQPainter
|
|
destructor automatically calls <a href="#end">end</a>().
|
|
<p> Here's an example using begin() and end():
|
|
<pre>
|
|
void MyWidget::paintEvent( <a href="qpaintevent.html">TQPaintEvent</a> * )
|
|
{
|
|
TQPainter p;
|
|
p.<a href="#begin">begin</a>( this );
|
|
p.<a href="#drawLine">drawLine</a>( ... ); // drawing code
|
|
p.<a href="#end">end</a>();
|
|
}
|
|
</pre>
|
|
|
|
<p> The same example using this constructor:
|
|
<pre>
|
|
void MyWidget::paintEvent( <a href="qpaintevent.html">TQPaintEvent</a> * )
|
|
{
|
|
TQPainter p( this );
|
|
p.<a href="#drawLine">drawLine</a>( ... ); // drawing code
|
|
}
|
|
</pre>
|
|
|
|
<p> Since the constructor cannot provide feedback when the initialization
|
|
of the painter failed you should rather use begin() and end() to paint
|
|
on external devices, e.g. printers.
|
|
<p> <p>See also <a href="#begin">begin</a>() and <a href="#end">end</a>().
|
|
|
|
<h3 class=fn><a name="TQPainter-3"></a>TQPainter::TQPainter ( const <a href="ntqpaintdevice.html">TQPaintDevice</a> * pd, const <a href="tqwidget.html">TQWidget</a> * copyAttributes, bool unclipped = FALSE )
|
|
</h3>
|
|
Constructs a painter that begins painting the paint device <em>pd</em>
|
|
immediately, with the default arguments taken from <em>copyAttributes</em>. The painter will paint over children of the paint
|
|
device if <em>unclipped</em> is TRUE (although this is not supported on
|
|
all platforms).
|
|
<p> <p>See also <a href="#begin">begin</a>().
|
|
|
|
<h3 class=fn><a name="~TQPainter"></a>TQPainter::~TQPainter ()
|
|
</h3>
|
|
Destroys the painter.
|
|
|
|
<h3 class=fn>const <a href="ntqcolor.html">TQColor</a> & <a name="backgroundColor"></a>TQPainter::backgroundColor () const
|
|
</h3>
|
|
|
|
<p> Returns the current background color.
|
|
<p> <p>See also <a href="#setBackgroundColor">setBackgroundColor</a>() and <a href="ntqcolor.html">TQColor</a>.
|
|
|
|
<h3 class=fn><a href="ntqt.html#BGMode-enum">BGMode</a> <a name="backgroundMode"></a>TQPainter::backgroundMode () const
|
|
</h3>
|
|
|
|
<p> Returns the current background mode.
|
|
<p> <p>See also <a href="#setBackgroundMode">setBackgroundMode</a>() and <a href="ntqt.html#BGMode-enum">BGMode</a>.
|
|
|
|
<h3 class=fn>bool <a name="begin"></a>TQPainter::begin ( const <a href="ntqpaintdevice.html">TQPaintDevice</a> * pd, bool unclipped = FALSE )
|
|
</h3>
|
|
Begins painting the paint device <em>pd</em> and returns TRUE if
|
|
successful; otherwise returns FALSE. If <em>unclipped</em> is TRUE, the
|
|
painting will not be clipped at the paint device's boundaries,
|
|
(although this is not supported by all platforms).
|
|
<p> The errors that can occur are serious problems, such as these:
|
|
<p> <pre>
|
|
p->begin( 0 ); // impossible - paint device cannot be 0
|
|
|
|
<a href="ntqpixmap.html">TQPixmap</a> pm( 0, 0 );
|
|
p->begin( pm ); // impossible - pm.<a href="ntqpixmap.html#isNull">isNull</a>();
|
|
|
|
p->begin( myWidget );
|
|
p2->begin( myWidget ); // impossible - only one painter at a time
|
|
</pre>
|
|
|
|
<p> Note that most of the time, you can use one of the constructors
|
|
instead of <a href="#begin">begin</a>(), and that <a href="#end">end</a>() is automatically done at
|
|
destruction.
|
|
<p> <b>Warning:</b> A paint device can only be painted by one painter at a
|
|
time.
|
|
<p> <p>See also <a href="#end">end</a>() and <a href="#flush">flush</a>().
|
|
|
|
<p>Examples: <a href="aclock-example.html#x1183">aclock/aclock.cpp</a>, <a href="desktop-example.html#x1733">desktop/desktop.cpp</a>, <a href="drawdemo-example.html#x1067">drawdemo/drawdemo.cpp</a>, <a href="hello-example.html#x1633">hello/hello.cpp</a>, <a href="picture-example.html#x111">picture/picture.cpp</a>, <a href="tutorial1-10.html#x2348">t10/cannon.cpp</a>, and <a href="xform-example.html#x1233">xform/xform.cpp</a>.
|
|
<h3 class=fn>bool <a name="begin-2"></a>TQPainter::begin ( const <a href="ntqpaintdevice.html">TQPaintDevice</a> * pd, const <a href="tqwidget.html">TQWidget</a> * copyAttributes, bool unclipped = FALSE )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> This version opens the painter on a paint device <em>pd</em> and sets
|
|
the initial pen, background color and font from <em>copyAttributes</em>,
|
|
painting over the paint device's children when <em>unclipped</em> is
|
|
TRUE. This is equivalent to:
|
|
<p> <pre>
|
|
TQPainter p;
|
|
p.<a href="#begin">begin</a>( pd );
|
|
p.<a href="#setPen">setPen</a>( copyAttributes->foregroundColor() );
|
|
p.<a href="#setBackgroundColor">setBackgroundColor</a>( copyAttributes->backgroundColor() );
|
|
p.<a href="#setFont">setFont</a>( copyAttributes->font() );
|
|
</pre>
|
|
|
|
<p> This begin function is convenient for double buffering. When you
|
|
draw in a pixmap instead of directly in a widget (to later bitBlt
|
|
the pixmap into the widget) you will need to set the widget's
|
|
font etc. This function does exactly that.
|
|
<p> Example:
|
|
<pre>
|
|
void MyWidget::paintEvent( <a href="qpaintevent.html">TQPaintEvent</a> * )
|
|
{
|
|
<a href="ntqpixmap.html">TQPixmap</a> pm(size());
|
|
TQPainter p;
|
|
p.<a href="#begin">begin</a>(&pm, this);
|
|
// ... potentially flickering paint operation ...
|
|
p.<a href="#end">end</a>();
|
|
<a href="tqimage.html#bitBlt">bitBlt</a>(this, 0, 0, &pm);
|
|
}
|
|
</pre>
|
|
|
|
<p> <p>See also <a href="#end">end</a>().
|
|
|
|
<h3 class=fn><a href="ntqrect.html">TQRect</a> <a name="boundingRect"></a>TQPainter::boundingRect ( int x, int y, int w, int h, int flags, const <a href="ntqstring.html">TQString</a> &, int len = -1, TQTextParag ** intern = 0 )
|
|
</h3>
|
|
|
|
<p> Returns the bounding rectangle of the aligned text that would be
|
|
printed with the corresponding <a href="#drawText">drawText</a>() function using the first
|
|
<em>len</em> characters of the string if <em>len</em> is > -1, or the whole of
|
|
the string if <em>len</em> is -1. The drawing, and hence the bounding
|
|
rectangle, is constrained to the rectangle that begins at point <em>(x, y)</em> with width <em>w</em> and hight <em>h</em>, or to the
|
|
rectangle required to draw the text, whichever is the larger.
|
|
<p> The <em>flags</em> argument is
|
|
the bitwise OR of the following flags:
|
|
<center><table cellpadding="4" cellspacing="2" border="0">
|
|
<tr bgcolor="#a2c511"> <th valign="top">Flag <th valign="top">Meaning
|
|
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="ntqt.html#AlignmentFlags-enum">AlignAuto</a> <td valign="top">aligns according to the language, usually left.
|
|
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="ntqt.html#AlignmentFlags-enum">AlignLeft</a> <td valign="top">aligns to the left border.
|
|
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="ntqt.html#AlignmentFlags-enum">AlignRight</a> <td valign="top">aligns to the right border.
|
|
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="ntqt.html#AlignmentFlags-enum">AlignHCenter</a> <td valign="top">aligns horizontally centered.
|
|
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="ntqt.html#AlignmentFlags-enum">AlignTop</a> <td valign="top">aligns to the top border.
|
|
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="ntqt.html#AlignmentFlags-enum">AlignBottom</a> <td valign="top">aligns to the bottom border.
|
|
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="ntqt.html#AlignmentFlags-enum">AlignVCenter</a> <td valign="top">aligns vertically centered.
|
|
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="ntqt.html#AlignmentFlags-enum">AlignCenter</a> <td valign="top">(== <a href="ntqt.html#AlignmentFlags-enum">AlignHCenter</a> | <a href="ntqt.html#AlignmentFlags-enum">AlignVCenter</a>).
|
|
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="ntqt.html#TextFlags-enum">SingleLine</a> <td valign="top">ignores newline characters in the text.
|
|
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="ntqt.html#TextFlags-enum">ExpandTabs</a> <td valign="top">expands tabs.
|
|
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="ntqt.html#TextFlags-enum">ShowPrefix</a> <td valign="top">interprets "&x" as "<u>x</u>".
|
|
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="ntqt.html#TextFlags-enum">WordBreak</a> <td valign="top">breaks the text to fit the rectangle.
|
|
</table></center>
|
|
<p> Horizontal alignment defaults to <a href="ntqt.html#AlignmentFlags-enum">AlignLeft</a> and vertical
|
|
alignment defaults to <a href="ntqt.html#AlignmentFlags-enum">AlignTop</a>.
|
|
<p> If several of the horizontal or several of the vertical alignment flags
|
|
are set, the resulting alignment is undefined.
|
|
<p> The <em>intern</em> parameter should not be used.
|
|
<p> <p>See also <a href="ntqt.html#TextFlags-enum">TQt::TextFlags</a>.
|
|
|
|
<h3 class=fn><a href="ntqrect.html">TQRect</a> <a name="boundingRect-2"></a>TQPainter::boundingRect ( const <a href="ntqrect.html">TQRect</a> & r, int flags, const <a href="ntqstring.html">TQString</a> & str, int len = -1, TQTextParag ** internal = 0 )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Returns the bounding rectangle of the aligned text that would be
|
|
printed with the corresponding <a href="#drawText">drawText</a>() function using the first
|
|
<em>len</em> characters from <em>str</em> if <em>len</em> is > -1, or the whole of
|
|
<em>str</em> if <em>len</em> is -1. The drawing, and hence the bounding
|
|
rectangle, is constrained to the rectangle <em>r</em>, or to the
|
|
rectangle required to draw the text, whichever is the larger.
|
|
<p> The <em>internal</em> parameter should not be used.
|
|
<p> <p>See also <a href="#drawText">drawText</a>(), <a href="#fontMetrics">fontMetrics</a>(), <a href="ntqfontmetrics.html#boundingRect">TQFontMetrics::boundingRect</a>(), and <a href="ntqt.html#TextFlags-enum">TQt::TextFlags</a>.
|
|
|
|
<h3 class=fn>const <a href="ntqbrush.html">TQBrush</a> & <a name="brush"></a>TQPainter::brush () const
|
|
</h3>
|
|
|
|
<p> Returns the painter's current brush.
|
|
<p> <p>See also <a href="#setBrush">TQPainter::setBrush</a>().
|
|
|
|
<p>Examples: <a href="themes-example.html#x283">themes/metal.cpp</a> and <a href="themes-example.html#x212">themes/wood.cpp</a>.
|
|
<h3 class=fn>const <a href="ntqpoint.html">TQPoint</a> & <a name="brushOrigin"></a>TQPainter::brushOrigin () const
|
|
</h3>
|
|
|
|
<p> Returns the brush origin currently set.
|
|
<p> <p>See also <a href="#setBrushOrigin">setBrushOrigin</a>().
|
|
|
|
<h3 class=fn><a href="ntqregion.html">TQRegion</a> <a name="clipRegion"></a>TQPainter::clipRegion ( <a href="ntqpainter.html#CoordinateMode-enum">CoordinateMode</a> m = CoordDevice ) const
|
|
</h3>
|
|
Returns the currently set clip region. Note that the clip region
|
|
is given in physical device coordinates and <em>not</em> subject to any
|
|
<a href="coordsys.html">coordinate transformation</a> if <em>m</em> is
|
|
equal to <a href="#CoordinateMode-enum">CoordDevice</a> (the default). If <em>m</em> equals <a href="#CoordinateMode-enum">CoordPainter</a> the returned region is in model coordinates.
|
|
<p> <p>See also <a href="#setClipRegion">setClipRegion</a>(), <a href="#setClipRect">setClipRect</a>(), <a href="#setClipping">setClipping</a>(), and <a href="#CoordinateMode-enum">TQPainter::CoordinateMode</a>.
|
|
|
|
<p>Example: <a href="themes-example.html#x213">themes/wood.cpp</a>.
|
|
<h3 class=fn><a href="ntqpaintdevice.html">TQPaintDevice</a> * <a name="device"></a>TQPainter::device () const
|
|
</h3>
|
|
|
|
<p> Returns the paint device on which this painter is currently
|
|
painting, or 0 if the painter is not active.
|
|
<p> <p>See also <a href="ntqpaintdevice.html#paintingActive">TQPaintDevice::paintingActive</a>().
|
|
|
|
<p>Examples: <a href="qaction-application-example.html#x1145">action/application.cpp</a>, <a href="simple-application-example.html#x1563">application/application.cpp</a>, <a href="helpviewer-example.html#x999">helpviewer/helpwindow.cpp</a>, <a href="listboxcombo-example.html#x1413">listboxcombo/listboxcombo.cpp</a>, and <a href="mdi-example.html#x2044">mdi/application.cpp</a>.
|
|
<h3 class=fn>void <a name="drawArc"></a>TQPainter::drawArc ( int x, int y, int w, int h, int a, int alen )
|
|
</h3>
|
|
Draws an arc defined by the rectangle <em>(x, y, w, h)</em>, the start
|
|
angle <em>a</em> and the arc length <em>alen</em>.
|
|
<p> The angles <em>a</em> and <em>alen</em> are 1/16th of a degree, i.e. a full
|
|
circle equals 5760 (16*360). Positive values of <em>a</em> and <em>alen</em>
|
|
mean counter-clockwise while negative values mean the clockwise
|
|
direction. Zero degrees is at the 3 o'clock position.
|
|
<p> Example:
|
|
<pre>
|
|
TQPainter p( myWidget );
|
|
p.<a href="#drawArc">drawArc</a>( 10,10, 70,100, 100*16, 160*16 ); // draws a "(" arc
|
|
</pre>
|
|
|
|
<p> <p>See also <a href="#drawPie">drawPie</a>() and <a href="#drawChord">drawChord</a>().
|
|
|
|
<h3 class=fn>void <a name="drawArc-2"></a>TQPainter::drawArc ( const <a href="ntqrect.html">TQRect</a> & r, int a, int alen )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws the arc that fits inside the rectangle <em>r</em> with start angle
|
|
<em>a</em> and arc length <em>alen</em>.
|
|
|
|
<h3 class=fn>void <a name="drawChord"></a>TQPainter::drawChord ( int x, int y, int w, int h, int a, int alen )
|
|
</h3>
|
|
Draws a chord defined by the rectangle <em>(x, y, w, h)</em>, the start
|
|
angle <em>a</em> and the arc length <em>alen</em>.
|
|
<p> The chord is filled with the current <a href="#brush">brush</a>().
|
|
<p> The angles <em>a</em> and <em>alen</em> are 1/16th of a degree, i.e. a full
|
|
circle equals 5760 (16*360). Positive values of <em>a</em> and <em>alen</em>
|
|
mean counter-clockwise while negative values mean the clockwise
|
|
direction. Zero degrees is at the 3 o'clock position.
|
|
<p> <p>See also <a href="#drawArc">drawArc</a>() and <a href="#drawPie">drawPie</a>().
|
|
|
|
<h3 class=fn>void <a name="drawChord-2"></a>TQPainter::drawChord ( const <a href="ntqrect.html">TQRect</a> & r, int a, int alen )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws a chord that fits inside the rectangle <em>r</em> with start angle
|
|
<em>a</em> and arc length <em>alen</em>.
|
|
|
|
<h3 class=fn>void <a name="drawConvexPolygon"></a>TQPainter::drawConvexPolygon ( const <a href="ntqpointarray.html">TQPointArray</a> & pa, int index = 0, int npoints = -1 )
|
|
</h3>
|
|
Draws the convex polygon defined by the <em>npoints</em> points in <em>pa</em>
|
|
starting at <em>pa[index]</em> (<em>index</em> defaults to 0).
|
|
<p> If the supplied polygon is not convex, the results are undefined.
|
|
<p> On some platforms (e.g. X Window), this is faster than
|
|
<a href="#drawPolygon">drawPolygon</a>().
|
|
<p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
|
|
values are truncated. This limitation is expected to go away in
|
|
TQt 4.
|
|
|
|
<p>Example: <a href="coordsys.html#x2271">aclock/aclock.cpp</a>.
|
|
<h3 class=fn>void <a name="drawCubicBezier"></a>TQPainter::drawCubicBezier ( const <a href="ntqpointarray.html">TQPointArray</a> & a, int index = 0 )
|
|
</h3>
|
|
Draws a cubic Bezier curve defined by the control points in <em>a</em>,
|
|
starting at <em>a[index]</em> (<em>index</em> defaults to 0).
|
|
<p> Control points after <em>a[index + 3]</em> are ignored. Nothing happens
|
|
if there aren't enough control points.
|
|
<p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
|
|
values are truncated. This limitation is expected to go away in
|
|
TQt 4.
|
|
|
|
<h3 class=fn>void <a name="drawEllipse"></a>TQPainter::drawEllipse ( int x, int y, int w, int h )
|
|
</h3>
|
|
Draws an ellipse with center at <em>(x + w/2, y + h/2)</em> and size <em>(w, h)</em>.
|
|
|
|
<p>Examples: <a href="drawdemo-example.html#x1068">drawdemo/drawdemo.cpp</a>, <a href="qaxserver-example-multiple.html#x2545">multiple/ax2.h</a>, <a href="picture-example.html#x112">picture/picture.cpp</a>, and <a href="tictac-example.html#x28">tictac/tictac.cpp</a>.
|
|
<h3 class=fn>void <a name="drawEllipse-2"></a>TQPainter::drawEllipse ( const <a href="ntqrect.html">TQRect</a> & r )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws the ellipse that fits inside rectangle <em>r</em>.
|
|
|
|
<h3 class=fn>void <a name="drawImage"></a>TQPainter::drawImage ( int x, int y, const <a href="tqimage.html">TQImage</a> & image, int sx = 0, int sy = 0, int sw = -1, int sh = -1, int conversionFlags = 0 )
|
|
</h3>
|
|
Draws at (<em>x</em>, <em>y</em>) the <em>sw</em> by <em>sh</em> area of pixels from (<em>sx</em>, <em>sy</em>) in <em>image</em>, using <em>conversionFlags</em> if the image
|
|
needs to be converted to a pixmap. The default value for <em>conversionFlags</em> is 0; see convertFromImage() for information about
|
|
what other values do.
|
|
<p> This function may convert <em>image</em> to a pixmap and then draw it,
|
|
if <a href="#device">device</a>() is a <a href="ntqpixmap.html">TQPixmap</a> or a <a href="tqwidget.html">TQWidget</a>, or else draw it directly,
|
|
if device() is a <a href="ntqprinter.html">TQPrinter</a> or <a href="ntqpicture.html">TQPicture</a>.
|
|
<p> Currently alpha masks of the image are ignored when painting on a TQPrinter.
|
|
<p> <p>See also <a href="#drawPixmap">drawPixmap</a>() and <a href="ntqpixmap.html#convertFromImage">TQPixmap::convertFromImage</a>().
|
|
|
|
<p>Example: <a href="canvas-example.html#x2941">canvas/canvas.cpp</a>.
|
|
<h3 class=fn>void <a name="drawImage-2"></a>TQPainter::drawImage ( const <a href="ntqpoint.html">TQPoint</a> &, const <a href="tqimage.html">TQImage</a> &, const <a href="ntqrect.html">TQRect</a> & sr, int conversionFlags = 0 )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws the rectangle <em>sr</em> from the image at the given point.
|
|
|
|
<h3 class=fn>void <a name="drawImage-3"></a>TQPainter::drawImage ( const <a href="ntqpoint.html">TQPoint</a> & p, const <a href="tqimage.html">TQImage</a> & i, int conversion_flags = 0 )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws the image <em>i</em> at point <em>p</em>.
|
|
<p> If the image needs to be modified to fit in a lower-resolution
|
|
result (e.g. converting from 32-bit to 8-bit), use the <em>conversion_flags</em> to specify how you'd prefer this to happen.
|
|
<p> <p>See also <a href="ntqt.html#ImageConversionFlags-enum">TQt::ImageConversionFlags</a>.
|
|
|
|
<h3 class=fn>void <a name="drawImage-4"></a>TQPainter::drawImage ( const <a href="ntqrect.html">TQRect</a> & r, const <a href="tqimage.html">TQImage</a> & i )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws the image <em>i</em> into the rectangle <em>r</em>. The image will be
|
|
scaled to fit the rectangle if image and rectangle dimensions
|
|
differ.
|
|
|
|
<h3 class=fn>void <a name="drawLine"></a>TQPainter::drawLine ( int x1, int y1, int x2, int y2 )
|
|
</h3>
|
|
Draws a line from (<em>x1</em>, <em>y1</em>) to (<em>x2</em>, <em>y2</em>) and sets the
|
|
current pen position to (<em>x2</em>, <em>y2</em>).
|
|
<p> <p>See also <a href="#pen">pen</a>().
|
|
|
|
<p>Examples: <a href="coordsys.html#x2272">aclock/aclock.cpp</a>, <a href="drawlines-example.html#x1655">drawlines/connect.cpp</a>, <a href="progress-example.html#x73">progress/progress.cpp</a>, <a href="splitter-example.html#x1297">splitter/splitter.cpp</a>, <a href="themes-example.html#x284">themes/metal.cpp</a>, and <a href="themes-example.html#x214">themes/wood.cpp</a>.
|
|
<h3 class=fn>void <a name="drawLine-2"></a>TQPainter::drawLine ( const <a href="ntqpoint.html">TQPoint</a> & p1, const <a href="ntqpoint.html">TQPoint</a> & p2 )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws a line from point <em>p1</em> to point <em>p2</em>.
|
|
|
|
<h3 class=fn>void <a name="drawLineSegments"></a>TQPainter::drawLineSegments ( const <a href="ntqpointarray.html">TQPointArray</a> & a, int index = 0, int nlines = -1 )
|
|
</h3>
|
|
Draws <em>nlines</em> separate lines from points defined in <em>a</em>,
|
|
starting at <em>a[index]</em> (<em>index</em> defaults to 0). If <em>nlines</em> is
|
|
-1 (the default) all points until the end of the array are used
|
|
(i.e. (a.size()-index)/2 lines are drawn).
|
|
<p> Draws the 1st line from <em>a[index]</em> to <em>a[index+1]</em>. Draws the
|
|
2nd line from <em>a[index+2]</em> to <em>a[index+3]</em> etc.
|
|
<p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
|
|
values are truncated. This limitation is expected to go away in
|
|
TQt 4.
|
|
<p> <p>See also <a href="#drawPolyline">drawPolyline</a>(), <a href="#drawPolygon">drawPolygon</a>(), and <a href="ntqpen.html">TQPen</a>.
|
|
|
|
<h3 class=fn>void <a name="drawPicture"></a>TQPainter::drawPicture ( int x, int y, const <a href="ntqpicture.html">TQPicture</a> & pic )
|
|
</h3>
|
|
Replays the picture <em>pic</em> translated by (<em>x</em>, <em>y</em>).
|
|
<p> This function does exactly the same as <a href="ntqpicture.html#play">TQPicture::play</a>() when
|
|
called with (<em>x</em>, <em>y</em>) = (0, 0).
|
|
|
|
<p>Examples: <a href="picture-example.html#x113">picture/picture.cpp</a> and <a href="xform-example.html#x1234">xform/xform.cpp</a>.
|
|
<h3 class=fn>void <a name="drawPicture-2"></a>TQPainter::drawPicture ( const <a href="ntqpicture.html">TQPicture</a> & pic )
|
|
</h3>
|
|
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> Use one of the other <a href="#drawPicture">TQPainter::drawPicture</a>() functions with a (0, 0)
|
|
offset instead.
|
|
|
|
<h3 class=fn>void <a name="drawPicture-3"></a>TQPainter::drawPicture ( const <a href="ntqpoint.html">TQPoint</a> & p, const <a href="ntqpicture.html">TQPicture</a> & pic )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws picture <em>pic</em> at point <em>p</em>.
|
|
|
|
<h3 class=fn>void <a name="drawPie"></a>TQPainter::drawPie ( int x, int y, int w, int h, int a, int alen )
|
|
</h3>
|
|
Draws a pie defined by the rectangle <em>(x, y, w, h)</em>, the start
|
|
angle <em>a</em> and the arc length <em>alen</em>.
|
|
<p> The pie is filled with the current <a href="#brush">brush</a>().
|
|
<p> The angles <em>a</em> and <em>alen</em> are 1/16th of a degree, i.e. a full
|
|
circle equals 5760 (16*360). Positive values of <em>a</em> and <em>alen</em>
|
|
mean counter-clockwise while negative values mean the clockwise
|
|
direction. Zero degrees is at the 3 o'clock position.
|
|
<p> <p>See also <a href="#drawArc">drawArc</a>() and <a href="#drawChord">drawChord</a>().
|
|
|
|
<p>Examples: <a href="drawdemo-example.html#x1069">drawdemo/drawdemo.cpp</a>, <a href="grapher-nsplugin-example.html#x2757">grapher/grapher.cpp</a>, <a href="tutorial1-10.html#x2349">t10/cannon.cpp</a>, and <a href="tutorial1-09.html#x2340">t9/cannon.cpp</a>.
|
|
<h3 class=fn>void <a name="drawPie-2"></a>TQPainter::drawPie ( const <a href="ntqrect.html">TQRect</a> & r, int a, int alen )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws a pie segment that fits inside the rectangle <em>r</em> with start
|
|
angle <em>a</em> and arc length <em>alen</em>.
|
|
|
|
<h3 class=fn>void <a name="drawPixmap"></a>TQPainter::drawPixmap ( int x, int y, const <a href="ntqpixmap.html">TQPixmap</a> & pixmap, int sx = 0, int sy = 0, int sw = -1, int sh = -1 )
|
|
</h3>
|
|
Draws a pixmap at <em>(x, y)</em> by copying a part of <em>pixmap</em> into
|
|
the paint device.
|
|
<p> <em>(x, y)</em> specifies the top-left point in the paint device that is
|
|
to be drawn onto. <em>(sx, sy)</em> specifies the top-left point in <em>pixmap</em> that is to be drawn. The default is (0, 0).
|
|
<p> <em>(sw, sh)</em> specifies the size of the pixmap that is to be drawn.
|
|
The default, (-1, -1), means all the way to the bottom right of
|
|
the pixmap.
|
|
<p> Currently the mask of the pixmap or it's alpha channel are ignored
|
|
when painting on a <a href="ntqprinter.html">TQPrinter</a>.
|
|
<p> <p>See also <a href="tqimage.html#bitBlt">bitBlt</a>() and <a href="ntqpixmap.html#setMask">TQPixmap::setMask</a>().
|
|
|
|
<p>Examples: <a href="grapher-nsplugin-example.html#x2758">grapher/grapher.cpp</a>, <a href="picture-example.html#x114">picture/picture.cpp</a>, <a href="qdir-example.html#x1832">qdir/qdir.cpp</a>, <a href="qmag-example.html#x1782">qmag/qmag.cpp</a>, <a href="showimg-example.html#x1337">showimg/showimg.cpp</a>, <a href="tutorial1-10.html#x2350">t10/cannon.cpp</a>, and <a href="xform-example.html#x1235">xform/xform.cpp</a>.
|
|
<h3 class=fn>void <a name="drawPixmap-2"></a>TQPainter::drawPixmap ( const <a href="ntqpoint.html">TQPoint</a> & p, const <a href="ntqpixmap.html">TQPixmap</a> & pm, const <a href="ntqrect.html">TQRect</a> & sr )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws the rectangle <em>sr</em> of pixmap <em>pm</em> with its origin at point
|
|
<em>p</em>.
|
|
|
|
<h3 class=fn>void <a name="drawPixmap-3"></a>TQPainter::drawPixmap ( const <a href="ntqpoint.html">TQPoint</a> & p, const <a href="ntqpixmap.html">TQPixmap</a> & pm )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws the pixmap <em>pm</em> with its origin at point <em>p</em>.
|
|
|
|
<h3 class=fn>void <a name="drawPixmap-4"></a>TQPainter::drawPixmap ( const <a href="ntqrect.html">TQRect</a> & r, const <a href="ntqpixmap.html">TQPixmap</a> & pm )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws the pixmap <em>pm</em> into the rectangle <em>r</em>. The pixmap is
|
|
scaled to fit the rectangle, if image and rectangle size disagree.
|
|
|
|
<h3 class=fn>void <a name="drawPoint"></a>TQPainter::drawPoint ( int x, int y )
|
|
</h3>
|
|
Draws/plots a single point at <em>(x, y)</em> using the current pen.
|
|
<p> <p>See also <a href="ntqpen.html">TQPen</a>.
|
|
|
|
<p>Examples: <a href="desktop-example.html#x1734">desktop/desktop.cpp</a> and <a href="drawlines-example.html#x1656">drawlines/connect.cpp</a>.
|
|
<h3 class=fn>void <a name="drawPoint-2"></a>TQPainter::drawPoint ( const <a href="ntqpoint.html">TQPoint</a> & p )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws the point <em>p</em>.
|
|
|
|
<h3 class=fn>void <a name="drawPoints"></a>TQPainter::drawPoints ( const <a href="ntqpointarray.html">TQPointArray</a> & a, int index = 0, int npoints = -1 )
|
|
</h3>
|
|
Draws/plots an array of points, <em>a</em>, using the current pen.
|
|
<p> If <em>index</em> is non-zero (the default is zero) only points from <em>index</em> are drawn. If <em>npoints</em> is negative (the default) the rest
|
|
of the points from <em>index</em> are drawn. If <em>npoints</em> is zero or
|
|
greater, <em>npoints</em> points are drawn.
|
|
<p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
|
|
values are truncated. This limitation is expected to go away in
|
|
TQt 4.
|
|
|
|
<h3 class=fn>void <a name="drawPolygon"></a>TQPainter::drawPolygon ( const <a href="ntqpointarray.html">TQPointArray</a> & a, bool winding = FALSE, int index = 0, int npoints = -1 )
|
|
</h3>
|
|
Draws the polygon defined by the <em>npoints</em> points in <em>a</em>
|
|
starting at <em>a[index]</em>. (<em>index</em> defaults to 0.)
|
|
<p> If <em>npoints</em> is -1 (the default) all points until the end of the
|
|
array are used (i.e. a.size()-index line segments define the
|
|
polygon).
|
|
<p> The first point is always connected to the last point.
|
|
<p> The polygon is filled with the current <a href="#brush">brush</a>(). If <em>winding</em> is
|
|
TRUE, the polygon is filled using the winding fill algorithm. If
|
|
<em>winding</em> is FALSE, the polygon is filled using the even-odd
|
|
(alternative) fill algorithm.
|
|
<p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
|
|
values are truncated. This limitation is expected to go away in
|
|
TQt 4.
|
|
<p> <p>See also <a href="#drawLineSegments">drawLineSegments</a>(), <a href="#drawPolyline">drawPolyline</a>(), and <a href="ntqpen.html">TQPen</a>.
|
|
|
|
<p>Examples: <a href="desktop-example.html#x1735">desktop/desktop.cpp</a> and <a href="picture-example.html#x115">picture/picture.cpp</a>.
|
|
<h3 class=fn>void <a name="drawPolyline"></a>TQPainter::drawPolyline ( const <a href="ntqpointarray.html">TQPointArray</a> & a, int index = 0, int npoints = -1 )
|
|
</h3>
|
|
Draws the polyline defined by the <em>npoints</em> points in <em>a</em>
|
|
starting at <em>a[index]</em>. (<em>index</em> defaults to 0.)
|
|
<p> If <em>npoints</em> is -1 (the default) all points until the end of the
|
|
array are used (i.e. a.size()-index-1 line segments are drawn).
|
|
<p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
|
|
values are truncated. This limitation is expected to go away in
|
|
TQt 4.
|
|
<p> <p>See also <a href="#drawLineSegments">drawLineSegments</a>(), <a href="#drawPolygon">drawPolygon</a>(), and <a href="ntqpen.html">TQPen</a>.
|
|
|
|
<p>Examples: <a href="scribble-example.html#x917">scribble/scribble.cpp</a> and <a href="themes-example.html#x285">themes/metal.cpp</a>.
|
|
<h3 class=fn>void <a name="drawRect"></a>TQPainter::drawRect ( int x, int y, int w, int h )
|
|
</h3>
|
|
Draws a rectangle with upper left corner at <em>(x, y)</em> and with
|
|
width <em>w</em> and height <em>h</em>.
|
|
<p> <p>See also <a href="ntqpen.html">TQPen</a> and <a href="#drawRoundRect">drawRoundRect</a>().
|
|
|
|
<p>Examples: <a href="drawdemo-example.html#x1070">drawdemo/drawdemo.cpp</a>, <a href="picture-example.html#x116">picture/picture.cpp</a>, <a href="tutorial1-10.html#x2351">t10/cannon.cpp</a>, <a href="tutorial1-11.html#x2366">t11/cannon.cpp</a>, <a href="tutorial1-09.html#x2341">t9/cannon.cpp</a>, <a href="tooltip-example.html#x444">tooltip/tooltip.cpp</a>, and <a href="trivial-nsplugin-example.html#x2737">trivial/trivial.cpp</a>.
|
|
<h3 class=fn>void <a name="drawRect-2"></a>TQPainter::drawRect ( const <a href="ntqrect.html">TQRect</a> & r )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws the rectangle <em>r</em>.
|
|
|
|
<h3 class=fn>void <a name="drawRoundRect"></a>TQPainter::drawRoundRect ( int x, int y, int w, int h, int xRnd = 25, int yRnd = 25 )
|
|
</h3>
|
|
Draws a rectangle with rounded corners at <em>(x, y)</em>, with width <em>w</em> and height <em>h</em>.
|
|
<p> The <em>xRnd</em> and <em>yRnd</em> arguments specify how rounded the corners
|
|
should be. 0 is angled corners, 99 is maximum roundedness.
|
|
<p> The width and height include all of the drawn lines.
|
|
<p> <p>See also <a href="#drawRect">drawRect</a>() and <a href="ntqpen.html">TQPen</a>.
|
|
|
|
<p>Examples: <a href="drawdemo-example.html#x1071">drawdemo/drawdemo.cpp</a> and <a href="themes-example.html#x215">themes/wood.cpp</a>.
|
|
<h3 class=fn>void <a name="drawRoundRect-2"></a>TQPainter::drawRoundRect ( const <a href="ntqrect.html">TQRect</a> & r, int xRnd = 25, int yRnd = 25 )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws a rounded rectangle <em>r</em>, rounding to the x position <em>xRnd</em>
|
|
and the y position <em>yRnd</em> on each corner.
|
|
|
|
<h3 class=fn>void <a name="drawText"></a>TQPainter::drawText ( const <a href="ntqpoint.html">TQPoint</a> & p, const <a href="ntqstring.html">TQString</a> &, int pos, int len, <a href="ntqpainter.html#TextDirection-enum">TextDirection</a> dir = Auto )
|
|
</h3>
|
|
|
|
<p> Draws the text from position <em>pos</em>, at point <em>p</em>. If <em>len</em> is
|
|
-1 the entire string is drawn, otherwise just the first <em>len</em>
|
|
characters. The text's direction is specified by <em>dir</em>.
|
|
<p> Note that the meaning of <em>y</em> is not the same for the two
|
|
<a href="#drawText">drawText</a>() varieties. For overloads that take a simple <em>x</em>, <em>y</em>
|
|
pair (or a point), the <em>y</em> value is the text's baseline; for
|
|
overloads that take a rectangle, <em>rect.y()</em> is the top of the
|
|
rectangle and the text is aligned within that rectangle in
|
|
accordance with the alignment flags.
|
|
<p> <p>See also <a href="#TextDirection-enum">TQPainter::TextDirection</a>.
|
|
|
|
<p>Examples: <a href="desktop-example.html#x1736">desktop/desktop.cpp</a>, <a href="drawdemo-example.html#x1072">drawdemo/drawdemo.cpp</a>, <a href="grapher-nsplugin-example.html#x2760">grapher/grapher.cpp</a>, <a href="picture-example.html#x117">picture/picture.cpp</a>, <a href="progress-example.html#x74">progress/progress.cpp</a>, <a href="tutorial1-08.html#x2335">t8/cannon.cpp</a>, and <a href="trivial-nsplugin-example.html#x2738">trivial/trivial.cpp</a>.
|
|
<h3 class=fn>void <a name="drawText-2"></a>TQPainter::drawText ( int x, int y, const <a href="ntqstring.html">TQString</a> &, int len = -1, <a href="ntqpainter.html#TextDirection-enum">TextDirection</a> dir = Auto )
|
|
</h3>
|
|
|
|
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws the given text at position <em>x</em>, <em>y</em>. If <em>len</em> is -1 (the
|
|
default) all the text is drawn, otherwise the first <em>len</em>
|
|
characters are drawn. The text's direction is given by <em>dir</em>.
|
|
<p> <p>See also <a href="#TextDirection-enum">TQPainter::TextDirection</a>.
|
|
|
|
<h3 class=fn>void <a name="drawText-3"></a>TQPainter::drawText ( const <a href="ntqpoint.html">TQPoint</a> &, const <a href="ntqstring.html">TQString</a> &, int len = -1, <a href="ntqpainter.html#TextDirection-enum">TextDirection</a> dir = Auto )
|
|
</h3>
|
|
|
|
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws the text at the given point.
|
|
<p> <p>See also <a href="#TextDirection-enum">TQPainter::TextDirection</a>.
|
|
|
|
<h3 class=fn>void <a name="drawText-4"></a>TQPainter::drawText ( int x, int y, const <a href="ntqstring.html">TQString</a> &, int pos, int len, <a href="ntqpainter.html#TextDirection-enum">TextDirection</a> dir = Auto )
|
|
</h3>
|
|
|
|
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws the text from position <em>pos</em>, at point <em>(x, y)</em>. If <em>len</em> is
|
|
-1 the entire string is drawn, otherwise just the first <em>len</em>
|
|
characters. The text's direction is specified by <em>dir</em>.
|
|
|
|
<h3 class=fn>void <a name="drawText-5"></a>TQPainter::drawText ( int x, int y, int w, int h, int flags, const <a href="ntqstring.html">TQString</a> &, int len = -1, <a href="ntqrect.html">TQRect</a> * br = 0, TQTextParag ** internal = 0 )
|
|
</h3>
|
|
|
|
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws the given text within the rectangle starting at <em>x</em>, <em>y</em>,
|
|
with width <em>w</em> and height <em>h</em>. If <em>len</em> is -1 (the default) all
|
|
the text is drawn, otherwise the first <em>len</em> characters are
|
|
drawn. The text's flags that are given in the <em>flags</em> parameter
|
|
are <a href="ntqt.html#AlignmentFlags-enum">TQt::AlignmentFlags</a> and <a href="ntqt.html#TextFlags-enum">TQt::TextFlags</a> OR'd together. <em>br</em> (if not null) is set to the actual bounding rectangle of the
|
|
output. The <em>internal</em> parameter is for internal use only.
|
|
|
|
<h3 class=fn>void <a name="drawText-6"></a>TQPainter::drawText ( const <a href="ntqrect.html">TQRect</a> & r, int tf, const <a href="ntqstring.html">TQString</a> & str, int len = -1, <a href="ntqrect.html">TQRect</a> * brect = 0, TQTextParag ** internal = 0 )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws at most <em>len</em> characters from <em>str</em> in the rectangle <em>r</em>.
|
|
<p> This function draws formatted text. The <em>tf</em> text format is
|
|
really of type <a href="ntqt.html#AlignmentFlags-enum">TQt::AlignmentFlags</a> and <a href="ntqt.html#TextFlags-enum">TQt::TextFlags</a> OR'd
|
|
together.
|
|
<p> Horizontal alignment defaults to AlignAuto and vertical alignment
|
|
defaults to AlignTop.
|
|
<p> <em>brect</em> (if not null) is set to the actual bounding rectangle of
|
|
the output. <em>internal</em> is, yes, internal.
|
|
<p> <p>See also <a href="#boundingRect">boundingRect</a>().
|
|
|
|
<h3 class=fn>void <a name="drawTiledPixmap"></a>TQPainter::drawTiledPixmap ( int x, int y, int w, int h, const <a href="ntqpixmap.html">TQPixmap</a> & pixmap, int sx = 0, int sy = 0 )
|
|
</h3>
|
|
Draws a tiled <em>pixmap</em> in the specified rectangle.
|
|
<p> <em>(x, y)</em> specifies the top-left point in the paint device that is
|
|
to be drawn onto; with the width and height given by <em>w</em> and <em>h</em>. <em>(sx, sy)</em> specifies the top-left point in <em>pixmap</em> that is
|
|
to be drawn. The default is (0, 0).
|
|
<p> Calling <a href="#drawTiledPixmap">drawTiledPixmap</a>() is similar to calling <a href="#drawPixmap">drawPixmap</a>()
|
|
several times to fill (tile) an area with a pixmap, but is
|
|
potentially much more efficient depending on the underlying window
|
|
system.
|
|
<p> <p>See also <a href="#drawPixmap">drawPixmap</a>().
|
|
|
|
<h3 class=fn>void <a name="drawTiledPixmap-2"></a>TQPainter::drawTiledPixmap ( const <a href="ntqrect.html">TQRect</a> & r, const <a href="ntqpixmap.html">TQPixmap</a> & pm, const <a href="ntqpoint.html">TQPoint</a> & sp )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws a tiled pixmap, <em>pm</em>, inside rectangle <em>r</em> with its origin
|
|
at point <em>sp</em>.
|
|
|
|
<h3 class=fn>void <a name="drawTiledPixmap-3"></a>TQPainter::drawTiledPixmap ( const <a href="ntqrect.html">TQRect</a> & r, const <a href="ntqpixmap.html">TQPixmap</a> & pm )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws a tiled pixmap, <em>pm</em>, inside rectangle <em>r</em>.
|
|
|
|
<h3 class=fn>void <a name="drawWinFocusRect"></a>TQPainter::drawWinFocusRect ( int x, int y, int w, int h, const <a href="ntqcolor.html">TQColor</a> & bgColor )
|
|
</h3>
|
|
Draws a Windows focus rectangle with upper left corner at (<em>x</em>,
|
|
<em>y</em>) and with width <em>w</em> and height <em>h</em> using a pen color that
|
|
contrasts with <em>bgColor</em>.
|
|
<p> This function draws a stippled rectangle (XOR is not used) that is
|
|
used to indicate <a href="focus.html#keyboard-focus">keyboard focus</a> (when the <a href="ntqapplication.html#style">TQApplication::style</a>() is
|
|
<tt>WindowStyle</tt>).
|
|
<p> The pen color used to draw the rectangle is either white or black
|
|
depending on the color of <em>bgColor</em> (see TQColor::gray()).
|
|
<p> <b>Warning:</b> This function draws nothing if the coordinate system has
|
|
been <a href="#rotate">rotated</a> or <a href="#shear">sheared</a>.
|
|
<p> <p>See also <a href="#drawRect">drawRect</a>() and <a href="ntqapplication.html#style">TQApplication::style</a>().
|
|
|
|
<h3 class=fn>void <a name="drawWinFocusRect-2"></a>TQPainter::drawWinFocusRect ( int x, int y, int w, int h )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws a Windows focus rectangle with upper left corner at (<em>x</em>,
|
|
<em>y</em>) and with width <em>w</em> and height <em>h</em>.
|
|
<p> This function draws a stippled XOR rectangle that is used to
|
|
indicate <a href="focus.html#keyboard-focus">keyboard focus</a> (when <a href="ntqapplication.html#style">TQApplication::style</a>() is <tt>WindowStyle</tt>).
|
|
<p> <b>Warning:</b> This function draws nothing if the coordinate system has
|
|
been <a href="#rotate">rotated</a> or <a href="#shear">sheared</a>.
|
|
<p> <p>See also <a href="#drawRect">drawRect</a>() and <a href="ntqapplication.html#style">TQApplication::style</a>().
|
|
|
|
<h3 class=fn>void <a name="drawWinFocusRect-3"></a>TQPainter::drawWinFocusRect ( const <a href="ntqrect.html">TQRect</a> & r )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws rectangle <em>r</em> as a window focus rectangle.
|
|
|
|
<h3 class=fn>void <a name="drawWinFocusRect-4"></a>TQPainter::drawWinFocusRect ( const <a href="ntqrect.html">TQRect</a> & r, const <a href="ntqcolor.html">TQColor</a> & bgColor )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws rectangle <em>r</em> as a window focus rectangle using background
|
|
color <em>bgColor</em>.
|
|
|
|
<h3 class=fn>bool <a name="end"></a>TQPainter::end ()
|
|
</h3>
|
|
Ends painting. Any resources used while painting are released.
|
|
<p> Note that while you mostly don't need to call <a href="#end">end</a>(), the
|
|
destructor will do it, there is at least one common case when it
|
|
is needed, namely double buffering.
|
|
<p> <pre>
|
|
TQPainter p( myPixmap, this )
|
|
// ...
|
|
p.<a href="#end">end</a>(); // stops drawing on myPixmap
|
|
p.<a href="#begin">begin</a>( this );
|
|
p.<a href="#drawPixmap">drawPixmap</a>( 0, 0, myPixmap );
|
|
</pre>
|
|
|
|
<p> Since you can't draw a <a href="ntqpixmap.html">TQPixmap</a> while it is being painted, it is
|
|
necessary to close the active painter.
|
|
<p> <p>See also <a href="#begin">begin</a>() and <a href="#isActive">isActive</a>().
|
|
|
|
<p>Examples: <a href="aclock-example.html#x1186">aclock/aclock.cpp</a>, <a href="desktop-example.html#x1737">desktop/desktop.cpp</a>, <a href="hello-example.html#x1635">hello/hello.cpp</a>, <a href="picture-example.html#x118">picture/picture.cpp</a>, <a href="scribble-example.html#x918">scribble/scribble.cpp</a>, <a href="tutorial1-10.html#x2352">t10/cannon.cpp</a>, and <a href="xform-example.html#x1238">xform/xform.cpp</a>.
|
|
<h3 class=fn>void <a name="eraseRect"></a>TQPainter::eraseRect ( int x, int y, int w, int h )
|
|
</h3>
|
|
|
|
<p> Erases the area inside <em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>. Equivalent to
|
|
<tt>fillRect( x, y, w, h, backgroundColor() )</tt>.
|
|
|
|
<p>Examples: <a href="listboxcombo-example.html#x1414">listboxcombo/listboxcombo.cpp</a> and <a href="showimg-example.html#x1338">showimg/showimg.cpp</a>.
|
|
<h3 class=fn>void <a name="eraseRect-2"></a>TQPainter::eraseRect ( const <a href="ntqrect.html">TQRect</a> & r )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Erases the area inside the rectangle <em>r</em>.
|
|
|
|
<h3 class=fn>void <a name="fillRect"></a>TQPainter::fillRect ( int x, int y, int w, int h, const <a href="ntqbrush.html">TQBrush</a> & brush )
|
|
</h3>
|
|
Fills the rectangle <em>(x, y, w, h)</em> with the <em>brush</em>.
|
|
<p> You can specify a <a href="ntqcolor.html">TQColor</a> as <em>brush</em>, since there is a <a href="ntqbrush.html">TQBrush</a>
|
|
constructor that takes a TQColor argument and creates a solid
|
|
pattern brush.
|
|
<p> <p>See also <a href="#drawRect">drawRect</a>().
|
|
|
|
<p>Examples: <a href="listboxcombo-example.html#x1415">listboxcombo/listboxcombo.cpp</a>, <a href="qaxserver-example-multiple.html#x2543">multiple/ax1.h</a>, <a href="progress-example.html#x75">progress/progress.cpp</a>, <a href="qdir-example.html#x1833">qdir/qdir.cpp</a>, <a href="qfd-example.html#x1998">qfd/fontdisplayer.cpp</a>, <a href="themes-example.html#x286">themes/metal.cpp</a>, and <a href="themes-example.html#x216">themes/wood.cpp</a>.
|
|
<h3 class=fn>void <a name="fillRect-2"></a>TQPainter::fillRect ( const <a href="ntqrect.html">TQRect</a> & r, const <a href="ntqbrush.html">TQBrush</a> & brush )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Fills the rectangle <em>r</em> using brush <em>brush</em>.
|
|
|
|
<h3 class=fn>void <a name="flush"></a>TQPainter::flush ( const <a href="ntqregion.html">TQRegion</a> & region, <a href="ntqpainter.html#CoordinateMode-enum">CoordinateMode</a> cm = CoordDevice )
|
|
</h3>
|
|
Flushes any buffered drawing operations inside the region <em>region</em> using clipping mode <em>cm</em>.
|
|
<p> The flush may update the whole device if the platform does not
|
|
support flushing to a specified region.
|
|
<p> <p>See also <a href="#CoordinateMode-enum">CoordinateMode</a>.
|
|
|
|
<h3 class=fn>void <a name="flush-2"></a>TQPainter::flush ()
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Flushes any buffered drawing operations.
|
|
|
|
<h3 class=fn>const <a href="ntqfont.html">TQFont</a> & <a name="font"></a>TQPainter::font () const
|
|
</h3>
|
|
|
|
<p> Returns the currently set painter font.
|
|
<p> <p>See also <a href="#setFont">setFont</a>() and <a href="ntqfont.html">TQFont</a>.
|
|
|
|
<p>Example: <a href="fileiconview-example.html#x861">fileiconview/qfileiconview.cpp</a>.
|
|
<h3 class=fn><a href="ntqfontinfo.html">TQFontInfo</a> <a name="fontInfo"></a>TQPainter::fontInfo () const
|
|
</h3>
|
|
Returns the font info for the painter, if the painter is active.
|
|
It is not possible to obtain font information for an inactive
|
|
painter, so the return value is undefined if the painter is not
|
|
active.
|
|
<p> <p>See also <a href="#fontMetrics">fontMetrics</a>() and <a href="#isActive">isActive</a>().
|
|
|
|
<h3 class=fn><a href="ntqfontmetrics.html">TQFontMetrics</a> <a name="fontMetrics"></a>TQPainter::fontMetrics () const
|
|
</h3>
|
|
Returns the font metrics for the painter, if the painter is
|
|
active. It is not possible to obtain metrics for an inactive
|
|
painter, so the return value is undefined if the painter is not
|
|
active.
|
|
<p> <p>See also <a href="#fontInfo">fontInfo</a>() and <a href="#isActive">isActive</a>().
|
|
|
|
<p>Examples: <a href="qaction-application-example.html#x1147">action/application.cpp</a>, <a href="simple-application-example.html#x1565">application/application.cpp</a>, <a href="desktop-example.html#x1738">desktop/desktop.cpp</a>, <a href="drawdemo-example.html#x1073">drawdemo/drawdemo.cpp</a>, <a href="helpviewer-example.html#x1001">helpviewer/helpwindow.cpp</a>, <a href="mdi-example.html#x2046">mdi/application.cpp</a>, and <a href="qwerty-example.html#x384">qwerty/qwerty.cpp</a>.
|
|
<h3 class=fn>HDC <a name="handle"></a>TQPainter::handle () const
|
|
</h3>
|
|
|
|
<p> Returns the platform-dependent handle used for drawing. Using this
|
|
function is not portable.
|
|
|
|
<h3 class=fn>bool <a name="hasClipping"></a>TQPainter::hasClipping () const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if clipping has been set; otherwise returns FALSE.
|
|
<p> <p>See also <a href="#setClipping">setClipping</a>().
|
|
|
|
<p>Example: <a href="themes-example.html#x217">themes/wood.cpp</a>.
|
|
<h3 class=fn>bool <a name="hasViewXForm"></a>TQPainter::hasViewXForm () const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if view transformation is enabled; otherwise returns
|
|
FALSE.
|
|
<p> <p>See also <a href="#setViewXForm">setViewXForm</a>() and <a href="#xForm">xForm</a>().
|
|
|
|
<h3 class=fn>bool <a name="hasWorldXForm"></a>TQPainter::hasWorldXForm () const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if world transformation is enabled; otherwise returns
|
|
FALSE.
|
|
<p> <p>See also <a href="#setWorldXForm">setWorldXForm</a>().
|
|
|
|
<h3 class=fn>bool <a name="isActive"></a>TQPainter::isActive () const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if the painter is active painting, i.e. <a href="#begin">begin</a>() has
|
|
been called and <a href="#end">end</a>() has not yet been called; otherwise returns
|
|
FALSE.
|
|
<p> <p>See also <a href="ntqpaintdevice.html#paintingActive">TQPaintDevice::paintingActive</a>().
|
|
|
|
<p>Examples: <a href="desktop-example.html#x1739">desktop/desktop.cpp</a> and <a href="helpviewer-example.html#x1002">helpviewer/helpwindow.cpp</a>.
|
|
<h3 class=fn>void <a name="lineTo"></a>TQPainter::lineTo ( int x, int y )
|
|
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> Use <a href="#drawLine">drawLine</a>() instead.
|
|
<p> Draws a line from the current pen position to <em>(x, y)</em> and sets
|
|
<em>(x, y)</em> to be the new current pen position.
|
|
<p> <p>See also <a href="ntqpen.html">TQPen</a>, <a href="#moveTo">moveTo</a>(), <a href="#drawLine">drawLine</a>(), and <a href="#pos">pos</a>().
|
|
|
|
<h3 class=fn>void <a name="lineTo-2"></a>TQPainter::lineTo ( const <a href="ntqpoint.html">TQPoint</a> & p )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Draws a line to the point <em>p</em>.
|
|
|
|
<h3 class=fn>void <a name="moveTo"></a>TQPainter::moveTo ( int x, int y )
|
|
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> Sets the current pen position to <em>(x, y)</em>
|
|
<p> <p>See also <a href="#lineTo">lineTo</a>() and <a href="#pos">pos</a>().
|
|
|
|
<h3 class=fn>void <a name="moveTo-2"></a>TQPainter::moveTo ( const <a href="ntqpoint.html">TQPoint</a> & p )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Moves to the point <em>p</em>.
|
|
|
|
<h3 class=fn>const <a href="ntqpen.html">TQPen</a> & <a name="pen"></a>TQPainter::pen () const
|
|
</h3>
|
|
|
|
<p> Returns the painter's current pen.
|
|
<p> <p>See also <a href="#setPen">setPen</a>().
|
|
|
|
<p>Examples: <a href="qaxserver-example-multiple.html#x2546">multiple/ax2.h</a>, <a href="progress-example.html#x76">progress/progress.cpp</a>, and <a href="themes-example.html#x218">themes/wood.cpp</a>.
|
|
<h3 class=fn><a href="ntqpoint.html">TQPoint</a> <a name="pos"></a>TQPainter::pos () const
|
|
</h3>
|
|
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> Returns the current position of the pen.
|
|
<p> <p>See also <a href="#moveTo">moveTo</a>().
|
|
|
|
<h3 class=fn><a href="ntqt.html#RasterOp-enum">RasterOp</a> <a name="rasterOp"></a>TQPainter::rasterOp () const
|
|
</h3>
|
|
|
|
<p> Returns the current <a href="ntqt.html#RasterOp-enum">raster operation</a>.
|
|
<p> <p>See also <a href="#setRasterOp">setRasterOp</a>() and <a href="ntqt.html#RasterOp-enum">RasterOp</a>.
|
|
|
|
<h3 class=fn>void <a name="redirect"></a>TQPainter::redirect ( <a href="ntqpaintdevice.html">TQPaintDevice</a> * pdev, <a href="ntqpaintdevice.html">TQPaintDevice</a> * replacement )<tt> [static]</tt>
|
|
</h3>
|
|
Redirects all paint commands for a paint device, <em>pdev</em>, to
|
|
another paint device, <em>replacement</em>, unless <em>replacement</em> is 0.
|
|
If <em>replacement</em> is 0, the redirection for <em>pdev</em> is removed.
|
|
<p> In general, you'll probably find calling <a href="ntqpixmap.html#grabWidget">TQPixmap::grabWidget</a>() or
|
|
<a href="ntqpixmap.html#grabWindow">TQPixmap::grabWindow</a>() is an easier solution.
|
|
|
|
<h3 class=fn>void <a name="resetXForm"></a>TQPainter::resetXForm ()
|
|
</h3>
|
|
Resets any transformations that were made using <a href="#translate">translate</a>(), <a href="#scale">scale</a>(),
|
|
<a href="#shear">shear</a>(), <a href="#rotate">rotate</a>(), <a href="#setWorldMatrix">setWorldMatrix</a>(), <a href="#setViewport">setViewport</a>() and
|
|
<a href="#setWindow">setWindow</a>().
|
|
<p> <p>See also <a href="#worldMatrix">worldMatrix</a>(), <a href="#viewport">viewport</a>(), and <a href="#window">window</a>().
|
|
|
|
<h3 class=fn>void <a name="restore"></a>TQPainter::restore ()
|
|
</h3>
|
|
Restores the current painter state (pops a saved state off the
|
|
stack).
|
|
<p> <p>See also <a href="#save">save</a>().
|
|
|
|
<p>Example: <a href="coordsys.html#x2273">aclock/aclock.cpp</a>.
|
|
<h3 class=fn>void <a name="restoreWorldMatrix"></a>TQPainter::restoreWorldMatrix ()
|
|
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> We recommend using <a href="#restore">restore</a>() instead.
|
|
|
|
<h3 class=fn>void <a name="rotate"></a>TQPainter::rotate ( double a )
|
|
</h3>
|
|
Rotates the coordinate system <em>a</em> degrees counterclockwise.
|
|
<p> <p>See also <a href="#translate">translate</a>(), <a href="#scale">scale</a>(), <a href="#shear">shear</a>(), <a href="#resetXForm">resetXForm</a>(), <a href="#setWorldMatrix">setWorldMatrix</a>(), and <a href="#xForm">xForm</a>().
|
|
|
|
<p>Examples: <a href="coordsys.html#x2274">aclock/aclock.cpp</a>, <a href="tutorial1-10.html#x2353">t10/cannon.cpp</a>, and <a href="tutorial1-09.html#x2342">t9/cannon.cpp</a>.
|
|
<h3 class=fn>void <a name="save"></a>TQPainter::save ()
|
|
</h3>
|
|
Saves the current painter state (pushes the state onto a stack). A
|
|
<a href="#save">save</a>() must be followed by a corresponding <a href="#restore">restore</a>(). <a href="#end">end</a>()
|
|
unwinds the stack.
|
|
<p> <p>See also <a href="#restore">restore</a>().
|
|
|
|
<p>Example: <a href="coordsys.html#x2275">aclock/aclock.cpp</a>.
|
|
<h3 class=fn>void <a name="saveWorldMatrix"></a>TQPainter::saveWorldMatrix ()
|
|
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> We recommend using <a href="#save">save</a>() instead.
|
|
|
|
<h3 class=fn>void <a name="scale"></a>TQPainter::scale ( double sx, double sy )
|
|
</h3>
|
|
Scales the coordinate system by <em>(sx, sy)</em>.
|
|
<p> <p>See also <a href="#translate">translate</a>(), <a href="#shear">shear</a>(), <a href="#rotate">rotate</a>(), <a href="#resetXForm">resetXForm</a>(), <a href="#setWorldMatrix">setWorldMatrix</a>(), and <a href="#xForm">xForm</a>().
|
|
|
|
<p>Example: <a href="xform-example.html#x1239">xform/xform.cpp</a>.
|
|
<h3 class=fn>void <a name="setBackgroundColor"></a>TQPainter::setBackgroundColor ( const <a href="ntqcolor.html">TQColor</a> & c )
|
|
</h3>
|
|
Sets the background color of the painter to <em>c</em>.
|
|
<p> The background color is the color that is filled in when drawing
|
|
opaque text, stippled lines and bitmaps. The background color has
|
|
no effect in transparent background mode (which is the default).
|
|
<p> <p>See also <a href="#backgroundColor">backgroundColor</a>(), <a href="#setBackgroundMode">setBackgroundMode</a>(), and <a href="ntqt.html#BackgroundMode-enum">BackgroundMode</a>.
|
|
|
|
<h3 class=fn>void <a name="setBackgroundMode"></a>TQPainter::setBackgroundMode ( <a href="ntqt.html#BGMode-enum">BGMode</a> m )
|
|
</h3>
|
|
Sets the background mode of the painter to <em>m</em>, which must be
|
|
either <a href="ntqt.html#BGMode-enum">TransparentMode</a> (the default) or <a href="ntqt.html#BGMode-enum">OpaqueMode</a>.
|
|
<p> Transparent mode draws stippled lines and text without setting the
|
|
background pixels. Opaque mode fills these space with the current
|
|
background color.
|
|
<p> Note that in order to draw a bitmap or pixmap transparently, you
|
|
must use <a href="ntqpixmap.html#setMask">TQPixmap::setMask</a>().
|
|
<p> <p>See also <a href="#backgroundMode">backgroundMode</a>() and <a href="#setBackgroundColor">setBackgroundColor</a>().
|
|
|
|
<p>Example: <a href="picture-example.html#x119">picture/picture.cpp</a>.
|
|
<h3 class=fn>void <a name="setBrush"></a>TQPainter::setBrush ( <a href="ntqt.html#BrushStyle-enum">BrushStyle</a> style )
|
|
</h3>
|
|
Sets the painter's brush to black color and the specified <em>style</em>.
|
|
<p> <p>See also <a href="#brush">brush</a>() and <a href="ntqbrush.html">TQBrush</a>.
|
|
|
|
<p>Examples: <a href="aclock-example.html#x1190">aclock/aclock.cpp</a>, <a href="drawdemo-example.html#x1074">drawdemo/drawdemo.cpp</a>, <a href="picture-example.html#x120">picture/picture.cpp</a>, <a href="tutorial1-10.html#x2354">t10/cannon.cpp</a>, <a href="tutorial1-09.html#x2343">t9/cannon.cpp</a>, <a href="themes-example.html#x219">themes/wood.cpp</a>, and <a href="tooltip-example.html#x445">tooltip/tooltip.cpp</a>.
|
|
<h3 class=fn>void <a name="setBrush-2"></a>TQPainter::setBrush ( const <a href="ntqbrush.html">TQBrush</a> & brush )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Sets the painter's brush to <em>brush</em>.
|
|
<p> The <em>brush</em> defines how shapes are filled.
|
|
<p> <p>See also <a href="#brush">brush</a>().
|
|
|
|
<h3 class=fn>void <a name="setBrush-3"></a>TQPainter::setBrush ( const <a href="ntqcolor.html">TQColor</a> & color )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Sets the painter's brush to have style <a href="ntqt.html#BrushStyle-enum">SolidPattern</a> and the
|
|
specified <em>color</em>.
|
|
<p> <p>See also <a href="#brush">brush</a>() and <a href="ntqbrush.html">TQBrush</a>.
|
|
|
|
<h3 class=fn>void <a name="setBrushOrigin"></a>TQPainter::setBrushOrigin ( int x, int y )
|
|
</h3>
|
|
Sets the brush origin to <em>(x, y)</em>.
|
|
<p> The brush origin specifies the (0, 0) coordinate of the painter's
|
|
brush. This setting only applies to pattern brushes and pixmap
|
|
brushes.
|
|
<p> <p>See also <a href="#brushOrigin">brushOrigin</a>().
|
|
|
|
<h3 class=fn>void <a name="setBrushOrigin-2"></a>TQPainter::setBrushOrigin ( const <a href="ntqpoint.html">TQPoint</a> & p )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Sets the brush origin to point <em>p</em>.
|
|
|
|
<h3 class=fn>void <a name="setClipRect"></a>TQPainter::setClipRect ( int x, int y, int w, int h, <a href="ntqpainter.html#CoordinateMode-enum">CoordinateMode</a> m = CoordDevice )
|
|
</h3>
|
|
|
|
<p> Sets the clip region to the rectangle <em>x</em>, <em>y</em>, <em>w</em>, <em>h</em> and
|
|
enables clipping. The clip mode is set to <em>m</em>.
|
|
<p> If <em>m</em> is <a href="#CoordinateMode-enum">CoordDevice</a> (the default), the coordinates given for
|
|
the clip region are taken to be physical device coordinates and
|
|
are <em>not</em> subject to any <a href="coordsys.html">coordinate
|
|
transformations</a>. If <em>m</em> is <a href="#CoordinateMode-enum">CoordPainter</a>, the
|
|
coordinates given for the clip region are taken to be model
|
|
coordinates.
|
|
<p> <p>See also <a href="#setClipRegion">setClipRegion</a>(), <a href="#clipRegion">clipRegion</a>(), <a href="#setClipping">setClipping</a>(), and <a href="#CoordinateMode-enum">TQPainter::CoordinateMode</a>.
|
|
|
|
<p>Examples: <a href="grapher-nsplugin-example.html#x2762">grapher/grapher.cpp</a>, <a href="progress-example.html#x77">progress/progress.cpp</a>, <a href="showimg-example.html#x1339">showimg/showimg.cpp</a>, <a href="splitter-example.html#x1298">splitter/splitter.cpp</a>, and <a href="trivial-nsplugin-example.html#x2739">trivial/trivial.cpp</a>.
|
|
<h3 class=fn>void <a name="setClipRect-2"></a>TQPainter::setClipRect ( const <a href="ntqrect.html">TQRect</a> & r, <a href="ntqpainter.html#CoordinateMode-enum">CoordinateMode</a> m = CoordDevice )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Sets the clip region to the rectangle <em>r</em> and enables clipping.
|
|
The clip mode is set to <em>m</em>.
|
|
<p> <p>See also <a href="#CoordinateMode-enum">CoordinateMode</a>.
|
|
|
|
<h3 class=fn>void <a name="setClipRegion"></a>TQPainter::setClipRegion ( const <a href="ntqregion.html">TQRegion</a> & rgn, <a href="ntqpainter.html#CoordinateMode-enum">CoordinateMode</a> m = CoordDevice )
|
|
</h3>
|
|
Sets the clip region to <em>rgn</em> and enables clipping. The clip mode
|
|
is set to <em>m</em>.
|
|
<p> Note that the clip region is given in physical device coordinates
|
|
and <em>not</em> subject to any <a href="coordsys.html">coordinate
|
|
transformation.</a>
|
|
<p> <p>See also <a href="#setClipRect">setClipRect</a>(), <a href="#clipRegion">clipRegion</a>(), <a href="#setClipping">setClipping</a>(), and <a href="#CoordinateMode-enum">CoordinateMode</a>.
|
|
|
|
<p>Examples: <a href="qfd-example.html#x1999">qfd/fontdisplayer.cpp</a> and <a href="themes-example.html#x220">themes/wood.cpp</a>.
|
|
<h3 class=fn>void <a name="setClipping"></a>TQPainter::setClipping ( bool enable )
|
|
</h3>
|
|
Enables clipping if <em>enable</em> is TRUE, or disables clipping if <em>enable</em> is FALSE.
|
|
<p> <p>See also <a href="#hasClipping">hasClipping</a>(), <a href="#setClipRect">setClipRect</a>(), and <a href="#setClipRegion">setClipRegion</a>().
|
|
|
|
<p>Example: <a href="themes-example.html#x221">themes/wood.cpp</a>.
|
|
<h3 class=fn>void <a name="setFont"></a>TQPainter::setFont ( const <a href="ntqfont.html">TQFont</a> & font )
|
|
</h3>
|
|
Sets the painter's font to <em>font</em>.
|
|
<p> This font is used by subsequent <a href="#drawText">drawText</a>() functions. The text
|
|
color is the same as the pen color.
|
|
<p> <p>See also <a href="#font">font</a>() and <a href="#drawText">drawText</a>().
|
|
|
|
<p>Examples: <a href="drawdemo-example.html#x1075">drawdemo/drawdemo.cpp</a>, <a href="grapher-nsplugin-example.html#x2763">grapher/grapher.cpp</a>, <a href="hello-example.html#x1636">hello/hello.cpp</a>, <a href="picture-example.html#x121">picture/picture.cpp</a>, <a href="qwerty-example.html#x385">qwerty/qwerty.cpp</a>, <a href="tutorial1-13.html#x2403">t13/cannon.cpp</a>, and <a href="xform-example.html#x1240">xform/xform.cpp</a>.
|
|
<h3 class=fn>void <a name="setPen"></a>TQPainter::setPen ( const <a href="ntqpen.html">TQPen</a> & pen )
|
|
</h3>
|
|
Sets a new painter pen.
|
|
<p> The <em>pen</em> defines how to draw lines and outlines, and it also
|
|
defines the text color.
|
|
<p> <p>See also <a href="#pen">pen</a>().
|
|
|
|
<p>Examples: <a href="desktop-example.html#x1741">desktop/desktop.cpp</a>, <a href="drawdemo-example.html#x1076">drawdemo/drawdemo.cpp</a>, <a href="qaxserver-example-multiple.html#x2547">multiple/ax2.h</a>, <a href="progress-example.html#x78">progress/progress.cpp</a>, <a href="tutorial1-09.html#x2344">t9/cannon.cpp</a>, <a href="themes-example.html#x288">themes/metal.cpp</a>, and <a href="themes-example.html#x222">themes/wood.cpp</a>.
|
|
<h3 class=fn>void <a name="setPen-2"></a>TQPainter::setPen ( <a href="ntqt.html#PenStyle-enum">PenStyle</a> style )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Sets the painter's pen to have style <em>style</em>, width 0 and black
|
|
color.
|
|
<p> <p>See also <a href="#pen">pen</a>() and <a href="ntqpen.html">TQPen</a>.
|
|
|
|
<h3 class=fn>void <a name="setPen-3"></a>TQPainter::setPen ( const <a href="ntqcolor.html">TQColor</a> & color )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Sets the painter's pen to have style <a href="ntqt.html#PenStyle-enum">SolidLine</a>, width 0 and the
|
|
specified <em>color</em>.
|
|
<p> <p>See also <a href="#pen">pen</a>() and <a href="ntqpen.html">TQPen</a>.
|
|
|
|
<h3 class=fn>void <a name="setRasterOp"></a>TQPainter::setRasterOp ( <a href="ntqt.html#RasterOp-enum">RasterOp</a> r )
|
|
</h3>
|
|
Sets the <a href="ntqt.html#RasterOp-enum">raster operation</a> to <em>r</em>.
|
|
The default is <a href="ntqt.html#RasterOp-enum">CopyROP</a>.
|
|
<p> <p>See also <a href="#rasterOp">rasterOp</a>() and <a href="ntqt.html#RasterOp-enum">TQt::RasterOp</a>.
|
|
|
|
<h3 class=fn>void <a name="setTabArray"></a>TQPainter::setTabArray ( int * ta )
|
|
</h3>
|
|
Sets the tab stop array to <em>ta</em>. This puts tab stops at <em>ta[0]</em>,
|
|
<em>ta[1]</em> and so on. The array is null-terminated.
|
|
<p> If both a tab array and a tab top size is set, the tab array wins.
|
|
<p> <p>See also <a href="#tabArray">tabArray</a>(), <a href="#setTabStops">setTabStops</a>(), <a href="#drawText">drawText</a>(), and <a href="#fontMetrics">fontMetrics</a>().
|
|
|
|
<h3 class=fn>void <a name="setTabStops"></a>TQPainter::setTabStops ( int ts )
|
|
</h3>
|
|
Set the tab stop width to <em>ts</em>, i.e. locates tab stops at <em>ts</em>,
|
|
2*<em>ts</em>, 3*<em>ts</em> and so on.
|
|
<p> Tab stops are used when drawing formatted text with <a href="ntqt.html#TextFlags-enum">ExpandTabs</a>
|
|
set. This fixed tab stop value is used only if no tab array is set
|
|
(which is the default case).
|
|
<p> A value of 0 (the default) implies a tabstop setting of 8 times the width of the
|
|
character 'x' in the font currently set on the painter.
|
|
<p> <p>See also <a href="#tabStops">tabStops</a>(), <a href="#setTabArray">setTabArray</a>(), <a href="#drawText">drawText</a>(), and <a href="#fontMetrics">fontMetrics</a>().
|
|
|
|
<h3 class=fn>void <a name="setViewXForm"></a>TQPainter::setViewXForm ( bool enable )
|
|
</h3>
|
|
Enables view transformations if <em>enable</em> is TRUE, or disables
|
|
view transformations if <em>enable</em> is FALSE.
|
|
<p> <p>See also <a href="#hasViewXForm">hasViewXForm</a>(), <a href="#setWindow">setWindow</a>(), <a href="#setViewport">setViewport</a>(), <a href="#setWorldMatrix">setWorldMatrix</a>(), <a href="#setWorldXForm">setWorldXForm</a>(), and <a href="#xForm">xForm</a>().
|
|
|
|
<h3 class=fn>void <a name="setViewport"></a>TQPainter::setViewport ( int x, int y, int w, int h )
|
|
</h3>
|
|
Sets the viewport rectangle view transformation for the painter
|
|
and enables view transformation.
|
|
<p> The viewport rectangle is part of the view transformation. The
|
|
viewport specifies the device coordinate system and is specified
|
|
by the <em>x</em>, <em>y</em>, <em>w</em> width and <em>h</em> height parameters. Its
|
|
sister, the <a href="#window">window</a>(), specifies the logical coordinate system.
|
|
<p> The default viewport rectangle is the same as the device's
|
|
rectangle. See the <a href="coordsys.html">Coordinate System Overview</a> for an overview of coordinate transformation.
|
|
<p> <p>See also <a href="#viewport">viewport</a>(), <a href="#setWindow">setWindow</a>(), <a href="#setViewXForm">setViewXForm</a>(), <a href="#setWorldMatrix">setWorldMatrix</a>(), <a href="#setWorldXForm">setWorldXForm</a>(), and <a href="#xForm">xForm</a>().
|
|
|
|
<p>Example: <a href="coordsys.html#x2276">aclock/aclock.cpp</a>.
|
|
<h3 class=fn>void <a name="setViewport-2"></a>TQPainter::setViewport ( const <a href="ntqrect.html">TQRect</a> & r )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Sets the painter's viewport to rectangle <em>r</em>.
|
|
|
|
<h3 class=fn>void <a name="setWindow"></a>TQPainter::setWindow ( int x, int y, int w, int h )
|
|
</h3>
|
|
Sets the window rectangle view transformation for the painter and
|
|
enables view transformation.
|
|
<p> The window rectangle is part of the view transformation. The
|
|
window specifies the logical coordinate system and is specified by
|
|
the <em>x</em>, <em>y</em>, <em>w</em> width and <em>h</em> height parameters. Its sister,
|
|
the <a href="#viewport">viewport</a>(), specifies the device coordinate system.
|
|
<p> The default window rectangle is the same as the device's
|
|
rectangle. See the <a href="coordsys.html">Coordinate System Overview</a> for an overview of coordinate transformation.
|
|
<p> <p>See also <a href="#window">window</a>(), <a href="#setViewport">setViewport</a>(), <a href="#setViewXForm">setViewXForm</a>(), <a href="#setWorldMatrix">setWorldMatrix</a>(), and <a href="#setWorldXForm">setWorldXForm</a>().
|
|
|
|
<p>Examples: <a href="coordsys.html#x2277">aclock/aclock.cpp</a> and <a href="drawdemo-example.html#x1077">drawdemo/drawdemo.cpp</a>.
|
|
<h3 class=fn>void <a name="setWindow-2"></a>TQPainter::setWindow ( const <a href="ntqrect.html">TQRect</a> & r )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Sets the painter's window to rectangle <em>r</em>.
|
|
|
|
<h3 class=fn>void <a name="setWorldMatrix"></a>TQPainter::setWorldMatrix ( const <a href="ntqwmatrix.html">TQWMatrix</a> & m, bool combine = FALSE )
|
|
</h3>
|
|
Sets the world <a href="ntqwmatrix.html#TransformationMode">transformation matrix</a> to <em>m</em> and enables world
|
|
transformation.
|
|
<p> If <em>combine</em> is TRUE, then <em>m</em> is combined with the current
|
|
transformation matrix, otherwise <em>m</em> replaces the current
|
|
transformation matrix.
|
|
<p> If <em>m</em> is the identity matrix and <em>combine</em> is FALSE, this
|
|
function calls <a href="#setWorldXForm">setWorldXForm</a>(FALSE). (The identity matrix is the
|
|
matrix where <a href="ntqwmatrix.html#m11">TQWMatrix::m11</a>() and <a href="ntqwmatrix.html#m22">TQWMatrix::m22</a>() are 1.0 and the
|
|
rest are 0.0.)
|
|
<p> World transformations are applied after the view transformations
|
|
(i.e. <a href="#setWindow">window</a> and <a href="#setViewport">viewport</a>).
|
|
<p> The following functions can transform the coordinate system without using
|
|
a TQWMatrix:
|
|
<ul>
|
|
<li> <a href="#translate">translate</a>()
|
|
<li> <a href="#scale">scale</a>()
|
|
<li> <a href="#shear">shear</a>()
|
|
<li> <a href="#rotate">rotate</a>()
|
|
</ul>
|
|
<p> They operate on the painter's <a href="#worldMatrix">worldMatrix</a>() and are implemented like this:
|
|
<p> <pre>
|
|
void TQPainter::rotate( double a )
|
|
{
|
|
<a href="ntqwmatrix.html">TQWMatrix</a> m;
|
|
m.<a href="ntqwmatrix.html#rotate">rotate</a>( a );
|
|
<a href="#setWorldMatrix">setWorldMatrix</a>( m, TRUE );
|
|
}
|
|
</pre>
|
|
|
|
<p> Note that you should always use <em>combine</em> when you are drawing
|
|
into a <a href="ntqpicture.html">TQPicture</a>. Otherwise it may not be possible to replay the
|
|
picture with additional transformations. Using translate(),
|
|
scale(), etc., is safe.
|
|
<p> For a brief overview of coordinate transformation, see the <a href="coordsys.html">Coordinate System Overview.</a>
|
|
<p> <p>See also <a href="#worldMatrix">worldMatrix</a>(), <a href="#setWorldXForm">setWorldXForm</a>(), <a href="#setWindow">setWindow</a>(), <a href="#setViewport">setViewport</a>(), <a href="#setViewXForm">setViewXForm</a>(), <a href="#xForm">xForm</a>(), and <a href="ntqwmatrix.html">TQWMatrix</a>.
|
|
|
|
<p>Examples: <a href="drawdemo-example.html#x1078">drawdemo/drawdemo.cpp</a> and <a href="xform-example.html#x1242">xform/xform.cpp</a>.
|
|
<h3 class=fn>void <a name="setWorldXForm"></a>TQPainter::setWorldXForm ( bool enable )
|
|
</h3>
|
|
Enables world transformations if <em>enable</em> is TRUE, or disables
|
|
world transformations if <em>enable</em> is FALSE. The world
|
|
<a href="ntqwmatrix.html#TransformationMode">transformation matrix</a> is not changed.
|
|
<p> <p>See also <a href="#setWorldMatrix">setWorldMatrix</a>(), <a href="#setWindow">setWindow</a>(), <a href="#setViewport">setViewport</a>(), <a href="#setViewXForm">setViewXForm</a>(), and <a href="#xForm">xForm</a>().
|
|
|
|
<h3 class=fn>void <a name="shear"></a>TQPainter::shear ( double sh, double sv )
|
|
</h3>
|
|
Shears the coordinate system by <em>(sh, sv)</em>.
|
|
<p> <p>See also <a href="#translate">translate</a>(), <a href="#scale">scale</a>(), <a href="#rotate">rotate</a>(), <a href="#resetXForm">resetXForm</a>(), <a href="#setWorldMatrix">setWorldMatrix</a>(), and <a href="#xForm">xForm</a>().
|
|
|
|
<h3 class=fn>int * <a name="tabArray"></a>TQPainter::tabArray () const
|
|
</h3>
|
|
|
|
<p> Returns the currently set tab stop array.
|
|
<p> <p>See also <a href="#setTabArray">setTabArray</a>().
|
|
|
|
<h3 class=fn>int <a name="tabStops"></a>TQPainter::tabStops () const
|
|
</h3>
|
|
|
|
<p> Returns the tab stop setting.
|
|
<p> <p>See also <a href="#setTabStops">setTabStops</a>().
|
|
|
|
<h3 class=fn>void <a name="translate"></a>TQPainter::translate ( double dx, double dy )
|
|
</h3>
|
|
Translates the coordinate system by <em>(dx, dy)</em>. After this call,
|
|
<em>(dx, dy)</em> is added to points.
|
|
<p> For example, the following code draws the same point twice:
|
|
<pre>
|
|
void MyWidget::paintEvent()
|
|
{
|
|
TQPainter paint( this );
|
|
|
|
paint.<a href="#drawPoint">drawPoint</a>( 0, 0 );
|
|
|
|
paint.<a href="#translate">translate</a>( 100.0, 40.0 );
|
|
paint.<a href="#drawPoint">drawPoint</a>( -100, -40 );
|
|
}
|
|
</pre>
|
|
|
|
<p> <p>See also <a href="#scale">scale</a>(), <a href="#shear">shear</a>(), <a href="#rotate">rotate</a>(), <a href="#resetXForm">resetXForm</a>(), <a href="#setWorldMatrix">setWorldMatrix</a>(), and <a href="#xForm">xForm</a>().
|
|
|
|
<p>Examples: <a href="qaction-application-example.html#x1148">action/application.cpp</a>, <a href="simple-application-example.html#x1566">application/application.cpp</a>, <a href="tutorial1-10.html#x2356">t10/cannon.cpp</a>, <a href="tutorial1-09.html#x2345">t9/cannon.cpp</a>, <a href="themes-example.html#x289">themes/metal.cpp</a>, <a href="themes-example.html#x223">themes/wood.cpp</a>, and <a href="xform-example.html#x1243">xform/xform.cpp</a>.
|
|
<h3 class=fn><a href="ntqrect.html">TQRect</a> <a name="viewport"></a>TQPainter::viewport () const
|
|
</h3>
|
|
Returns the viewport rectangle.
|
|
<p> <p>See also <a href="#setViewport">setViewport</a>() and <a href="#setViewXForm">setViewXForm</a>().
|
|
|
|
<p>Example: <a href="coordsys.html#x2278">aclock/aclock.cpp</a>.
|
|
<h3 class=fn><a href="ntqrect.html">TQRect</a> <a name="window"></a>TQPainter::window () const
|
|
</h3>
|
|
Returns the window rectangle.
|
|
<p> <p>See also <a href="#setWindow">setWindow</a>() and <a href="#setViewXForm">setViewXForm</a>().
|
|
|
|
<h3 class=fn>const <a href="ntqwmatrix.html">TQWMatrix</a> & <a name="worldMatrix"></a>TQPainter::worldMatrix () const
|
|
</h3>
|
|
Returns the world <a href="ntqwmatrix.html#TransformationMode">transformation matrix</a>.
|
|
<p> <p>See also <a href="#setWorldMatrix">setWorldMatrix</a>().
|
|
|
|
<h3 class=fn><a href="ntqpoint.html">TQPoint</a> <a name="xForm"></a>TQPainter::xForm ( const <a href="ntqpoint.html">TQPoint</a> & pv ) const
|
|
</h3>
|
|
Returns the point <em>pv</em> transformed from model coordinates to
|
|
device coordinates.
|
|
<p> <p>See also <a href="#xFormDev">xFormDev</a>() and <a href="ntqwmatrix.html#map">TQWMatrix::map</a>().
|
|
|
|
<h3 class=fn><a href="ntqrect.html">TQRect</a> <a name="xForm-2"></a>TQPainter::xForm ( const <a href="ntqrect.html">TQRect</a> & rv ) const
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Returns the rectangle <em>rv</em> transformed from model coordinates to
|
|
device coordinates.
|
|
<p> If world transformation is enabled and rotation or shearing has
|
|
been specified, then the bounding rectangle is returned.
|
|
<p> <p>See also <a href="#xFormDev">xFormDev</a>() and <a href="ntqwmatrix.html#map">TQWMatrix::map</a>().
|
|
|
|
<h3 class=fn><a href="ntqpointarray.html">TQPointArray</a> <a name="xForm-3"></a>TQPainter::xForm ( const <a href="ntqpointarray.html">TQPointArray</a> & av ) const
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Returns the point array <em>av</em> transformed from model coordinates
|
|
to device coordinates.
|
|
<p> <p>See also <a href="#xFormDev">xFormDev</a>() and <a href="ntqwmatrix.html#map">TQWMatrix::map</a>().
|
|
|
|
<h3 class=fn><a href="ntqpointarray.html">TQPointArray</a> <a name="xForm-4"></a>TQPainter::xForm ( const <a href="ntqpointarray.html">TQPointArray</a> & av, int index, int npoints ) const
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Returns the point array <em>av</em> transformed from model coordinates
|
|
to device coordinates. The <em>index</em> is the first point in the
|
|
array and <em>npoints</em> denotes the number of points to be
|
|
transformed. If <em>npoints</em> is negative, all points from <em>av[index]</em> until the last point in the array are transformed.
|
|
<p> The returned point array consists of the number of points that
|
|
were transformed.
|
|
<p> Example:
|
|
<pre>
|
|
<a href="ntqpointarray.html">TQPointArray</a> a(10);
|
|
<a href="ntqpointarray.html">TQPointArray</a> b;
|
|
b = painter.xForm(a, 2, 4); // b.<a href="ntqmemarray.html#size">size</a>() == 4
|
|
b = painter.xForm(a, 2, -1); // b.<a href="ntqmemarray.html#size">size</a>() == 8
|
|
</pre>
|
|
|
|
<p> <p>See also <a href="#xFormDev">xFormDev</a>() and <a href="ntqwmatrix.html#map">TQWMatrix::map</a>().
|
|
|
|
<h3 class=fn><a href="ntqrect.html">TQRect</a> <a name="xFormDev"></a>TQPainter::xFormDev ( const <a href="ntqrect.html">TQRect</a> & rd ) const
|
|
</h3>
|
|
Returns the rectangle <em>rd</em> transformed from device coordinates to
|
|
model coordinates.
|
|
<p> If world transformation is enabled and rotation or shearing is
|
|
used, then the bounding rectangle is returned.
|
|
<p> <p>See also <a href="#xForm">xForm</a>() and <a href="ntqwmatrix.html#map">TQWMatrix::map</a>().
|
|
|
|
<h3 class=fn><a href="ntqpoint.html">TQPoint</a> <a name="xFormDev-2"></a>TQPainter::xFormDev ( const <a href="ntqpoint.html">TQPoint</a> & pd ) const
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Returns the point <em>pd</em> transformed from device coordinates to
|
|
model coordinates.
|
|
<p> <p>See also <a href="#xForm">xForm</a>() and <a href="ntqwmatrix.html#map">TQWMatrix::map</a>().
|
|
|
|
<h3 class=fn><a href="ntqpointarray.html">TQPointArray</a> <a name="xFormDev-3"></a>TQPainter::xFormDev ( const <a href="ntqpointarray.html">TQPointArray</a> & ad ) const
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Returns the point array <em>ad</em> transformed from device coordinates
|
|
to model coordinates.
|
|
<p> <p>See also <a href="#xForm">xForm</a>() and <a href="ntqwmatrix.html#map">TQWMatrix::map</a>().
|
|
|
|
<h3 class=fn><a href="ntqpointarray.html">TQPointArray</a> <a name="xFormDev-4"></a>TQPainter::xFormDev ( const <a href="ntqpointarray.html">TQPointArray</a> & ad, int index, int npoints ) const
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Returns the point array <em>ad</em> transformed from device coordinates
|
|
to model coordinates. The <em>index</em> is the first point in the array
|
|
and <em>npoints</em> denotes the number of points to be transformed. If
|
|
<em>npoints</em> is negative, all points from <em>ad[index]</em> until the
|
|
last point in the array are transformed.
|
|
<p> The returned point array consists of the number of points that
|
|
were transformed.
|
|
<p> Example:
|
|
<pre>
|
|
<a href="ntqpointarray.html">TQPointArray</a> a(10);
|
|
<a href="ntqpointarray.html">TQPointArray</a> b;
|
|
b = painter.xFormDev(a, 1, 3); // b.<a href="ntqmemarray.html#size">size</a>() == 3
|
|
b = painter.xFormDev(a, 1, -1); // b.<a href="ntqmemarray.html#size">size</a>() == 9
|
|
</pre>
|
|
|
|
<p> <p>See also <a href="#xForm">xForm</a>() and <a href="ntqwmatrix.html#map">TQWMatrix::map</a>().
|
|
|
|
<hr><h2>Related Functions</h2>
|
|
<h3 class=fn>void <a name="qDrawPlainRect"></a>qDrawPlainRect ( <a href="ntqpainter.html">TQPainter</a> * p, int x, int y, int w, int h, const <a href="ntqcolor.html">TQColor</a> & c, int lineWidth, const <a href="ntqbrush.html">TQBrush</a> * fill )
|
|
</h3>
|
|
|
|
<p> <tt>#include <ntqdrawutil.h></tt>
|
|
<p> Draws the plain rectangle specified by (<em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>)
|
|
using the painter <em>p</em>.
|
|
<p> The color argument <em>c</em> specifies the line color.
|
|
<p> The <em>lineWidth</em> argument specifies the line width.
|
|
<p> The rectangle's interior is filled with the <em>fill</em> brush unless
|
|
<em>fill</em> is 0.
|
|
<p> If you want to use a <a href="ntqframe.html">TQFrame</a> widget instead, you can make it
|
|
display a plain rectangle, for example <tt>TQFrame::setFrameStyle( TQFrame::Box | TQFrame::Plain )</tt>.
|
|
<p> <b>Warning:</b> This function does not look at <a href="tqwidget.html#style">TQWidget::style</a>() or
|
|
<a href="ntqapplication.html#style">TQApplication::style</a>(). Use the drawing functions in <a href="ntqstyle.html">TQStyle</a> to make
|
|
widgets that follow the current GUI style.
|
|
<p> <p>See also <a href="#qDrawShadeRect">qDrawShadeRect</a>() and <a href="ntqstyle.html#drawPrimitive">TQStyle::drawPrimitive</a>().
|
|
|
|
<h3 class=fn>void <a name="qDrawShadeLine"></a>qDrawShadeLine ( <a href="ntqpainter.html">TQPainter</a> * p, int x1, int y1, int x2, int y2, const <a href="qcolorgroup.html">TQColorGroup</a> & g, bool sunken, int lineWidth, int midLineWidth )
|
|
</h3>
|
|
|
|
<p> <tt>#include <ntqdrawutil.h></tt>
|
|
<p> Draws a horizontal (<em>y1</em> == <em>y2</em>) or vertical (<em>x1</em> == <em>x2</em>)
|
|
shaded line using the painter <em>p</em>.
|
|
<p> Nothing is drawn if <em>y1</em> != <em>y2</em> and <em>x1</em> != <em>x2</em> (i.e. the
|
|
line is neither horizontal nor vertical).
|
|
<p> The color group argument <em>g</em> specifies the shading colors (<a href="qcolorgroup.html#light">light</a>, <a href="qcolorgroup.html#dark">dark</a> and <a href="qcolorgroup.html#mid">middle</a> colors).
|
|
<p> The line appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is FALSE.
|
|
<p> The <em>lineWidth</em> argument specifies the line width for each of the
|
|
lines. It is not the total line width.
|
|
<p> The <em>midLineWidth</em> argument specifies the width of a middle line
|
|
drawn in the <a href="qcolorgroup.html#mid">TQColorGroup::mid</a>() color.
|
|
<p> If you want to use a <a href="ntqframe.html">TQFrame</a> widget instead, you can make it
|
|
display a shaded line, for example <tt>TQFrame::setFrameStyle( TQFrame::HLine | TQFrame::Sunken )</tt>.
|
|
<p> <b>Warning:</b> This function does not look at <a href="tqwidget.html#style">TQWidget::style</a>() or
|
|
<a href="ntqapplication.html#style">TQApplication::style</a>(). Use the drawing functions in <a href="ntqstyle.html">TQStyle</a> to make
|
|
widgets that follow the current GUI style.
|
|
<p> <p>See also <a href="#qDrawShadeRect">qDrawShadeRect</a>(), <a href="#qDrawShadePanel">qDrawShadePanel</a>(), and <a href="ntqstyle.html#drawPrimitive">TQStyle::drawPrimitive</a>().
|
|
|
|
<h3 class=fn>void <a name="qDrawShadePanel"></a>qDrawShadePanel ( <a href="ntqpainter.html">TQPainter</a> * p, int x, int y, int w, int h, const <a href="qcolorgroup.html">TQColorGroup</a> & g, bool sunken, int lineWidth, const <a href="ntqbrush.html">TQBrush</a> * fill )
|
|
</h3>
|
|
|
|
<p> <tt>#include <ntqdrawutil.h></tt>
|
|
<p> Draws the shaded panel specified by (<em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>) using
|
|
the painter <em>p</em>.
|
|
<p> The color group argument <em>g</em> specifies the shading colors (<a href="qcolorgroup.html#light">light</a>, <a href="qcolorgroup.html#dark">dark</a> and <a href="qcolorgroup.html#mid">middle</a> colors).
|
|
<p> The panel appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is FALSE.
|
|
<p> The <em>lineWidth</em> argument specifies the line width.
|
|
<p> The panel's interior is filled with the <em>fill</em> brush unless <em>fill</em> is 0.
|
|
<p> If you want to use a <a href="ntqframe.html">TQFrame</a> widget instead, you can make it
|
|
display a shaded panel, for example <tt>TQFrame::setFrameStyle( TQFrame::Panel | TQFrame::Sunken )</tt>.
|
|
<p> <b>Warning:</b> This function does not look at <a href="tqwidget.html#style">TQWidget::style</a>() or
|
|
<a href="ntqapplication.html#style">TQApplication::style</a>(). Use the drawing functions in <a href="ntqstyle.html">TQStyle</a> to make
|
|
widgets that follow the current GUI style.
|
|
<p> <p>See also <a href="#qDrawWinPanel">qDrawWinPanel</a>(), <a href="#qDrawShadeLine">qDrawShadeLine</a>(), <a href="#qDrawShadeRect">qDrawShadeRect</a>(), and <a href="ntqstyle.html#drawPrimitive">TQStyle::drawPrimitive</a>().
|
|
|
|
<h3 class=fn>void <a name="qDrawShadeRect"></a>qDrawShadeRect ( <a href="ntqpainter.html">TQPainter</a> * p, int x, int y, int w, int h, const <a href="qcolorgroup.html">TQColorGroup</a> & g, bool sunken, int lineWidth, int midLineWidth, const <a href="ntqbrush.html">TQBrush</a> * fill )
|
|
</h3>
|
|
|
|
<p> <tt>#include <ntqdrawutil.h></tt>
|
|
<p> Draws the shaded rectangle specified by (<em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>)
|
|
using the painter <em>p</em>.
|
|
<p> The color group argument <em>g</em> specifies the shading colors (<a href="qcolorgroup.html#light">light</a>, <a href="qcolorgroup.html#dark">dark</a> and <a href="qcolorgroup.html#mid">middle</a> colors).
|
|
<p> The rectangle appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is FALSE.
|
|
<p> The <em>lineWidth</em> argument specifies the line width for each of the
|
|
lines. It is not the total line width.
|
|
<p> The <em>midLineWidth</em> argument specifies the width of a middle line
|
|
drawn in the <a href="qcolorgroup.html#mid">TQColorGroup::mid</a>() color.
|
|
<p> The rectangle's interior is filled with the <em>fill</em> brush unless
|
|
<em>fill</em> is 0.
|
|
<p> If you want to use a <a href="ntqframe.html">TQFrame</a> widget instead, you can make it
|
|
display a shaded rectangle, for example <tt>TQFrame::setFrameStyle( TQFrame::Box | TQFrame::Raised )</tt>.
|
|
<p> <b>Warning:</b> This function does not look at <a href="tqwidget.html#style">TQWidget::style</a>() or
|
|
<a href="ntqapplication.html#style">TQApplication::style</a>(). Use the drawing functions in <a href="ntqstyle.html">TQStyle</a> to make
|
|
widgets that follow the current GUI style.
|
|
<p> <p>See also <a href="#qDrawShadeLine">qDrawShadeLine</a>(), <a href="#qDrawShadePanel">qDrawShadePanel</a>(), <a href="#qDrawPlainRect">qDrawPlainRect</a>(), <a href="ntqstyle.html#drawItem">TQStyle::drawItem</a>(), <a href="ntqstyle.html#drawControl">TQStyle::drawControl</a>(), and <a href="ntqstyle.html#drawComplexControl">TQStyle::drawComplexControl</a>().
|
|
|
|
<h3 class=fn>void <a name="qDrawWinButton"></a>qDrawWinButton ( <a href="ntqpainter.html">TQPainter</a> * p, int x, int y, int w, int h, const <a href="qcolorgroup.html">TQColorGroup</a> & g, bool sunken, const <a href="ntqbrush.html">TQBrush</a> * fill )
|
|
</h3>
|
|
|
|
<p> <tt>#include <ntqdrawutil.h></tt>
|
|
<p> Draws the Windows-style button specified by (<em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>) using the painter <em>p</em>.
|
|
<p> The color group argument <em>g</em> specifies the shading colors (<a href="qcolorgroup.html#light">light</a>, <a href="qcolorgroup.html#dark">dark</a> and <a href="qcolorgroup.html#mid">middle</a> colors).
|
|
<p> The button appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is FALSE.
|
|
<p> The line width is 2 pixels.
|
|
<p> The button's interior is filled with the <em>*fill</em> brush unless <em>fill</em> is 0.
|
|
<p> <b>Warning:</b> This function does not look at <a href="tqwidget.html#style">TQWidget::style</a>() or
|
|
<a href="ntqapplication.html#style">TQApplication::style</a>(). Use the drawing functions in <a href="ntqstyle.html">TQStyle</a> to make
|
|
widgets that follow the current GUI style.
|
|
<p> <p>See also <a href="#qDrawWinPanel">qDrawWinPanel</a>() and <a href="ntqstyle.html#drawControl">TQStyle::drawControl</a>().
|
|
|
|
<h3 class=fn>void <a name="qDrawWinPanel"></a>qDrawWinPanel ( <a href="ntqpainter.html">TQPainter</a> * p, int x, int y, int w, int h, const <a href="qcolorgroup.html">TQColorGroup</a> & g, bool sunken, const <a href="ntqbrush.html">TQBrush</a> * fill )
|
|
</h3>
|
|
|
|
<p> <tt>#include <ntqdrawutil.h></tt>
|
|
<p> Draws the Windows-style panel specified by (<em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>) using the painter <em>p</em>.
|
|
<p> The color group argument <em>g</em> specifies the shading colors.
|
|
<p> The panel appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is FALSE.
|
|
<p> The line width is 2 pixels.
|
|
<p> The button's interior is filled with the <em>fill</em> brush unless <em>fill</em> is 0.
|
|
<p> If you want to use a <a href="ntqframe.html">TQFrame</a> widget instead, you can make it
|
|
display a shaded panel, for example <tt>TQFrame::setFrameStyle( TQFrame::WinPanel | TQFrame::Raised )</tt>.
|
|
<p> <b>Warning:</b> This function does not look at <a href="tqwidget.html#style">TQWidget::style</a>() or
|
|
<a href="ntqapplication.html#style">TQApplication::style</a>(). Use the drawing functions in <a href="ntqstyle.html">TQStyle</a> to make
|
|
widgets that follow the current GUI style.
|
|
<p> <p>See also <a href="#qDrawShadePanel">qDrawShadePanel</a>(), <a href="#qDrawWinButton">qDrawWinButton</a>(), and <a href="ntqstyle.html#drawPrimitive">TQStyle::drawPrimitive</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>
|