Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef QPAINTDEVICE_H
00043 #define QPAINTDEVICE_H
00044
00045 #include <QtGui/qwindowdefs.h>
00046 #include <QtCore/qrect.h>
00047
00048 QT_BEGIN_HEADER
00049
00050 QT_BEGIN_NAMESPACE
00051
00052 QT_MODULE(Gui)
00053
00054 #if defined(Q_WS_QWS)
00055 class QWSDisplay;
00056 #endif
00057
00058 class QPaintEngine;
00059
00060 class Q_GUI_EXPORT QPaintDevice
00061 {
00062 public:
00063 enum PaintDeviceMetric {
00064 PdmWidth = 1,
00065 PdmHeight,
00066 PdmWidthMM,
00067 PdmHeightMM,
00068 PdmNumColors,
00069 PdmDepth,
00070 PdmDpiX,
00071 PdmDpiY,
00072 PdmPhysicalDpiX,
00073 PdmPhysicalDpiY
00074 };
00075
00076 virtual ~QPaintDevice();
00077
00078 virtual int devType() const;
00079 bool paintingActive() const;
00080 virtual QPaintEngine *paintEngine() const = 0;
00081
00082 #if defined(Q_WS_QWS)
00083 static QWSDisplay *qwsDisplay();
00084 #endif
00085
00086 #ifdef Q_WS_WIN
00087 virtual HDC getDC() const;
00088 virtual void releaseDC(HDC hdc) const;
00089 #endif
00090
00091 int width() const { return metric(PdmWidth); }
00092 int height() const { return metric(PdmHeight); }
00093 int widthMM() const { return metric(PdmWidthMM); }
00094 int heightMM() const { return metric(PdmHeightMM); }
00095 int logicalDpiX() const { return metric(PdmDpiX); }
00096 int logicalDpiY() const { return metric(PdmDpiY); }
00097 int physicalDpiX() const { return metric(PdmPhysicalDpiX); }
00098 int physicalDpiY() const { return metric(PdmPhysicalDpiY); }
00099 #ifdef QT_DEPRECATED
00100 QT_DEPRECATED int numColors() const { return metric(PdmNumColors); }
00101 #endif
00102 int colorCount() const { return metric(PdmNumColors); }
00103 int depth() const { return metric(PdmDepth); }
00104
00105 protected:
00106 QPaintDevice();
00107 virtual int metric(PaintDeviceMetric metric) const;
00108
00109 ushort painters;
00110
00111 private:
00112 Q_DISABLE_COPY(QPaintDevice)
00113
00114 #if defined(Q_WS_X11) && defined(QT3_SUPPORT)
00115 public:
00116 QT3_SUPPORT Display *x11Display() const;
00117 QT3_SUPPORT int x11Screen() const;
00118 QT3_SUPPORT int x11Depth() const;
00119 QT3_SUPPORT int x11Cells() const;
00120 QT3_SUPPORT Qt::HANDLE x11Colormap() const;
00121 QT3_SUPPORT bool x11DefaultColormap() const;
00122 QT3_SUPPORT void *x11Visual() const;
00123 QT3_SUPPORT bool x11DefaultVisual() const;
00124
00125 static QT3_SUPPORT Display *x11AppDisplay();
00126 static QT3_SUPPORT int x11AppScreen();
00127 static QT3_SUPPORT int x11AppDepth(int screen = -1);
00128 static QT3_SUPPORT int x11AppCells(int screen = -1);
00129 static QT3_SUPPORT Qt::HANDLE x11AppRootWindow(int screen = -1);
00130 static QT3_SUPPORT Qt::HANDLE x11AppColormap(int screen = -1);
00131 static QT3_SUPPORT void *x11AppVisual(int screen = -1);
00132 static QT3_SUPPORT bool x11AppDefaultColormap(int screen =-1);
00133 static QT3_SUPPORT bool x11AppDefaultVisual(int screen =-1);
00134 static QT3_SUPPORT int x11AppDpiX(int screen = -1);
00135 static QT3_SUPPORT int x11AppDpiY(int screen = -1);
00136 static QT3_SUPPORT void x11SetAppDpiX(int, int);
00137 static QT3_SUPPORT void x11SetAppDpiY(int, int);
00138 #endif
00139
00140 friend class QPainter;
00141 friend class QFontEngineMac;
00142 friend class QX11PaintEngine;
00143 friend Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, PaintDeviceMetric metric);
00144 };
00145
00146 #ifdef QT3_SUPPORT
00147 QT3_SUPPORT Q_GUI_EXPORT
00148 void bitBlt(QPaintDevice *dst, int dx, int dy,
00149 const QPaintDevice *src, int sx=0, int sy=0, int sw=-1, int sh=-1,
00150 bool ignoreMask=false);
00151
00152 QT3_SUPPORT Q_GUI_EXPORT
00153 void bitBlt(QPaintDevice *dst, int dx, int dy,
00154 const QImage *src, int sx=0, int sy=0, int sw=-1, int sh=-1,
00155 int conversion_flags=0);
00156
00157 QT3_SUPPORT Q_GUI_EXPORT
00158 void bitBlt(QPaintDevice *dst, const QPoint &dp,
00159 const QPaintDevice *src, const QRect &sr=QRect(0,0,-1,-1),
00160 bool ignoreMask=false);
00161 #endif
00162
00163
00164
00165
00166
00167 inline int QPaintDevice::devType() const
00168 { return QInternal::UnknownDevice; }
00169
00170 inline bool QPaintDevice::paintingActive() const
00171 { return painters != 0; }
00172
00173 QT_END_NAMESPACE
00174
00175 QT_END_HEADER
00176
00177 #endif // QPAINTDEVICE_H