Eneboo - Documentación para desarrolladores
|
The base class of objects that can be painted. Más...
#include <qpaintdevice.h>
The base class of objects that can be painted.
The QPaintDevice class is the base class of objects that can be painted.
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.
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 downwards. The unit is one pixel. There are several ways to set up a user-defined coordinate system using the painter, for example by QPainter::setWorldMatrix().
Example (draw on a paint device):
void MyWidget::paintEvent( QPaintEvent * ) { QPainter p; // our painter p.begin( this ); // start painting widget p.setPen( red ); // blue outline p.setBrush( yellow ); // yellow fill p.drawEllipse( 10,20, 100,100 ); // 100x100 ellipse at 10,20 p.end(); // painting done }
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().
Example (scroll widget contents 10 pixels to the right):
bitBlt( myWidget, 10,0, myWidget );
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.
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().
Example (draw on a paint device):
void MyWidget::paintEvent( QPaintEvent * ) { QPainter p; // our painter p.begin( this ); // start painting the widget p.setPen( red ); // red outline p.setBrush( yellow ); // yellow fill p.drawEllipse( 10, 20, 100,100 ); // 100x100 ellipse at position (10, 20) p.end(); // painting done }
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().
Example (scroll widget contents 10 pixels to the right):
bitBlt( myWidget, 10, 0, myWidget );
QPaintDevice::~QPaintDevice | ( | ) | [virtual] |
Destructs the paint device and frees window system resources.
Destroys the paint device and frees window system resources.
QPaintDevice::QPaintDevice | ( | uint | devflags | ) | [protected] |
Constructs a paint device with internal flags devflags. This constructor can only be invoked from subclasses of QPaintDevice.
Constructs a paint device with internal flags devflags. This constructor can be invoked only from QPaintDevice subclasses.
virtual QPaintDevice::~QPaintDevice | ( | ) | [virtual] |
QPaintDevice::QPaintDevice | ( | uint | devflags | ) | [protected] |
bool QPaintDevice::cmd | ( | int | , |
QPainter * | , | ||
QPDevCmdParam * | |||
) | [protected, virtual] |
Internal virtual function that interprets drawing commands from the painter.
Implemented by subclasses that have no direct support for drawing graphics (external paint devices, for example QPicture).
Internal virtual function that interprets drawing commands from the painter.
Implemented by subclasses that have no direct support for drawing graphics (external paint devices, for example, QPicture).
Reimplementado en FLPosPrinter, PSPrinter, QSvgDevice, QPicture, QPrinter, QPicture, QPrinter y QSvgDevice.
virtual bool QPaintDevice::cmd | ( | int | , |
QPainter * | , | ||
QPDevCmdParam * | |||
) | [protected, virtual] |
Reimplementado en FLPosPrinter, PSPrinter, QSvgDevice, QPicture, QPrinter, QPicture, QPrinter y QSvgDevice.
int QPaintDevice::devType | ( | ) | const |
int QPaintDevice::devType | ( | ) | const [inline] |
Returns the device type identifier: QInternal::Widget
, QInternal::Pixmap
, QInternal::Printer
, QInternal::Picture
or QInternal::UndefinedDevice
.
Internal virtual function. Reserved for future use.
virtual int QPaintDevice::fontMet | ( | QFont * | , |
int | , | ||
const char * | = 0 , |
||
int | = 0 |
||
) | const [protected, virtual] |
Internal virtual function. Reserved for future use.
bool QPaintDevice::isExtDev | ( | ) | const |
bool QPaintDevice::isExtDev | ( | ) | const [inline] |
Returns TRUE if the device is a so-called external paint device.
External paint devices cannot be bitBlt()'ed from. QPicture and QPrinter are external paint devices.
Returns TRUE if the device is an external paint device; otherwise returns FALSE.
External paint devices cannot be bitBlt()'ed from. QPicture and QPrinter are external paint devices.
Reimplementado en FLPosPrinter, PSPrinter, QSvgDevice, QPicture, QPixmap, QPrinter, QWidget, QPicture, QPixmap, QPrinter, QWidget y QSvgDevice.
Internal virtual function that returns paint device metrics.
Please use the QPaintDeviceMetrics class instead.
Reimplementado en FLPosPrinter, PSPrinter, QSvgDevice, QPicture, QPixmap, QPrinter, QWidget, QPicture, QPixmap, QPrinter, QWidget y QSvgDevice.
bool QPaintDevice::paintingActive | ( | ) | const |
bool QPaintDevice::paintingActive | ( | ) | const [inline] |
Sets the value returned by x11AppDpiX(). 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.
Sets the value returned by x11AppDpiY(). 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.
Returns the horizontal DPI of the X display (X11 only). Using this function is not portable. See QPaintDeviceMetrics for portable access to related information.
Returns the vertical DPI of the X11 display (X11 only). Using this function is not portable. See QPaintDeviceMetrics for portable access to related information.
Returns TRUE if the device is being painted, i.e. someone has called QPainter::begin() and not yet QPainter::end() for this device.
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.
int QPaintDevice::resolution | ( | ) | const [virtual] |
Reimplementado en MReportViewer, PSPrinter, QPrinter y QPrinter.
virtual int QPaintDevice::resolution | ( | ) | const [virtual] |
Reimplementado en MReportViewer, PSPrinter, QPrinter y QPrinter.
virtual void QPaintDevice::setResolution | ( | int | ) | [virtual] |
Reimplementado en MReportViewer, PSPrinter, QPrinter y QPrinter.
void QPaintDevice::setResolution | ( | int | ) | [virtual] |
Reimplementado en MReportViewer, PSPrinter, QPrinter y QPrinter.
void bitBlt | ( | QPaintDevice * | dst, |
int | dx, | ||
int | dy, | ||
const QPaintDevice * | src, | ||
int | sx = 0 , |
||
int | sy = 0 , |
||
int | sw = -1 , |
||
int | sh = -1 , |
||
Qt::RasterOp | rop = Qt::CopyROP , |
||
bool | ignoreMask = FALSE |
||
) | [friend] |
This function copies a block of pixels from one paint device to another (bitBlt means bit block transfer).
If sw is 0 or sh is 0, then bitBlt will do nothing.
If sw is negative, then bitBlt calculates sw = src->width - sx.
If sh is negative, then bitBlt calculates sh = src->height - sy.
The rop argument can be one of:
CopyROP:
dst = src. OrROP:
dst = src OR dst. XorROP:
dst = src XOR dst. NotAndROP:
dst = (NOT src) AND dst NotCopyROP:
dst = NOT src NotOrROP:
dst = (NOT src) OR dst NotXorROP:
dst = (NOT src) XOR dst AndROP
dst = src AND dst NotROP:
dst = NOT dst ClearROP:
dst = 0 SetROP:
dst = 1 NopROP:
dst = dst AndNotROP:
dst = src AND (NOT dst) OrNotROP:
dst = src OR (NOT dst) NandROP:
dst = NOT (src AND dst) NorROP:
dst = NOT (src OR dst) The ignoreMask argument (default FALSE) applies where src is a QPixmap with a mask. If ignoreMask is TRUE, bitBlt ignores the pixmap's mask.
BitBlt has two restrictions:
Copies a block of pixels from src to dst, perhaps merging each pixel according to the raster operation rop. sx, sy is the top-left pixel in src (0, 0) by default, dx, dy is the top-left position in dst and sw, sh is the size of the copied block (all of src by default).
The most common values for rop are CopyROP and XorROP; the Qt::RasterOp documentation defines all the possible values.
If ignoreMask is FALSE (the default) and src is a masked QPixmap, the entire blit is masked by {src}->mask().
If src, dst, sw or sh is 0, bitBlt() does nothing. If sw or sh is negative bitBlt() copies starting at sx (and respectively, sy) and ending at the right end (respectively, bottom) of src.
src 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.
bitBlt() does nothing if src has a greater depth than dst. If you need to for example, draw a 24-bit pixmap on an 8-bit widget, you must use drawPixmap().
void bitBlt | ( | QPaintDevice * | dst, |
const QPoint & | dp, | ||
const QPaintDevice * | src, | ||
const QRect & | sr, | ||
RasterOp | rop | ||
) | [related] |
Q_EXPORT void bitBlt | ( | QPaintDevice * | dst, |
int | dx, | ||
int | dy, | ||
const QPaintDevice * | src, | ||
int | sx = 0 , |
||
int | sy = 0 , |
||
int | sw = -1 , |
||
int | sh = -1 , |
||
Qt::RasterOp | rop = Qt::CopyROP , |
||
bool | ignoreMask = FALSE |
||
) | [friend] |
QPaintDeviceMetrics [friend] |
ushort QPaintDevice::devFlags [protected] |
ushort QPaintDevice::painters [protected] |