source: trunk/src/gui/painting/qpaintdevice.qdoc@ 758

Last change on this file since 758 was 651, checked in by Dmitry A. Kuminov, 16 years ago

trunk: Merged in qt 4.6.2 sources.

  • Property svn:eol-style set to native
File size: 10.1 KB
RevLine 
[556]1/****************************************************************************
2**
[651]3** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
[556]4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the documentation of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42/*!
43 \class QPaintDevice
44 \brief The QPaintDevice class is the base class of objects that
45 can be painted.
46
47 \ingroup painting
48
49 A paint device is an abstraction of a two-dimensional space that
50 can be drawn using a QPainter. Its default coordinate system has
51 its origin located at the top-left position. X increases to the
52 right and Y increases downwards. The unit is one pixel.
53
54 The drawing capabilities of QPaintDevice are currently implemented
55 by the QWidget, QImage, QPixmap, QGLPixelBuffer, QPicture, and
56 QPrinter subclasses.
57
58 To implement support for a new backend, you must derive from
59 QPaintDevice and reimplement the virtual paintEngine() function to
60 tell QPainter which paint engine should be used to draw on this
61 particular device. Note that you also must create a corresponding
62 paint engine to be able to draw on the device, i.e derive from
63 QPaintEngine and reimplement its virtual functions.
64
65 \warning Qt requires that a QApplication object exists before
66 any paint devices can be created. Paint devices access window
67 system resources, and these resources are not initialized before
68 an application object is created.
69
70 The QPaintDevice class provides several functions returning the
71 various device metrics: The depth() function returns its bit depth
72 (number of bit planes). The height() function returns its height
73 in default coordinate system units (e.g. pixels for QPixmap and
74 QWidget) while heightMM() returns the height of the device in
75 millimeters. Similiarily, the width() and widthMM() functions
76 return the width of the device in default coordinate system units
77 and in millimeters, respectively. Alternatively, the protected
78 metric() function can be used to retrieve the metric information
79 by specifying the desired PaintDeviceMetric as argument.
80
81 The logicalDpiX() and logicalDpiY() functions return the
82 horizontal and vertical resolution of the device in dots per
83 inch. The physicalDpiX() and physicalDpiY() functions also return
84 the resolution of the device in dots per inch, but note that if
85 the logical and physical resolution differ, the corresponding
86 QPaintEngine must handle the mapping. Finally, the colorCount()
87 function returns the number of different colors available for the
88 paint device.
89
90 \sa QPaintEngine, QPainter, {The Coordinate System}, {The Paint
91 System}
92*/
93
94/*!
95 \enum QPaintDevice::PaintDeviceMetric
96
97 Describes the various metrics of a paint device.
98
99 \value PdmWidth The width of the paint device in default
100 coordinate system units (e.g. pixels for QPixmap and QWidget). See
101 also width().