Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

TQPaintDevice Class Reference

The TQPaintDevice class is the base class of objects that can be painted. More...

#include <qpaintdevice.h>

Inherited by TQWidget, TQPixmap, TQPicture, and TQPrinter.

List of all member functions.

Public Members

Static Public Members

Protected Members

Related Functions


Detailed Description

The TQPaintDevice 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 TQPainter. The drawing capabilities are implemented by the subclasses TQWidget, TQPixmap, TQPicture and TQPrinter.

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 TQPainter::setWorldMatrix().

Example (draw on a paint device):

    void MyWidget::paintEvent( TQPaintEvent * )
    {
        TQPainter 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 );
    

Warning: TQt retquires that a TQApplication 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.

See also Graphics Classes and Image Processing Classes.


Member Function Documentation

TQPaintDevice::TQPaintDevice ( uint devflags ) [protected]

Constructs a paint device with internal flags devflags. This constructor can be invoked only from TQPaintDevice subclasses.

TQPaintDevice::~TQPaintDevice () [virtual]

Destroys the paint device and frees window system resources.

bool TQPaintDevice::cmd ( int, TQPainter *, TQPDevCmdParam * ) [virtual protected]

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, TQPicture).

TQt::HANDLE TQPaintDevice::handle () const [virtual]

Returns the window system handle of the paint device, for low-level access. Using this function is not portable.

The HANDLE type varies with platform; see qpaintdevice.h and qwindowdefs.h for details.

See also x11Display().

bool TQPaintDevice::isExtDev () const

Returns TRUE if the device is an external paint device; otherwise returns FALSE.

External paint devices cannot be bitBlt()'ed from. TQPicture and TQPrinter are external paint devices.

bool TQPaintDevice::paintingActive () const

Returns TRUE if the device is being painted, i.e. someone has called TQPainter::begin() but not yet called TQPainter::end() for this device; otherwise returns FALSE.

See also TQPainter::isActive().

int TQPaintDevice::x11AppCells () [static]

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.

See also x11Colormap().

int TQPaintDevice::x11AppCells ( int screen ) [static]

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

Returns the number of entries in the colormap for screen screen of the X display global to the application (X11 only). Using this function is not portable.

See also x11Colormap().

TQt::HANDLE TQPaintDevice::x11AppColormap () [static]

Returns the colormap for the default screen of the X display global to the application (X11 only). Using this function is not portable.

See also x11Cells().

TQt::HANDLE TQPaintDevice::x11AppColormap ( int screen ) [static]

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

Returns the colormap for screen screen of the X display global to the application (X11 only). Using this function is not portable.

See also x11Cells().

bool TQPaintDevice::x11AppDefaultColormap () [static]

Returns the default colormap for the default screen of the X display global to the application (X11 only). Using this function is not portable.

See also x11Cells().

bool TQPaintDevice::x11AppDefaultColormap ( int screen ) [static]

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

Returns the default colormap for screen screen of the X display global to the application (X11 only). Using this function is not portable.

See also x11Cells().

bool TQPaintDevice::x11AppDefaultVisual () [static]

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.

bool TQPaintDevice::x11AppDefaultVisual ( int screen ) [static]

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

Returns TRUE if the Visual used is the default for screen screen of the X display global to the application (X11 only); otherwise returns FALSE. Using this function is not portable.

int TQPaintDevice::x11AppDepth ( int screen ) [static]

Returns the depth for screen screen of the X display global to the application (X11 only). Using this function is not portable.

See also TQPixmap::defaultDepth().

int TQPaintDevice::x11AppDepth () [static]

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

Returns the depth for the default screen of the X display global to the application (X11 only). Using this function is not portable.

See also TQPixmap::defaultDepth().

Display * TQPaintDevice::x11AppDisplay () [static]

Returns a pointer to the X display global to the application (X11 only). Using this function is not portable.

See also handle().

int TQPaintDevice::x11AppDpiX ( int screen ) [static]

Returns the horizontal DPI of the X display (X11 only) for screen screen. Using this function is not portable. See TQPaintDeviceMetrics for portable access to related information. Using this function is not portable.

See also x11AppDpiY(), x11SetAppDpiX(), and TQPaintDeviceMetrics::logicalDpiX().

int TQPaintDevice::x11AppDpiX () [static]

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

Returns the horizontal DPI of the X display (X11 only) for the default screen. Using this function is not portable. See TQPaintDeviceMetrics for portable access to related information. Using this function is not portable.

int TQPaintDevice::x11AppDpiY ( int screen ) [static]

Returns the vertical DPI of the X11 display (X11 only) for screen screen. Using this function is not portable. See TQPaintDeviceMetrics for portable access to related information. Using this function is not portable.

See also x11AppDpiX(), x11SetAppDpiY(), and TQPaintDeviceMetrics::logicalDpiY().

int TQPaintDevice::x11AppDpiY () [static]

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

Returns the vertical DPI of the X11 display (X11 only) for the default screen. Using this function is not portable. See TQPaintDeviceMetrics for portable access to related information. Using this function is not portable.

See also x11AppDpiX(), x11SetAppDpiY(), and TQPaintDeviceMetrics::logicalDpiY().

TQt::HANDLE TQPaintDevice::x11AppRootWindow () [static]

Returns the root window for the default screen of the X display global to the applicatoin (X11 only). Using this function is not portable.

TQt::HANDLE TQPaintDevice::x11AppRootWindow ( int screen ) [static]

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

Returns the root window for screen screen of the X display global to the applicatoin (X11 only). Using this function is not portable.

int TQPaintDevice::x11AppScreen () [static]

Returns the screen number on the X display global to the application (X11 only). Using this function is not portable.

void * TQPaintDevice::x11AppVisual () [static]

Returns the Visual for the default screen of the X display global to the application (X11 only). Using this function is not portable.

void * TQPaintDevice::x11AppVisual ( int screen ) [static]

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

Returns the Visual for screen screen of the X display global to the application (X11 only). Using this function is not portable.

int TQPaintDevice::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.

See also x11Colormap().

TQt::HANDLE TQPaintDevice::x11Colormap () const

Returns the colormap of the X display for the paint device (X11 only). Using this function is not portable.

See also x11Cells().

bool TQPaintDevice::x11DefaultColormap () const

Returns the default colormap of the X display for the paint device (X11 only). Using this function is not portable.

See also x11Cells().

bool TQPaintDevice::x11DefaultVisual () const

Returns the default Visual of the X display for the paint device (X11 only). Using this function is not portable.

int TQPaintDevice::x11Depth () const

Returns the depth of the X display for the paint device (X11 only). Using this function is not portable.

See also TQPixmap::defaultDepth().

Display * TQPaintDevice::x11Display () const

Returns a pointer to the X display for the paint device (X11 only). Using this function is not portable.

See also handle().

int TQPaintDevice::x11Screen () const

Returns the screen number on the X display for the paint device (X11 only). Using this function is not portable.

void TQPaintDevice::x11SetAppDpiX ( int dpi, int screen ) [static]

Sets the value returned by x11AppDpiX() to dpi for screen 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.

See also x11SetAppDpiY().

void TQPaintDevice::x11SetAppDpiX ( int dpi ) [static]

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

Sets the value returned by x11AppDpiX() to dpi 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.

void TQPaintDevice::x11SetAppDpiY ( int dpi, int screen ) [static]

Sets the value returned by x11AppDpiY() to dpi for screen 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.

See also x11SetAppDpiX().

void TQPaintDevice::x11SetAppDpiY ( int dpi ) [static]

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

Sets the value returned by x11AppDpiY() to dpi 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.

void * TQPaintDevice::x11Visual () const

Returns the Visual of the X display for the paint device (X11 only). Using this function is not portable.


Related Functions

void bitBlt ( TQPaintDevice * dst, int dx, int dy, const TQPaintDevice * src, int sx, int sy, int sw, int sh, TQt::RasterOp rop, bool ignoreMask )

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 TQt::RasterOp documentation defines all the possible values.

If ignoreMask is FALSE (the default) and src is a masked TQPixmap, 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 TQWidget or TQPixmap. You cannot blit from a TQPrinter, 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 ( TQPaintDevice * dst, const TQPoint & dp, const TQPaintDevice * src, const TQRect & sr, RasterOp rop )

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

Overloaded bitBlt() with the destination point dp and source rectangle sr.


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


Copyright © 2007 TrolltechTrademarks
TQt 3.3.8