From ea318d1431c89e647598c510c4245c6571aa5f46 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 26 Jan 2012 23:32:43 -0600 Subject: Update to latest tqt3 automated conversion --- doc/html/ntqpainter.html | 1626 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1626 insertions(+) create mode 100644 doc/html/ntqpainter.html (limited to 'doc/html/ntqpainter.html') diff --git a/doc/html/ntqpainter.html b/doc/html/ntqpainter.html new file mode 100644 index 000000000..c9ab96488 --- /dev/null +++ b/doc/html/ntqpainter.html @@ -0,0 +1,1626 @@ + + + + + +TQPainter Class + + + + + + + +
+ +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

TQPainter Class Reference

+ +

The TQPainter class does low-level painting e.g. on widgets. +More... +

#include <ntqpainter.h> +

Inherits TQt. +

Inherited by TQDirectPainter. +

List of all member functions. +

Public Members

+ +

Static Public Members

+ +

Related Functions

+ +

Detailed Description

+ + +The TQPainter class does low-level painting e.g. on widgets. +

+ + +

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. +

The typical use of a painter is: +

+

Mostly, all this is done inside a paint event. (In fact, 99% of +all TQPainter use is in a reimplementation of +TQWidget::paintEvent(), and the painter is heavily optimized for +such use.) Here's one very simple example: +

+    void SimpleExampleWidget::paintEvent()
+    {
+        TQPainter paint( this );
+        paint.setPen( TQt::blue );
+        paint.drawText( rect(), AlignCenter, "The Text" );
+    }
+    
+ +

Usage is simple, and there are many settings you can use: +

+

Note that some of these settings mirror settings in some paint +devices, e.g. TQWidget::font(). TQPainter::begin() (or the TQPainter +constructor) copies these attributes from the paint device. +Calling, for example, TQWidget::setFont() doesn't take effect until +the next time a painter begins painting on it. +

save() saves all of these settings on an internal stack, restore() +pops them back. +

The core functionality of TQPainter is drawing, and there are +functions to draw most primitives: drawPoint(), drawPoints(), +drawLine(), drawRect(), drawWinFocusRect(), drawRoundRect(), +drawEllipse(), drawArc(), drawPie(), drawChord(), +drawLineSegments(), drawPolyline(), drawPolygon(), +drawConvexPolygon() and drawCubicBezier(). All of these functions +take integer coordinates; there are no floating-point versions +since we want drawing to be as fast as possible. +

There are functions to draw pixmaps/images, namely drawPixmap(), +drawImage() and drawTiledPixmap(). drawPixmap() and drawImage() +produce the same result, except that drawPixmap() is faster +on-screen and drawImage() faster and sometimes better on TQPrinter +and TQPicture. +

Text drawing is done using drawText(), and when you need +fine-grained positioning, boundingRect() tells you where a given +drawText() command would draw. +

There is a drawPicture() 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. +

Normally, the TQPainter operates on the device's own coordinate +system (usually pixels), but TQPainter has good support for +coordinate transformation. See The Coordinate + System for a more general overview and a simple example. +

The most common functions used are scale(), rotate(), translate() +and shear(), all of which operate on the worldMatrix(). +setWorldMatrix() can replace or add to the currently set +worldMatrix(). +

setViewport() sets the rectangle on which TQPainter operates. The +default is the entire device, which is usually fine, except on +printers. setWindow() sets the coordinate system, that is, the +rectangle that maps to viewport(). What's drawn inside the +window() 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. +

After all the coordinate transformation is done, TQPainter can clip +the drawing to an arbitrary rectangle or region. hasClipping() is +TRUE if TQPainter clips, and clipRegion() returns the clip region. +You can set it using either setClipRegion() or setClipRect(). +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. +

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(). +

TQPainter also includes some less-used functions that are very +useful on those occasions when they're needed. +

isActive() indicates whether the painter is active. begin() (and +the most usual constructor) makes it active. end() (and the +destructor) deactivates it. If the painter is active, device() +returns the paint device on which the painter paints. +

Sometimes it is desirable to make someone else paint on an unusual +TQPaintDevice. TQPainter supports a static function to do this, +redirect(). We recommend not using it, but for some hacks it's +perfect. +

setTabStops() and setTabArray() can change where the tab stops +are, but these are very seldomly used. +

Warning: 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. + +

See also TQPaintDevice, TQWidget, TQPixmap, TQPrinter, TQPicture, Application Walkthrough, Coordinate System Overview, Graphics Classes, and Image Processing Classes. + +


Member Type Documentation

+

TQPainter::CoordinateMode

+ +

See also clipRegion(). + +

TQPainter::TextDirection

+ +

See also drawText(). + +


Member Function Documentation

+

TQPainter::TQPainter () +

+Constructs a painter. +

Notice that all painter settings (setPen, setBrush etc.) are reset +to default values when begin() is called. +

See also begin() and end(). + +

TQPainter::TQPainter ( const TQPaintDevice * pd, bool unclipped = FALSE ) +

+Constructs a painter that begins painting the paint device pd +immediately. Depending on the underlying graphic system the +painter will paint over children of the paintdevice if unclipped is TRUE. +

This constructor is convenient for short-lived painters, e.g. in a +paint event and should be used +only once. The constructor calls begin() for you and the TQPainter +destructor automatically calls end(). +

Here's an example using begin() and end(): +

+        void MyWidget::paintEvent( TQPaintEvent * )
+        {
+            TQPainter p;
+            p.begin( this );
+            p.drawLine( ... );  // drawing code
+            p.end();
+        }
+    
+ +

The same example using this constructor: +

+        void MyWidget::paintEvent( TQPaintEvent * )
+        {
+            TQPainter p( this );
+            p.drawLine( ... );  // drawing code
+        }
+    
+ +

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. +

See also begin() and end(). + +

TQPainter::TQPainter ( const TQPaintDevice * pd, const TQWidget * copyAttributes, bool unclipped = FALSE ) +

+Constructs a painter that begins painting the paint device pd +immediately, with the default arguments taken from copyAttributes. The painter will paint over children of the paint +device if unclipped is TRUE (although this is not supported on +all platforms). +

See also begin(). + +

TQPainter::~TQPainter () +

+Destroys the painter. + +

const TQColor & TQPainter::backgroundColor () const +

+ +

Returns the current background color. +

See also setBackgroundColor() and TQColor. + +

BGMode TQPainter::backgroundMode () const +

+ +

Returns the current background mode. +

See also setBackgroundMode() and BGMode. + +

bool TQPainter::begin ( const TQPaintDevice * pd, bool unclipped = FALSE ) +

+Begins painting the paint device pd and returns TRUE if +successful; otherwise returns FALSE. If unclipped is TRUE, the +painting will not be clipped at the paint device's boundaries, +(although this is not supported by all platforms). +

The errors that can occur are serious problems, such as these: +

+        p->begin( 0 ); // impossible - paint device cannot be 0
+
+        TQPixmap pm( 0, 0 );
+        p->begin( pm ); // impossible - pm.isNull();
+
+        p->begin( myWidget );
+        p2->begin( myWidget ); // impossible - only one painter at a time
+    
+ +

Note that most of the time, you can use one of the constructors +instead of begin(), and that end() is automatically done at +destruction. +

Warning: A paint device can only be painted by one painter at a +time. +

See also end() and flush(). + +

Examples: aclock/aclock.cpp, desktop/desktop.cpp, drawdemo/drawdemo.cpp, hello/hello.cpp, picture/picture.cpp, t10/cannon.cpp, and xform/xform.cpp. +

bool TQPainter::begin ( const TQPaintDevice * pd, const TQWidget * copyAttributes, bool unclipped = FALSE ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

This version opens the painter on a paint device pd and sets +the initial pen, background color and font from copyAttributes, +painting over the paint device's children when unclipped is +TRUE. This is equivalent to: +

+        TQPainter p;
+        p.begin( pd );
+        p.setPen( copyAttributes->foregroundColor() );
+        p.setBackgroundColor( copyAttributes->backgroundColor() );
+        p.setFont( copyAttributes->font() );
+    
+ +

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. +

Example: +

+        void MyWidget::paintEvent( TQPaintEvent * )
+        {
+            TQPixmap pm(size());
+            TQPainter p;
+            p.begin(&pm, this);
+            // ... potentially flickering paint operation ...
+            p.end();
+            bitBlt(this, 0, 0, &pm);
+        }
+    
+ +

See also end(). + +

TQRect TQPainter::boundingRect ( int x, int y, int w, int h, int flags, const TQString &, int len = -1, TQTextParag ** intern = 0 ) +

+ +

Returns the bounding rectangle of the aligned text that would be +printed with the corresponding drawText() function using the first +len characters of the string if len is > -1, or the whole of +the string if len is -1. The drawing, and hence the bounding +rectangle, is constrained to the rectangle that begins at point (x, y) with width w and hight h, or to the +rectangle required to draw the text, whichever is the larger. +

The flags argument is +the bitwise OR of the following flags: +

+
Flag Meaning +
AlignAuto aligns according to the language, usually left. +
AlignLeft aligns to the left border. +
AlignRight aligns to the right border. +
AlignHCenter aligns horizontally centered. +
AlignTop aligns to the top border. +
AlignBottom aligns to the bottom border. +
AlignVCenter aligns vertically centered. +
AlignCenter (== AlignHCenter | AlignVCenter). +
SingleLine ignores newline characters in the text. +
ExpandTabs expands tabs. +
ShowPrefix interprets "&x" as "x". +
WordBreak breaks the text to fit the rectangle. +
+

Horizontal alignment defaults to AlignLeft and vertical +alignment defaults to AlignTop. +

If several of the horizontal or several of the vertical alignment flags +are set, the resulting alignment is undefined. +

The intern parameter should not be used. +

See also TQt::TextFlags. + +

TQRect TQPainter::boundingRect ( const TQRect & r, int flags, const TQString & str, int len = -1, TQTextParag ** internal = 0 ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Returns the bounding rectangle of the aligned text that would be +printed with the corresponding drawText() function using the first +len characters from str if len is > -1, or the whole of +str if len is -1. The drawing, and hence the bounding +rectangle, is constrained to the rectangle r, or to the +rectangle required to draw the text, whichever is the larger. +

The internal parameter should not be used. +

See also drawText(), fontMetrics(), TQFontMetrics::boundingRect(), and TQt::TextFlags. + +

const TQBrush & TQPainter::brush () const +

+ +

Returns the painter's current brush. +

See also TQPainter::setBrush(). + +

Examples: themes/metal.cpp and themes/wood.cpp. +

const TQPoint & TQPainter::brushOrigin () const +

+ +

Returns the brush origin currently set. +

See also setBrushOrigin(). + +

TQRegion TQPainter::clipRegion ( CoordinateMode m = CoordDevice ) const +

+Returns the currently set clip region. Note that the clip region +is given in physical device coordinates and not subject to any +coordinate transformation if m is +equal to CoordDevice (the default). If m equals CoordPainter the returned region is in model coordinates. +

See also setClipRegion(), setClipRect(), setClipping(), and TQPainter::CoordinateMode. + +

Example: themes/wood.cpp. +

TQPaintDevice * TQPainter::device () const +

+ +

Returns the paint device on which this painter is currently +painting, or 0 if the painter is not active. +

See also TQPaintDevice::paintingActive(). + +

Examples: action/application.cpp, application/application.cpp, helpviewer/helpwindow.cpp, listboxcombo/listboxcombo.cpp, and mdi/application.cpp. +

void TQPainter::drawArc ( int x, int y, int w, int h, int a, int alen ) +

+Draws an arc defined by the rectangle (x, y, w, h), the start +angle a and the arc length alen. +

The angles a and alen are 1/16th of a degree, i.e. a full +circle equals 5760 (16*360). Positive values of a and alen +mean counter-clockwise while negative values mean the clockwise +direction. Zero degrees is at the 3 o'clock position. +

Example: +

+        TQPainter p( myWidget );
+        p.drawArc( 10,10, 70,100, 100*16, 160*16 ); // draws a "(" arc
+    
+ +

See also drawPie() and drawChord(). + +

void TQPainter::drawArc ( const TQRect & r, int a, int alen ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws the arc that fits inside the rectangle r with start angle +a and arc length alen. + +

void TQPainter::drawChord ( int x, int y, int w, int h, int a, int alen ) +

+Draws a chord defined by the rectangle (x, y, w, h), the start +angle a and the arc length alen. +

The chord is filled with the current brush(). +

The angles a and alen are 1/16th of a degree, i.e. a full +circle equals 5760 (16*360). Positive values of a and alen +mean counter-clockwise while negative values mean the clockwise +direction. Zero degrees is at the 3 o'clock position. +

See also drawArc() and drawPie(). + +

void TQPainter::drawChord ( const TQRect & r, int a, int alen ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws a chord that fits inside the rectangle r with start angle +a and arc length alen. + +

void TQPainter::drawConvexPolygon ( const TQPointArray & pa, int index = 0, int npoints = -1 ) +

+Draws the convex polygon defined by the npoints points in pa +starting at pa[index] (index defaults to 0). +

If the supplied polygon is not convex, the results are undefined. +

On some platforms (e.g. X Window), this is faster than +drawPolygon(). +

Warning: On X11, coordinates that do not fit into 16-bit signed +values are truncated. This limitation is expected to go away in +TQt 4. + +

Example: aclock/aclock.cpp. +

void TQPainter::drawCubicBezier ( const TQPointArray & a, int index = 0 ) +

+Draws a cubic Bezier curve defined by the control points in a, +starting at a[index] (index defaults to 0). +

Control points after a[index + 3] are ignored. Nothing happens +if there aren't enough control points. +

Warning: On X11, coordinates that do not fit into 16-bit signed +values are truncated. This limitation is expected to go away in +TQt 4. + +

void TQPainter::drawEllipse ( int x, int y, int w, int h ) +

+Draws an ellipse with center at (x + w/2, y + h/2) and size (w, h). + +

Examples: drawdemo/drawdemo.cpp, multiple/ax2.h, picture/picture.cpp, and tictac/tictac.cpp. +

void TQPainter::drawEllipse ( const TQRect & r ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws the ellipse that fits inside rectangle r. + +

void TQPainter::drawImage ( int x, int y, const TQImage & image, int sx = 0, int sy = 0, int sw = -1, int sh = -1, int conversionFlags = 0 ) +

+Draws at (x, y) the sw by sh area of pixels from (sx, sy) in image, using conversionFlags if the image +needs to be converted to a pixmap. The default value for conversionFlags is 0; see convertFromImage() for information about +what other values do. +

This function may convert image to a pixmap and then draw it, +if device() is a TQPixmap or a TQWidget, or else draw it directly, +if device() is a TQPrinter or TQPicture. +

Currently alpha masks of the image are ignored when painting on a TQPrinter. +

See also drawPixmap() and TQPixmap::convertFromImage(). + +

Example: canvas/canvas.cpp. +

void TQPainter::drawImage ( const TQPoint &, const TQImage &, const TQRect & sr, int conversionFlags = 0 ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws the rectangle sr from the image at the given point. + +

void TQPainter::drawImage ( const TQPoint & p, const TQImage & i, int conversion_flags = 0 ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws the image i at point 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 conversion_flags to specify how you'd prefer this to happen. +

See also TQt::ImageConversionFlags. + +

void TQPainter::drawImage ( const TQRect & r, const TQImage & i ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws the image i into the rectangle r. The image will be +scaled to fit the rectangle if image and rectangle dimensions +differ. + +

void TQPainter::drawLine ( int x1, int y1, int x2, int y2 ) +

+Draws a line from (x1, y1) to (x2, y2) and sets the +current pen position to (x2, y2). +

See also pen(). + +

Examples: aclock/aclock.cpp, drawlines/connect.cpp, progress/progress.cpp, splitter/splitter.cpp, themes/metal.cpp, and themes/wood.cpp. +

void TQPainter::drawLine ( const TQPoint & p1, const TQPoint & p2 ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws a line from point p1 to point p2. + +

void TQPainter::drawLineSegments ( const TQPointArray & a, int index = 0, int nlines = -1 ) +

+Draws nlines separate lines from points defined in a, +starting at a[index] (index defaults to 0). If nlines is +-1 (the default) all points until the end of the array are used +(i.e. (a.size()-index)/2 lines are drawn). +

Draws the 1st line from a[index] to a[index+1]. Draws the +2nd line from a[index+2] to a[index+3] etc. +

Warning: On X11, coordinates that do not fit into 16-bit signed +values are truncated. This limitation is expected to go away in +TQt 4. +

See also drawPolyline(), drawPolygon(), and TQPen. + +

void TQPainter::drawPicture ( int x, int y, const TQPicture & pic ) +

+Replays the picture pic translated by (x, y). +

This function does exactly the same as TQPicture::play() when +called with (x, y) = (0, 0). + +

Examples: picture/picture.cpp and xform/xform.cpp. +

void TQPainter::drawPicture ( const TQPicture & pic ) +

+This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. +

Use one of the other TQPainter::drawPicture() functions with a (0, 0) +offset instead. + +

void TQPainter::drawPicture ( const TQPoint & p, const TQPicture & pic ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws picture pic at point p. + +

void TQPainter::drawPie ( int x, int y, int w, int h, int a, int alen ) +

+Draws a pie defined by the rectangle (x, y, w, h), the start +angle a and the arc length alen. +

The pie is filled with the current brush(). +

The angles a and alen are 1/16th of a degree, i.e. a full +circle equals 5760 (16*360). Positive values of a and alen +mean counter-clockwise while negative values mean the clockwise +direction. Zero degrees is at the 3 o'clock position. +

See also drawArc() and drawChord(). + +

Examples: drawdemo/drawdemo.cpp, grapher/grapher.cpp, t10/cannon.cpp, and t9/cannon.cpp. +

void TQPainter::drawPie ( const TQRect & r, int a, int alen ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws a pie segment that fits inside the rectangle r with start +angle a and arc length alen. + +

void TQPainter::drawPixmap ( int x, int y, const TQPixmap & pixmap, int sx = 0, int sy = 0, int sw = -1, int sh = -1 ) +

+Draws a pixmap at (x, y) by copying a part of pixmap into +the paint device. +

(x, y) specifies the top-left point in the paint device that is +to be drawn onto. (sx, sy) specifies the top-left point in pixmap that is to be drawn. The default is (0, 0). +

(sw, sh) 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. +

Currently the mask of the pixmap or it's alpha channel are ignored +when painting on a TQPrinter. +

See also bitBlt() and TQPixmap::setMask(). + +

Examples: grapher/grapher.cpp, picture/picture.cpp, qdir/qdir.cpp, qmag/qmag.cpp, showimg/showimg.cpp, t10/cannon.cpp, and xform/xform.cpp. +

void TQPainter::drawPixmap ( const TQPoint & p, const TQPixmap & pm, const TQRect & sr ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws the rectangle sr of pixmap pm with its origin at point +p. + +

void TQPainter::drawPixmap ( const TQPoint & p, const TQPixmap & pm ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws the pixmap pm with its origin at point p. + +

void TQPainter::drawPixmap ( const TQRect & r, const TQPixmap & pm ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws the pixmap pm into the rectangle r. The pixmap is +scaled to fit the rectangle, if image and rectangle size disagree. + +

void TQPainter::drawPoint ( int x, int y ) +

+Draws/plots a single point at (x, y) using the current pen. +

See also TQPen. + +

Examples: desktop/desktop.cpp and drawlines/connect.cpp. +

void TQPainter::drawPoint ( const TQPoint & p ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws the point p. + +

void TQPainter::drawPoints ( const TQPointArray & a, int index = 0, int npoints = -1 ) +

+Draws/plots an array of points, a, using the current pen. +

If index is non-zero (the default is zero) only points from index are drawn. If npoints is negative (the default) the rest +of the points from index are drawn. If npoints is zero or +greater, npoints points are drawn. +

Warning: On X11, coordinates that do not fit into 16-bit signed +values are truncated. This limitation is expected to go away in +TQt 4. + +

void TQPainter::drawPolygon ( const TQPointArray & a, bool winding = FALSE, int index = 0, int npoints = -1 ) +

+Draws the polygon defined by the npoints points in a +starting at a[index]. (index defaults to 0.) +

If npoints is -1 (the default) all points until the end of the +array are used (i.e. a.size()-index line segments define the +polygon). +

The first point is always connected to the last point. +

The polygon is filled with the current brush(). If winding is +TRUE, the polygon is filled using the winding fill algorithm. If +winding is FALSE, the polygon is filled using the even-odd +(alternative) fill algorithm. +

Warning: On X11, coordinates that do not fit into 16-bit signed +values are truncated. This limitation is expected to go away in +TQt 4. +

See also drawLineSegments(), drawPolyline(), and TQPen. + +

Examples: desktop/desktop.cpp and picture/picture.cpp. +

void TQPainter::drawPolyline ( const TQPointArray & a, int index = 0, int npoints = -1 ) +

+Draws the polyline defined by the npoints points in a +starting at a[index]. (index defaults to 0.) +

If npoints is -1 (the default) all points until the end of the +array are used (i.e. a.size()-index-1 line segments are drawn). +

Warning: On X11, coordinates that do not fit into 16-bit signed +values are truncated. This limitation is expected to go away in +TQt 4. +

See also drawLineSegments(), drawPolygon(), and TQPen. + +

Examples: scribble/scribble.cpp and themes/metal.cpp. +

void TQPainter::drawRect ( int x, int y, int w, int h ) +

+Draws a rectangle with upper left corner at (x, y) and with +width w and height h. +

See also TQPen and drawRoundRect(). + +

Examples: drawdemo/drawdemo.cpp, picture/picture.cpp, t10/cannon.cpp, t11/cannon.cpp, t9/cannon.cpp, tooltip/tooltip.cpp, and trivial/trivial.cpp. +

void TQPainter::drawRect ( const TQRect & r ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws the rectangle r. + +

void TQPainter::drawRoundRect ( int x, int y, int w, int h, int xRnd = 25, int yRnd = 25 ) +

+Draws a rectangle with rounded corners at (x, y), with width w and height h. +

The xRnd and yRnd arguments specify how rounded the corners +should be. 0 is angled corners, 99 is maximum roundedness. +

The width and height include all of the drawn lines. +

See also drawRect() and TQPen. + +

Examples: drawdemo/drawdemo.cpp and themes/wood.cpp. +

void TQPainter::drawRoundRect ( const TQRect & r, int xRnd = 25, int yRnd = 25 ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws a rounded rectangle r, rounding to the x position xRnd +and the y position yRnd on each corner. + +

void TQPainter::drawText ( const TQPoint & p, const TQString &, int pos, int len, TextDirection dir = Auto ) +

+ +

Draws the text from position pos, at point p. If len is +-1 the entire string is drawn, otherwise just the first len +characters. The text's direction is specified by dir. +

Note that the meaning of y is not the same for the two +drawText() varieties. For overloads that take a simple x, y +pair (or a point), the y value is the text's baseline; for +overloads that take a rectangle, rect.y() is the top of the +rectangle and the text is aligned within that rectangle in +accordance with the alignment flags. +

See also TQPainter::TextDirection. + +

Examples: desktop/desktop.cpp, drawdemo/drawdemo.cpp, grapher/grapher.cpp, picture/picture.cpp, progress/progress.cpp, t8/cannon.cpp, and trivial/trivial.cpp. +

void TQPainter::drawText ( int x, int y, const TQString &, int len = -1, TextDirection dir = Auto ) +

+ +

This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws the given text at position x, y. If len is -1 (the +default) all the text is drawn, otherwise the first len +characters are drawn. The text's direction is given by dir. +

See also TQPainter::TextDirection. + +

void TQPainter::drawText ( const TQPoint &, const TQString &, int len = -1, TextDirection dir = Auto ) +

+ +

This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws the text at the given point. +

See also TQPainter::TextDirection. + +

void TQPainter::drawText ( int x, int y, const TQString &, int pos, int len, TextDirection dir = Auto ) +

+ +

This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws the text from position pos, at point (x, y). If len is +-1 the entire string is drawn, otherwise just the first len +characters. The text's direction is specified by dir. + +

void TQPainter::drawText ( int x, int y, int w, int h, int flags, const TQString &, int len = -1, TQRect * br = 0, TQTextParag ** internal = 0 ) +

+ +

This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws the given text within the rectangle starting at x, y, +with width w and height h. If len is -1 (the default) all +the text is drawn, otherwise the first len characters are +drawn. The text's flags that are given in the flags parameter +are TQt::AlignmentFlags and TQt::TextFlags OR'd together. br (if not null) is set to the actual bounding rectangle of the +output. The internal parameter is for internal use only. + +

void TQPainter::drawText ( const TQRect & r, int tf, const TQString & str, int len = -1, TQRect * brect = 0, TQTextParag ** internal = 0 ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws at most len characters from str in the rectangle r. +

This function draws formatted text. The tf text format is +really of type TQt::AlignmentFlags and TQt::TextFlags OR'd +together. +

Horizontal alignment defaults to AlignAuto and vertical alignment +defaults to AlignTop. +

brect (if not null) is set to the actual bounding rectangle of +the output. internal is, yes, internal. +

See also boundingRect(). + +

void TQPainter::drawTiledPixmap ( int x, int y, int w, int h, const TQPixmap & pixmap, int sx = 0, int sy = 0 ) +

+Draws a tiled pixmap in the specified rectangle. +

(x, y) specifies the top-left point in the paint device that is +to be drawn onto; with the width and height given by w and h. (sx, sy) specifies the top-left point in pixmap that is +to be drawn. The default is (0, 0). +

Calling drawTiledPixmap() is similar to calling drawPixmap() +several times to fill (tile) an area with a pixmap, but is +potentially much more efficient depending on the underlying window +system. +

See also drawPixmap(). + +

void TQPainter::drawTiledPixmap ( const TQRect & r, const TQPixmap & pm, const TQPoint & sp ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws a tiled pixmap, pm, inside rectangle r with its origin +at point sp. + +

void TQPainter::drawTiledPixmap ( const TQRect & r, const TQPixmap & pm ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws a tiled pixmap, pm, inside rectangle r. + +

void TQPainter::drawWinFocusRect ( int x, int y, int w, int h, const TQColor & bgColor ) +

+Draws a Windows focus rectangle with upper left corner at (x, +y) and with width w and height h using a pen color that +contrasts with bgColor. +

This function draws a stippled rectangle (XOR is not used) that is +used to indicate keyboard focus (when the TQApplication::style() is +WindowStyle). +

The pen color used to draw the rectangle is either white or black +depending on the color of bgColor (see TQColor::gray()). +

Warning: This function draws nothing if the coordinate system has +been rotated or sheared. +

See also drawRect() and TQApplication::style(). + +

void TQPainter::drawWinFocusRect ( int x, int y, int w, int h ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws a Windows focus rectangle with upper left corner at (x, +y) and with width w and height h. +

This function draws a stippled XOR rectangle that is used to +indicate keyboard focus (when TQApplication::style() is WindowStyle). +

Warning: This function draws nothing if the coordinate system has +been rotated or sheared. +

See also drawRect() and TQApplication::style(). + +

void TQPainter::drawWinFocusRect ( const TQRect & r ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws rectangle r as a window focus rectangle. + +

void TQPainter::drawWinFocusRect ( const TQRect & r, const TQColor & bgColor ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws rectangle r as a window focus rectangle using background +color bgColor. + +

bool TQPainter::end () +

+Ends painting. Any resources used while painting are released. +

Note that while you mostly don't need to call end(), the +destructor will do it, there is at least one common case when it +is needed, namely double buffering. +

+        TQPainter p( myPixmap, this )
+        // ...
+        p.end(); // stops drawing on myPixmap
+        p.begin( this );
+        p.drawPixmap( 0, 0, myPixmap );
+    
+ +

Since you can't draw a TQPixmap while it is being painted, it is +necessary to close the active painter. +

See also begin() and isActive(). + +

Examples: aclock/aclock.cpp, desktop/desktop.cpp, hello/hello.cpp, picture/picture.cpp, scribble/scribble.cpp, t10/cannon.cpp, and xform/xform.cpp. +

void TQPainter::eraseRect ( int x, int y, int w, int h ) +

+ +

Erases the area inside x, y, w, h. Equivalent to +fillRect( x, y, w, h, backgroundColor() ). + +

Examples: listboxcombo/listboxcombo.cpp and showimg/showimg.cpp. +

void TQPainter::eraseRect ( const TQRect & r ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Erases the area inside the rectangle r. + +

void TQPainter::fillRect ( int x, int y, int w, int h, const TQBrush & brush ) +

+Fills the rectangle (x, y, w, h) with the brush. +

You can specify a TQColor as brush, since there is a TQBrush +constructor that takes a TQColor argument and creates a solid +pattern brush. +

See also drawRect(). + +

Examples: listboxcombo/listboxcombo.cpp, multiple/ax1.h, progress/progress.cpp, qdir/qdir.cpp, qfd/fontdisplayer.cpp, themes/metal.cpp, and themes/wood.cpp. +

void TQPainter::fillRect ( const TQRect & r, const TQBrush & brush ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Fills the rectangle r using brush brush. + +

void TQPainter::flush ( const TQRegion & region, CoordinateMode cm = CoordDevice ) +

+Flushes any buffered drawing operations inside the region region using clipping mode cm. +

The flush may update the whole device if the platform does not +support flushing to a specified region. +

See also CoordinateMode. + +

void TQPainter::flush () +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Flushes any buffered drawing operations. + +

const TQFont & TQPainter::font () const +

+ +

Returns the currently set painter font. +

See also setFont() and TQFont. + +

Example: fileiconview/qfileiconview.cpp. +

TQFontInfo TQPainter::fontInfo () const +

+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. +

See also fontMetrics() and isActive(). + +

TQFontMetrics TQPainter::fontMetrics () const +

+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. +

See also fontInfo() and isActive(). + +

Examples: action/application.cpp, application/application.cpp, desktop/desktop.cpp, drawdemo/drawdemo.cpp, helpviewer/helpwindow.cpp, mdi/application.cpp, and qwerty/qwerty.cpp. +

HDC TQPainter::handle () const +

+ +

Returns the platform-dependent handle used for drawing. Using this +function is not portable. + +

bool TQPainter::hasClipping () const +

+ +

Returns TRUE if clipping has been set; otherwise returns FALSE. +

See also setClipping(). + +

Example: themes/wood.cpp. +

bool TQPainter::hasViewXForm () const +

+ +

Returns TRUE if view transformation is enabled; otherwise returns +FALSE. +

See also setViewXForm() and xForm(). + +

bool TQPainter::hasWorldXForm () const +

+ +

Returns TRUE if world transformation is enabled; otherwise returns +FALSE. +

See also setWorldXForm(). + +

bool TQPainter::isActive () const +

+ +

Returns TRUE if the painter is active painting, i.e. begin() has +been called and end() has not yet been called; otherwise returns +FALSE. +

See also TQPaintDevice::paintingActive(). + +

Examples: desktop/desktop.cpp and helpviewer/helpwindow.cpp. +

void TQPainter::lineTo ( int x, int y ) +

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. +

Use drawLine() instead. +

Draws a line from the current pen position to (x, y) and sets +(x, y) to be the new current pen position. +

See also TQPen, moveTo(), drawLine(), and pos(). + +

void TQPainter::lineTo ( const TQPoint & p ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Draws a line to the point p. + +

void TQPainter::moveTo ( int x, int y ) +

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. +

Sets the current pen position to (x, y) +

See also lineTo() and pos(). + +

void TQPainter::moveTo ( const TQPoint & p ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Moves to the point p. + +

const TQPen & TQPainter::pen () const +

+ +

Returns the painter's current pen. +

See also setPen(). + +

Examples: multiple/ax2.h, progress/progress.cpp, and themes/wood.cpp. +

TQPoint TQPainter::pos () const +

+This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. +

Returns the current position of the pen. +

See also moveTo(). + +

RasterOp TQPainter::rasterOp () const +

+ +

Returns the current raster operation. +

See also setRasterOp() and RasterOp. + +

void TQPainter::redirect ( TQPaintDevice * pdev, TQPaintDevice * replacement ) [static] +

+Redirects all paint commands for a paint device, pdev, to +another paint device, replacement, unless replacement is 0. +If replacement is 0, the redirection for pdev is removed. +

In general, you'll probably find calling TQPixmap::grabWidget() or +TQPixmap::grabWindow() is an easier solution. + +

void TQPainter::resetXForm () +

+Resets any transformations that were made using translate(), scale(), +shear(), rotate(), setWorldMatrix(), setViewport() and +setWindow(). +

See also worldMatrix(), viewport(), and window(). + +

void TQPainter::restore () +

+Restores the current painter state (pops a saved state off the +stack). +

See also save(). + +

Example: aclock/aclock.cpp. +

void TQPainter::restoreWorldMatrix () +

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. +

We recommend using restore() instead. + +

void TQPainter::rotate ( double a ) +

+Rotates the coordinate system a degrees counterclockwise. +

See also translate(), scale(), shear(), resetXForm(), setWorldMatrix(), and xForm(). + +

Examples: aclock/aclock.cpp, t10/cannon.cpp, and t9/cannon.cpp. +

void TQPainter::save () +

+Saves the current painter state (pushes the state onto a stack). A +save() must be followed by a corresponding restore(). end() +unwinds the stack. +

See also restore(). + +

Example: aclock/aclock.cpp. +

void TQPainter::saveWorldMatrix () +

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. +

We recommend using save() instead. + +

void TQPainter::scale ( double sx, double sy ) +

+Scales the coordinate system by (sx, sy). +

See also translate(), shear(), rotate(), resetXForm(), setWorldMatrix(), and xForm(). + +

Example: xform/xform.cpp. +

void TQPainter::setBackgroundColor ( const TQColor & c ) +

+Sets the background color of the painter to c. +

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). +

See also backgroundColor(), setBackgroundMode(), and BackgroundMode. + +

void TQPainter::setBackgroundMode ( BGMode m ) +

+Sets the background mode of the painter to m, which must be +either TransparentMode (the default) or OpaqueMode. +

Transparent mode draws stippled lines and text without setting the +background pixels. Opaque mode fills these space with the current +background color. +

Note that in order to draw a bitmap or pixmap transparently, you +must use TQPixmap::setMask(). +

See also backgroundMode() and setBackgroundColor(). + +

Example: picture/picture.cpp. +

void TQPainter::setBrush ( BrushStyle style ) +

+Sets the painter's brush to black color and the specified style. +

See also brush() and TQBrush. + +

Examples: aclock/aclock.cpp, drawdemo/drawdemo.cpp, picture/picture.cpp, t10/cannon.cpp, t9/cannon.cpp, themes/wood.cpp, and tooltip/tooltip.cpp. +

void TQPainter::setBrush ( const TQBrush & brush ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Sets the painter's brush to brush. +

The brush defines how shapes are filled. +

See also brush(). + +

void TQPainter::setBrush ( const TQColor & color ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Sets the painter's brush to have style SolidPattern and the +specified color. +

See also brush() and TQBrush. + +

void TQPainter::setBrushOrigin ( int x, int y ) +

+Sets the brush origin to (x, y). +

The brush origin specifies the (0, 0) coordinate of the painter's +brush. This setting only applies to pattern brushes and pixmap +brushes. +

See also brushOrigin(). + +

void TQPainter::setBrushOrigin ( const TQPoint & p ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Sets the brush origin to point p. + +

void TQPainter::setClipRect ( int x, int y, int w, int h, CoordinateMode m = CoordDevice ) +

+ +

Sets the clip region to the rectangle x, y, w, h and +enables clipping. The clip mode is set to m. +

If m is CoordDevice (the default), the coordinates given for +the clip region are taken to be physical device coordinates and +are not subject to any coordinate + transformations. If m is CoordPainter, the +coordinates given for the clip region are taken to be model +coordinates. +

See also setClipRegion(), clipRegion(), setClipping(), and TQPainter::CoordinateMode. + +

Examples: grapher/grapher.cpp, progress/progress.cpp, showimg/showimg.cpp, splitter/splitter.cpp, and trivial/trivial.cpp. +

void TQPainter::setClipRect ( const TQRect & r, CoordinateMode m = CoordDevice ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Sets the clip region to the rectangle r and enables clipping. +The clip mode is set to m. +

See also CoordinateMode. + +

void TQPainter::setClipRegion ( const TQRegion & rgn, CoordinateMode m = CoordDevice ) +

+Sets the clip region to rgn and enables clipping. The clip mode +is set to m. +

Note that the clip region is given in physical device coordinates +and not subject to any coordinate + transformation. +

See also setClipRect(), clipRegion(), setClipping(), and CoordinateMode. + +

Examples: qfd/fontdisplayer.cpp and themes/wood.cpp. +

void TQPainter::setClipping ( bool enable ) +

+Enables clipping if enable is TRUE, or disables clipping if enable is FALSE. +

See also hasClipping(), setClipRect(), and setClipRegion(). + +

Example: themes/wood.cpp. +

void TQPainter::setFont ( const TQFont & font ) +

+Sets the painter's font to font. +

This font is used by subsequent drawText() functions. The text +color is the same as the pen color. +

See also font() and drawText(). + +

Examples: drawdemo/drawdemo.cpp, grapher/grapher.cpp, hello/hello.cpp, picture/picture.cpp, qwerty/qwerty.cpp, t13/cannon.cpp, and xform/xform.cpp. +

void TQPainter::setPen ( const TQPen & pen ) +

+Sets a new painter pen. +

The pen defines how to draw lines and outlines, and it also +defines the text color. +

See also pen(). + +

Examples: desktop/desktop.cpp, drawdemo/drawdemo.cpp, multiple/ax2.h, progress/progress.cpp, t9/cannon.cpp, themes/metal.cpp, and themes/wood.cpp. +

void TQPainter::setPen ( PenStyle style ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Sets the painter's pen to have style style, width 0 and black +color. +

See also pen() and TQPen. + +

void TQPainter::setPen ( const TQColor & color ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Sets the painter's pen to have style SolidLine, width 0 and the +specified color. +

See also pen() and TQPen. + +

void TQPainter::setRasterOp ( RasterOp r ) +

+Sets the raster operation to r. +The default is CopyROP. +

See also rasterOp() and TQt::RasterOp. + +

void TQPainter::setTabArray ( int * ta ) +

+Sets the tab stop array to ta. This puts tab stops at ta[0], +ta[1] and so on. The array is null-terminated. +

If both a tab array and a tab top size is set, the tab array wins. +

See also tabArray(), setTabStops(), drawText(), and fontMetrics(). + +

void TQPainter::setTabStops ( int ts ) +

+Set the tab stop width to ts, i.e. locates tab stops at ts, +2*ts, 3*ts and so on. +

Tab stops are used when drawing formatted text with ExpandTabs +set. This fixed tab stop value is used only if no tab array is set +(which is the default case). +

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. +

See also tabStops(), setTabArray(), drawText(), and fontMetrics(). + +

void TQPainter::setViewXForm ( bool enable ) +

+Enables view transformations if enable is TRUE, or disables +view transformations if enable is FALSE. +

See also hasViewXForm(), setWindow(), setViewport(), setWorldMatrix(), setWorldXForm(), and xForm(). + +

void TQPainter::setViewport ( int x, int y, int w, int h ) +

+Sets the viewport rectangle view transformation for the painter +and enables view transformation. +

The viewport rectangle is part of the view transformation. The +viewport specifies the device coordinate system and is specified +by the x, y, w width and h height parameters. Its +sister, the window(), specifies the logical coordinate system. +

The default viewport rectangle is the same as the device's +rectangle. See the Coordinate System Overview for an overview of coordinate transformation. +

See also viewport(), setWindow(), setViewXForm(), setWorldMatrix(), setWorldXForm(), and xForm(). + +

Example: aclock/aclock.cpp. +

void TQPainter::setViewport ( const TQRect & r ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Sets the painter's viewport to rectangle r. + +

void TQPainter::setWindow ( int x, int y, int w, int h ) +

+Sets the window rectangle view transformation for the painter and +enables view transformation. +

The window rectangle is part of the view transformation. The +window specifies the logical coordinate system and is specified by +the x, y, w width and h height parameters. Its sister, +the viewport(), specifies the device coordinate system. +

The default window rectangle is the same as the device's +rectangle. See the Coordinate System Overview for an overview of coordinate transformation. +

See also window(), setViewport(), setViewXForm(), setWorldMatrix(), and setWorldXForm(). + +

Examples: aclock/aclock.cpp and drawdemo/drawdemo.cpp. +

void TQPainter::setWindow ( const TQRect & r ) +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Sets the painter's window to rectangle r. + +

void TQPainter::setWorldMatrix ( const TQWMatrix & m, bool combine = FALSE ) +

+Sets the world transformation matrix to m and enables world +transformation. +

If combine is TRUE, then m is combined with the current +transformation matrix, otherwise m replaces the current +transformation matrix. +

If m is the identity matrix and combine is FALSE, this +function calls setWorldXForm(FALSE). (The identity matrix is the +matrix where TQWMatrix::m11() and TQWMatrix::m22() are 1.0 and the +rest are 0.0.) +

World transformations are applied after the view transformations +(i.e. window and viewport). +

The following functions can transform the coordinate system without using +a TQWMatrix: +

+

They operate on the painter's worldMatrix() and are implemented like this: +

+        void TQPainter::rotate( double a )
+        {
+            TQWMatrix m;
+            m.rotate( a );
+            setWorldMatrix( m, TRUE );
+        }
+    
+ +

Note that you should always use combine when you are drawing +into a TQPicture. Otherwise it may not be possible to replay the +picture with additional transformations. Using translate(), +scale(), etc., is safe. +

For a brief overview of coordinate transformation, see the Coordinate System Overview. +

See also worldMatrix(), setWorldXForm(), setWindow(), setViewport(), setViewXForm(), xForm(), and TQWMatrix. + +

Examples: drawdemo/drawdemo.cpp and xform/xform.cpp. +

void TQPainter::setWorldXForm ( bool enable ) +

+Enables world transformations if enable is TRUE, or disables +world transformations if enable is FALSE. The world +transformation matrix is not changed. +

See also setWorldMatrix(), setWindow(), setViewport(), setViewXForm(), and xForm(). + +

void TQPainter::shear ( double sh, double sv ) +

+Shears the coordinate system by (sh, sv). +

See also translate(), scale(), rotate(), resetXForm(), setWorldMatrix(), and xForm(). + +

int * TQPainter::tabArray () const +

+ +

Returns the currently set tab stop array. +

See also setTabArray(). + +

int TQPainter::tabStops () const +

+ +

Returns the tab stop setting. +

See also setTabStops(). + +

void TQPainter::translate ( double dx, double dy ) +

+Translates the coordinate system by (dx, dy). After this call, +(dx, dy) is added to points. +

For example, the following code draws the same point twice: +

+        void MyWidget::paintEvent()
+        {
+            TQPainter paint( this );
+
+            paint.drawPoint( 0, 0 );
+
+            paint.translate( 100.0, 40.0 );
+            paint.drawPoint( -100, -40 );
+        }
+    
+ +

See also scale(), shear(), rotate(), resetXForm(), setWorldMatrix(), and xForm(). + +

Examples: action/application.cpp, application/application.cpp, t10/cannon.cpp, t9/cannon.cpp, themes/metal.cpp, themes/wood.cpp, and xform/xform.cpp. +

TQRect TQPainter::viewport () const +

+Returns the viewport rectangle. +

See also setViewport() and setViewXForm(). + +

Example: aclock/aclock.cpp. +

TQRect TQPainter::window () const +

+Returns the window rectangle. +

See also setWindow() and setViewXForm(). + +

const TQWMatrix & TQPainter::worldMatrix () const +

+Returns the world transformation matrix. +

See also setWorldMatrix(). + +

TQPoint TQPainter::xForm ( const TQPoint & pv ) const +

+Returns the point pv transformed from model coordinates to +device coordinates. +

See also xFormDev() and TQWMatrix::map(). + +

TQRect TQPainter::xForm ( const TQRect & rv ) const +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Returns the rectangle rv transformed from model coordinates to +device coordinates. +

If world transformation is enabled and rotation or shearing has +been specified, then the bounding rectangle is returned. +

See also xFormDev() and TQWMatrix::map(). + +

TQPointArray TQPainter::xForm ( const TQPointArray & av ) const +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Returns the point array av transformed from model coordinates +to device coordinates. +

See also xFormDev() and TQWMatrix::map(). + +

TQPointArray TQPainter::xForm ( const TQPointArray & av, int index, int npoints ) const +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Returns the point array av transformed from model coordinates +to device coordinates. The index is the first point in the +array and npoints denotes the number of points to be +transformed. If npoints is negative, all points from av[index] until the last point in the array are transformed. +

The returned point array consists of the number of points that +were transformed. +

Example: +

+        TQPointArray a(10);
+        TQPointArray b;
+        b = painter.xForm(a, 2, 4);  // b.size() == 4
+        b = painter.xForm(a, 2, -1); // b.size() == 8
+    
+ +

See also xFormDev() and TQWMatrix::map(). + +

TQRect TQPainter::xFormDev ( const TQRect & rd ) const +

+Returns the rectangle rd transformed from device coordinates to +model coordinates. +

If world transformation is enabled and rotation or shearing is +used, then the bounding rectangle is returned. +

See also xForm() and TQWMatrix::map(). + +

TQPoint TQPainter::xFormDev ( const TQPoint & pd ) const +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Returns the point pd transformed from device coordinates to +model coordinates. +

See also xForm() and TQWMatrix::map(). + +

TQPointArray TQPainter::xFormDev ( const TQPointArray & ad ) const +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Returns the point array ad transformed from device coordinates +to model coordinates. +

See also xForm() and TQWMatrix::map(). + +

TQPointArray TQPainter::xFormDev ( const TQPointArray & ad, int index, int npoints ) const +

+This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

Returns the point array ad transformed from device coordinates +to model coordinates. The index is the first point in the array +and npoints denotes the number of points to be transformed. If +npoints is negative, all points from ad[index] until the +last point in the array are transformed. +

The returned point array consists of the number of points that +were transformed. +

Example: +

+        TQPointArray a(10);
+        TQPointArray b;
+        b = painter.xFormDev(a, 1, 3);  // b.size() == 3
+        b = painter.xFormDev(a, 1, -1); // b.size() == 9
+    
+ +

See also xForm() and TQWMatrix::map(). + +


Related Functions

+

void qDrawPlainRect ( TQPainter * p, int x, int y, int w, int h, const TQColor & c, int lineWidth, const TQBrush * fill ) +

+ +

#include <ntqdrawutil.h> +

Draws the plain rectangle specified by (x, y, w, h) +using the painter p. +

The color argument c specifies the line color. +

The lineWidth argument specifies the line width. +

The rectangle's interior is filled with the fill brush unless +fill is 0. +

If you want to use a TQFrame widget instead, you can make it +display a plain rectangle, for example TQFrame::setFrameStyle( TQFrame::Box | TQFrame::Plain ). +

Warning: This function does not look at TQWidget::style() or +TQApplication::style(). Use the drawing functions in TQStyle to make +widgets that follow the current GUI style. +

See also qDrawShadeRect() and TQStyle::drawPrimitive(). + +

void qDrawShadeLine ( TQPainter * p, int x1, int y1, int x2, int y2, const TQColorGroup & g, bool sunken, int lineWidth, int midLineWidth ) +

+ +

#include <ntqdrawutil.h> +

Draws a horizontal (y1 == y2) or vertical (x1 == x2) +shaded line using the painter p. +

Nothing is drawn if y1 != y2 and x1 != x2 (i.e. the +line is neither horizontal nor vertical). +

The color group argument g specifies the shading colors (light, dark and middle colors). +

The line appears sunken if sunken is TRUE, or raised if sunken is FALSE. +

The lineWidth argument specifies the line width for each of the +lines. It is not the total line width. +

The midLineWidth argument specifies the width of a middle line +drawn in the TQColorGroup::mid() color. +

If you want to use a TQFrame widget instead, you can make it +display a shaded line, for example TQFrame::setFrameStyle( TQFrame::HLine | TQFrame::Sunken ). +

Warning: This function does not look at TQWidget::style() or +TQApplication::style(). Use the drawing functions in TQStyle to make +widgets that follow the current GUI style. +

See also qDrawShadeRect(), qDrawShadePanel(), and TQStyle::drawPrimitive(). + +

void qDrawShadePanel ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, bool sunken, int lineWidth, const TQBrush * fill ) +

+ +

#include <ntqdrawutil.h> +

Draws the shaded panel specified by (x, y, w, h) using +the painter p. +

The color group argument g specifies the shading colors (light, dark and middle colors). +

The panel appears sunken if sunken is TRUE, or raised if sunken is FALSE. +

The lineWidth argument specifies the line width. +

The panel's interior is filled with the fill brush unless fill is 0. +

If you want to use a TQFrame widget instead, you can make it +display a shaded panel, for example TQFrame::setFrameStyle( TQFrame::Panel | TQFrame::Sunken ). +

Warning: This function does not look at TQWidget::style() or +TQApplication::style(). Use the drawing functions in TQStyle to make +widgets that follow the current GUI style. +

See also qDrawWinPanel(), qDrawShadeLine(), qDrawShadeRect(), and TQStyle::drawPrimitive(). + +

void qDrawShadeRect ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, bool sunken, int lineWidth, int midLineWidth, const TQBrush * fill ) +

+ +

#include <ntqdrawutil.h> +

Draws the shaded rectangle specified by (x, y, w, h) +using the painter p. +

The color group argument g specifies the shading colors (light, dark and middle colors). +

The rectangle appears sunken if sunken is TRUE, or raised if sunken is FALSE. +

The lineWidth argument specifies the line width for each of the +lines. It is not the total line width. +

The midLineWidth argument specifies the width of a middle line +drawn in the TQColorGroup::mid() color. +

The rectangle's interior is filled with the fill brush unless +fill is 0. +

If you want to use a TQFrame widget instead, you can make it +display a shaded rectangle, for example TQFrame::setFrameStyle( TQFrame::Box | TQFrame::Raised ). +

Warning: This function does not look at TQWidget::style() or +TQApplication::style(). Use the drawing functions in TQStyle to make +widgets that follow the current GUI style. +

See also qDrawShadeLine(), qDrawShadePanel(), qDrawPlainRect(), TQStyle::drawItem(), TQStyle::drawControl(), and TQStyle::drawComplexControl(). + +

void qDrawWinButton ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, bool sunken, const TQBrush * fill ) +

+ +

#include <ntqdrawutil.h> +

Draws the Windows-style button specified by (x, y, w, h) using the painter p. +

The color group argument g specifies the shading colors (light, dark and middle colors). +

The button appears sunken if sunken is TRUE, or raised if sunken is FALSE. +

The line width is 2 pixels. +

The button's interior is filled with the *fill brush unless fill is 0. +

Warning: This function does not look at TQWidget::style() or +TQApplication::style(). Use the drawing functions in TQStyle to make +widgets that follow the current GUI style. +

See also qDrawWinPanel() and TQStyle::drawControl(). + +

void qDrawWinPanel ( TQPainter * p, int x, int y, int w, int h, const TQColorGroup & g, bool sunken, const TQBrush * fill ) +

+ +

#include <ntqdrawutil.h> +

Draws the Windows-style panel specified by (x, y, w, h) using the painter p. +

The color group argument g specifies the shading colors. +

The panel appears sunken if sunken is TRUE, or raised if sunken is FALSE. +

The line width is 2 pixels. +

The button's interior is filled with the fill brush unless fill is 0. +

If you want to use a TQFrame widget instead, you can make it +display a shaded panel, for example TQFrame::setFrameStyle( TQFrame::WinPanel | TQFrame::Raised ). +

Warning: This function does not look at TQWidget::style() or +TQApplication::style(). Use the drawing functions in TQStyle to make +widgets that follow the current GUI style. +

See also qDrawShadePanel(), qDrawWinButton(), and TQStyle::drawPrimitive(). + + +


+This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


+ +
Copyright © 2007 +TrolltechTrademarks +
TQt 3.3.8
+
+ -- cgit v1.2.1