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

385 lines
18 KiB

'\" t
.TH QPaintDevice 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QPaintDevice \- The base class of objects that can be painted
.SH SYNOPSIS
\fC#include <ntqpaintdevice.h>\fR
.PP
Inherited by QWidget, QPixmap, QPicture, and QPrinter.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "virtual \fB~QPaintDevice\fR ()"
.br
.ti -1c
.BI "bool \fBisExtDev\fR () const"
.br
.ti -1c
.BI "bool \fBpaintingActive\fR () const"
.br
.ti -1c
.BI "virtual HDC \fBhandle\fR () const"
.br
.ti -1c
.BI "virtual Qt::HANDLE \fBhandle\fR () const"
.br
.ti -1c
.BI "Display * \fBx11Display\fR () const"
.br
.ti -1c
.BI "int \fBx11Screen\fR () const"
.br
.ti -1c
.BI "int \fBx11Depth\fR () const"
.br
.ti -1c
.BI "int \fBx11Cells\fR () const"
.br
.ti -1c
.BI "Qt::HANDLE \fBx11Colormap\fR () const"
.br
.ti -1c
.BI "bool \fBx11DefaultColormap\fR () const"
.br
.ti -1c
.BI "void * \fBx11Visual\fR () const"
.br
.ti -1c
.BI "bool \fBx11DefaultVisual\fR () const"
.br
.in -1c
.SS "Static Public Members"
.in +1c
.ti -1c
.BI "Display * \fBx11AppDisplay\fR ()"
.br
.ti -1c
.BI "int \fBx11AppScreen\fR ()"
.br
.ti -1c
.BI "int \fBx11AppDpiX\fR ()"
.br
.ti -1c
.BI "int \fBx11AppDpiY\fR ()"
.br
.ti -1c
.BI "void \fBx11SetAppDpiX\fR ( int dpi )"
.br
.ti -1c
.BI "void \fBx11SetAppDpiY\fR ( int dpi )"
.br
.ti -1c
.BI "int \fBx11AppDepth\fR ()"
.br
.ti -1c
.BI "int \fBx11AppCells\fR ()"
.br
.ti -1c
.BI "Qt::HANDLE \fBx11AppRootWindow\fR ()"
.br
.ti -1c
.BI "Qt::HANDLE \fBx11AppColormap\fR ()"
.br
.ti -1c
.BI "bool \fBx11AppDefaultColormap\fR ()"
.br
.ti -1c
.BI "void * \fBx11AppVisual\fR ()"
.br
.ti -1c
.BI "bool \fBx11AppDefaultVisual\fR ()"
.br
.ti -1c
.BI "int \fBx11AppDepth\fR ( int screen )"
.br
.ti -1c
.BI "int \fBx11AppCells\fR ( int screen )"
.br
.ti -1c
.BI "Qt::HANDLE \fBx11AppRootWindow\fR ( int screen )"
.br
.ti -1c
.BI "Qt::HANDLE \fBx11AppColormap\fR ( int screen )"
.br
.ti -1c
.BI "void * \fBx11AppVisual\fR ( int screen )"
.br
.ti -1c
.BI "bool \fBx11AppDefaultColormap\fR ( int screen )"
.br
.ti -1c
.BI "bool \fBx11AppDefaultVisual\fR ( int screen )"
.br
.ti -1c
.BI "int \fBx11AppDpiX\fR ( int screen )"
.br
.ti -1c
.BI "int \fBx11AppDpiY\fR ( int screen )"
.br
.ti -1c
.BI "void \fBx11SetAppDpiX\fR ( int dpi, int screen )"
.br
.ti -1c
.BI "void \fBx11SetAppDpiY\fR ( int dpi, int screen )"
.br
.in -1c
.SS "Protected Members"
.in +1c
.ti -1c
.BI "\fBQPaintDevice\fR ( uint devflags )"
.br
.ti -1c
.BI "virtual bool \fBcmd\fR ( int, QPainter *, QPDevCmdParam * )"
.br
.in -1c
.SH RELATED FUNCTION DOCUMENTATION
.in +1c
.ti -1c
.BI "void \fBbitBlt\fR ( QPaintDevice * dst, int dx, int dy, const QPaintDevice * src, int sx, int sy, int sw, int sh, Qt::RasterOp rop, bool ignoreMask )"
.br
.ti -1c
.BI "void \fBbitBlt\fR ( QPaintDevice * dst, const QPoint & dp, const QPaintDevice * src, const QRect & sr, RasterOp rop )"
.br
.in -1c
.SH DESCRIPTION
The QPaintDevice class is the base class of objects that can be painted.
.PP
A paint device is an abstraction of a two-dimensional space that can be drawn using a QPainter. The drawing capabilities are implemented by the subclasses QWidget, QPixmap, QPicture and QPrinter.
.PP
The default coordinate system of a paint device has its origin located at the top-left position. X increases to the right and Y increases downward. The unit is one pixel. There are several ways to set up a user-defined coordinate system using the painter, for example, using QPainter::setWorldMatrix().
.PP
Example (draw on a paint device):
.PP
.nf
.br
void MyWidget::paintEvent( QPaintEvent * )
.br
{
.br
QPainter p; // our painter
.br
p.begin( this ); // start painting the widget
.br
p.setPen( red ); // red outline
.br
p.setBrush( yellow ); // yellow fill
.br
p.drawEllipse( 10, 20, 100,100 ); // 100x100 ellipse at position (10, 20)
.br
p.end(); // painting done
.br
}
.br
.fi
.PP
The bit block transfer is an extremely useful operation for copying pixels from one paint device to another (or to itself). It is implemented as the global function bitBlt().
.PP
Example (scroll widget contents 10 pixels to the right):
.PP
.nf
.br
bitBlt( myWidget, 10, 0, myWidget );
.br
.fi
.PP
\fBWarning:\fR TQt requires that a QApplication object exists before any paint devices can be created. Paint devices access window system resources, and these resources are not initialized before an application object is created.
.PP
See also Graphics Classes and Image Processing Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QPaintDevice::QPaintDevice ( uint devflags )\fC [protected]\fR"
Constructs a paint device with internal flags \fIdevflags\fR. This constructor can be invoked only from QPaintDevice subclasses.
.SH "QPaintDevice::~QPaintDevice ()\fC [virtual]\fR"
Destroys the paint device and frees window system resources.
.SH "bool QPaintDevice::cmd ( int, QPainter *, QPDevCmdParam * )\fC [virtual protected]\fR"
Internal virtual function that interprets drawing commands from the painter.
.PP
Implemented by subclasses that have no direct support for drawing graphics (external paint devices, for example, QPicture).
.SH "Qt::HANDLE QPaintDevice::handle () const\fC [virtual]\fR"
Returns the window system handle of the paint device, for low-level access. Using this function is not portable.
.PP
The HANDLE type varies with platform; see ntqpaintdevice.h and ntqwindowdefs.h for details.
.PP
See also x11Display().
.SH "bool QPaintDevice::isExtDev () const"
Returns TRUE if the device is an external paint device; otherwise returns FALSE.
.PP
External paint devices cannot be bitBlt()'ed from. QPicture and QPrinter are external paint devices.
.SH "bool QPaintDevice::paintingActive () const"
Returns TRUE if the device is being painted, i.e. someone has called QPainter::begin() but not yet called QPainter::end() for this device; otherwise returns FALSE.
.PP
See also QPainter::isActive().
.SH "int QPaintDevice::x11AppCells ()\fC [static]\fR"
Returns the number of entries in the colormap for the default screen of the X display global to the application (X11 only). Using this function is not portable.
.PP
See also x11Colormap().
.SH "int QPaintDevice::x11AppCells ( int screen )\fC [static]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the number of entries in the colormap for screen \fIscreen\fR of the X display global to the application (X11 only). Using this function is not portable.
.PP
See also x11Colormap().
.SH "Qt::HANDLE QPaintDevice::x11AppColormap ()\fC [static]\fR"
Returns the colormap for the default screen of the X display global to the application (X11 only). Using this function is not portable.
.PP
See also x11Cells().
.SH "Qt::HANDLE QPaintDevice::x11AppColormap ( int screen )\fC [static]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the colormap for screen \fIscreen\fR of the X display global to the application (X11 only). Using this function is not portable.
.PP
See also x11Cells().
.SH "bool QPaintDevice::x11AppDefaultColormap ()\fC [static]\fR"
Returns the default colormap for the default screen of the X display global to the application (X11 only). Using this function is not portable.
.PP
See also x11Cells().
.SH "bool QPaintDevice::x11AppDefaultColormap ( int screen )\fC [static]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the default colormap for screen \fIscreen\fR of the X display global to the application (X11 only). Using this function is not portable.
.PP
See also x11Cells().
.SH "bool QPaintDevice::x11AppDefaultVisual ()\fC [static]\fR"
Returns TRUE if the Visual used is the default for the default screen of the X display global to the application (X11 only); otherwise returns FALSE. Using this function is not portable.
.SH "bool QPaintDevice::x11AppDefaultVisual ( int screen )\fC [static]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if the Visual used is the default for screen \fIscreen\fR of the X display global to the application (X11 only); otherwise returns FALSE. Using this function is not portable.
.SH "int QPaintDevice::x11AppDepth ( int screen )\fC [static]\fR"
Returns the depth for screen \fIscreen\fR of the X display global to the application (X11 only). Using this function is not portable.
.PP
See also QPixmap::defaultDepth().
.SH "int QPaintDevice::x11AppDepth ()\fC [static]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the depth for the default screen of the X display global to the application (X11 only). Using this function is not portable.
.PP
See also QPixmap::defaultDepth().
.SH "Display * QPaintDevice::x11AppDisplay ()\fC [static]\fR"
Returns a pointer to the X display global to the application (X11 only). Using this function is not portable.
.PP
See also handle().
.SH "int QPaintDevice::x11AppDpiX ( int screen )\fC [static]\fR"
Returns the horizontal DPI of the X display (X11 only) for screen \fIscreen\fR. Using this function is not portable. See QPaintDeviceMetrics for portable access to related information. Using this function is not portable.
.PP
See also x11AppDpiY(), x11SetAppDpiX(), and QPaintDeviceMetrics::logicalDpiX().
.SH "int QPaintDevice::x11AppDpiX ()\fC [static]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the horizontal DPI of the X display (X11 only) for the default screen. Using this function is not portable. See QPaintDeviceMetrics for portable access to related information. Using this function is not portable.
.SH "int QPaintDevice::x11AppDpiY ( int screen )\fC [static]\fR"
Returns the vertical DPI of the X11 display (X11 only) for screen \fIscreen\fR. Using this function is not portable. See QPaintDeviceMetrics for portable access to related information. Using this function is not portable.
.PP
See also x11AppDpiX(), x11SetAppDpiY(), and QPaintDeviceMetrics::logicalDpiY().
.SH "int QPaintDevice::x11AppDpiY ()\fC [static]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the vertical DPI of the X11 display (X11 only) for the default screen. Using this function is not portable. See QPaintDeviceMetrics for portable access to related information. Using this function is not portable.
.PP
See also x11AppDpiX(), x11SetAppDpiY(), and QPaintDeviceMetrics::logicalDpiY().
.SH "Qt::HANDLE QPaintDevice::x11AppRootWindow ()\fC [static]\fR"
Returns the root window for the default screen of the X display global to the applicatoin (X11 only). Using this function is not portable.
.SH "Qt::HANDLE QPaintDevice::x11AppRootWindow ( int screen )\fC [static]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the root window for screen \fIscreen\fR of the X display global to the applicatoin (X11 only). Using this function is not portable.
.SH "int QPaintDevice::x11AppScreen ()\fC [static]\fR"
Returns the screen number on the X display global to the application (X11 only). Using this function is not portable.
.SH "void * QPaintDevice::x11AppVisual ()\fC [static]\fR"
Returns the Visual for the default screen of the X display global to the application (X11 only). Using this function is not portable.
.SH "void * QPaintDevice::x11AppVisual ( int screen )\fC [static]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the Visual for screen \fIscreen\fR of the X display global to the application (X11 only). Using this function is not portable.
.SH "int QPaintDevice::x11Cells () const"
Returns the number of entries in the colormap of the X display for the paint device (X11 only). Using this function is not portable.
.PP
See also x11Colormap().
.SH "Qt::HANDLE QPaintDevice::x11Colormap () const"
Returns the colormap of the X display for the paint device (X11 only). Using this function is not portable.
.PP
See also x11Cells().
.SH "bool QPaintDevice::x11DefaultColormap () const"
Returns the default colormap of the X display for the paint device (X11 only). Using this function is not portable.
.PP
See also x11Cells().
.SH "bool QPaintDevice::x11DefaultVisual () const"
Returns the default Visual of the X display for the paint device (X11 only). Using this function is not portable.
.SH "int QPaintDevice::x11Depth () const"
Returns the depth of the X display for the paint device (X11 only). Using this function is not portable.
.PP
See also QPixmap::defaultDepth().
.SH "Display * QPaintDevice::x11Display () const"
Returns a pointer to the X display for the paint device (X11 only). Using this function is not portable.
.PP
See also handle().
.SH "int QPaintDevice::x11Screen () const"
Returns the screen number on the X display for the paint device (X11 only). Using this function is not portable.
.SH "void QPaintDevice::x11SetAppDpiX ( int dpi, int screen )\fC [static]\fR"
Sets the value returned by x11AppDpiX() to \fIdpi\fR for screen \fIscreen\fR. The default is determined by the display configuration. Changing this value will alter the scaling of fonts and many other metrics and is not recommended. Using this function is not portable.
.PP
See also x11SetAppDpiY().
.SH "void QPaintDevice::x11SetAppDpiX ( int dpi )\fC [static]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Sets the value returned by x11AppDpiX() to \fIdpi\fR for the default screen. The default is determined by the display configuration. Changing this value will alter the scaling of fonts and many other metrics and is not recommended. Using this function is not portable.
.SH "void QPaintDevice::x11SetAppDpiY ( int dpi, int screen )\fC [static]\fR"
Sets the value returned by x11AppDpiY() to \fIdpi\fR for screen \fIscreen\fR. The default is determined by the display configuration. Changing this value will alter the scaling of fonts and many other metrics and is not recommended. Using this function is not portable.
.PP
See also x11SetAppDpiX().
.SH "void QPaintDevice::x11SetAppDpiY ( int dpi )\fC [static]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Sets the value returned by x11AppDpiY() to \fIdpi\fR for the default screen. The default is determined by the display configuration. Changing this value will alter the scaling of fonts and many other metrics and is not recommended. Using this function is not portable.
.SH "void * QPaintDevice::x11Visual () const"
Returns the Visual of the X display for the paint device (X11 only). Using this function is not portable.
.SH RELATED FUNCTION DOCUMENTATION
.SH "void bitBlt ( QPaintDevice * dst, int dx, int dy, const QPaintDevice * src, int sx, int sy, int sw, int sh, Qt::RasterOp rop, bool ignoreMask )"
Copies a block of pixels from \fIsrc\fR to \fIdst\fR, perhaps merging each pixel according to the raster operation \fIrop\fR. \fIsx\fR, \fIsy\fR is the top-left pixel in \fIsrc\fR (0, 0) by default, \fIdx\fR, \fIdy\fR is the top-left position in \fIdst\fR and \fIsw\fR, \fIsh\fR is the size of the copied block (all of \fIsrc\fR by default).
.PP
The most common values for \fIrop\fR are CopyROP and XorROP; the Qt::RasterOp documentation defines all the possible values.
.PP
If \fIignoreMask\fR is FALSE (the default) and \fIsrc\fR is a masked QPixmap, the entire blit is masked by \fIsrc\fR->mask().
.PP
If \fIsrc\fR, \fIdst\fR, \fIsw\fR or \fIsh\fR is 0, bitBlt() does nothing. If \fIsw\fR or \fIsh\fR is negative bitBlt() copies starting at \fIsx\fR (and respectively, \fIsy\fR) and ending at the right end (respectively, bottom) of \fIsrc\fR.
.PP
\fIsrc\fR must be a QWidget or QPixmap. You cannot blit from a QPrinter, for example. bitBlt() does nothing if you attempt to blit from an unsupported device.
.PP
bitBlt() does nothing if \fIsrc\fR has a greater depth than \fIdst\fR. If you need to for example, draw a 24-bit pixmap on an 8-bit widget, you must use drawPixmap().
.SH "void bitBlt ( QPaintDevice * dst, const QPoint & dp, const QPaintDevice * src, const QRect & sr, RasterOp rop )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Overloaded bitBlt() with the destination point \fIdp\fR and source
rectangle \fIsr\fR.
.SH "SEE ALSO"
.BR http://doc.trolltech.com/ntqpaintdevice.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (tqpaintdevice.3qt) and the Qt
version (3.3.8).