summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-08-18 08:34:18 +0200
committerJason Barron <jbarron@trolltech.com>2009-08-18 08:34:18 +0200
commitfd6740b6ade6e7f8e51a9cc558b723e7fae15ccf (patch)
treeaa2ba4ce64d047d73c29ab0616e8a89d352c3abd /src/gui/painting
parentd24029e3d4639f1300e7a68858936911df969f69 (diff)
parent572e165dcb8cc8fcdfaa4ab9bdab050f6a6cc173 (diff)
Merge commit 'qt/master'
Conflicts: doc/src/examples.qdoc doc/src/plugins-howto.qdoc doc/src/topics.qdoc examples/phonon/musicplayer/mainwindow.cpp src/3rdparty/freetype/src/base/ftobjs.c src/corelib/global/qglobal.h src/corelib/tools/qalgorithms.h src/corelib/tools/qshareddata.cpp src/corelib/tools/qsharedpointer.cpp src/corelib/tools/tools.pri src/corelib/xml/qxmlstream.h src/gui/painting/painting.pri src/gui/widgets/qdatetimeedit.cpp tests/auto/qdesktopservices/qdesktopservices.pro tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp tests/auto/qtextcodec/test/test.pro
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/painting.pri16
-rw-r--r--src/gui/painting/qblendfunctions.cpp633
-rw-r--r--src/gui/painting/qbrush.cpp10
-rw-r--r--src/gui/painting/qcolor.cpp4
-rw-r--r--src/gui/painting/qcolormap.qdoc152
-rw-r--r--src/gui/painting/qdrawhelper_p.h9
-rw-r--r--src/gui/painting/qmatrix.cpp2
-rw-r--r--src/gui/painting/qpaintdevice.cpp66
-rw-r--r--src/gui/painting/qpaintdevice.qdoc289
-rw-r--r--src/gui/painting/qpaintdevice_mac.cpp28
-rw-r--r--src/gui/painting/qpaintdevice_qws.cpp33
-rw-r--r--src/gui/painting/qpaintdevice_win.cpp21
-rw-r--r--src/gui/painting/qpaintdevice_x11.cpp21
-rw-r--r--src/gui/painting/qpaintengine.cpp2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp38
-rw-r--r--src/gui/painting/qpainter.cpp14
-rw-r--r--src/gui/painting/qpainterpath.cpp4
-rw-r--r--src/gui/painting/qpainterpath.h4
-rw-r--r--src/gui/painting/qpdf.cpp15
-rw-r--r--src/gui/painting/qpen.cpp4
-rw-r--r--src/gui/painting/qpolygon.cpp4
-rw-r--r--src/gui/painting/qprintengine_win.cpp8
-rw-r--r--src/gui/painting/qprinter.cpp14
-rw-r--r--src/gui/painting/qprinterinfo.qdoc139
-rw-r--r--src/gui/painting/qregion.cpp2
-rw-r--r--src/gui/painting/qstylepainter.cpp2
-rw-r--r--src/gui/painting/qtransform.cpp2
27 files changed, 1368 insertions, 168 deletions
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index 2f5b2d6cd7..7ea4dc1bc1 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -46,7 +46,7 @@ HEADERS += \
SOURCES += \
painting/qbezier.cpp \
- painting/qblendfunctions.cpp \
+ painting/qblendfunctions.cpp \
painting/qbrush.cpp \
painting/qcolor.cpp \
painting/qcolor_p.cpp \
@@ -57,6 +57,7 @@ SOURCES += \
painting/qmatrix.cpp \
painting/qmemrotate.cpp \
painting/qoutlinemapper.cpp \
+ painting/qpaintdevice.cpp \
painting/qpaintengine.cpp \
painting/qpaintengine_alpha.cpp \
painting/qpaintengine_preview.cpp \
@@ -75,13 +76,10 @@ SOURCES += \
painting/qstroker.cpp \
painting/qstylepainter.cpp \
painting/qtessellator.cpp \
- painting/qwindowsurface.cpp \
painting/qtextureglyphcache.cpp \
painting/qtransform.cpp \
+ painting/qwindowsurface.cpp \
- DEFINES += QT_RASTER_IMAGEENGINE
- win32:DEFINES += QT_RASTER_PAINTENGINE
- embedded:DEFINES += QT_RASTER_PAINTENGINE
symbian:DEFINES += QT_RASTER_PAINTENGINE
SOURCES += \
painting/qpaintengine_raster.cpp \
@@ -361,6 +359,7 @@ embedded {
}
+
symbian {
HEADERS += painting/qwindowsurface_s60_p.h
SOURCES += painting/qwindowsurface_s60.cpp
@@ -376,3 +375,10 @@ symbian {
QMAKE_CXXFLAGS.ARMCC *= -O3
}
+contains(QT_CONFIG, zlib) {
+ INCLUDEPATH += ../3rdparty/zlib
+} else:!contains(QT_CONFIG, no-zlib) {
+ unix:LIBS_PRIVATE += -lz
+# win32:LIBS += libz.lib
+}
+
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp
index 1121c0eb19..e447301a9a 100644
--- a/src/gui/painting/qblendfunctions.cpp
+++ b/src/gui/painting/qblendfunctions.cpp
@@ -793,8 +793,351 @@ void qt_scale_image_argb32_on_argb32(uchar *destPixels, int dbpl,
}
}
+struct QTransformImageVertex
+{
+ qreal x, y, u, v; // destination coordinates (x, y) and source coordinates (u, v)
+};
+
+template <class SrcT, class DestT, class Blender>
+void qt_transform_image_rasterize(DestT *destPixels, int dbpl,
+ const SrcT *srcPixels, int sbpl,
+ const QTransformImageVertex &topLeft, const QTransformImageVertex &bottomLeft,
+ const QTransformImageVertex &topRight, const QTransformImageVertex &bottomRight,
+ const QRect &sourceRect,
+ const QRect &clip,
+ qreal topY, qreal bottomY,
+ int dudx, int dvdx, int dudy, int dvdy, int u0, int v0,
+ Blender blender)
+{
+ int fromY = qMax(qRound(topY), clip.top());
+ int toY = qMin(qRound(bottomY), clip.top() + clip.height());
+ if (fromY >= toY)
+ return;
+
+ qreal leftSlope = (bottomLeft.x - topLeft.x) / (bottomLeft.y - topLeft.y);
+ qreal rightSlope = (bottomRight.x - topRight.x) / (bottomRight.y - topRight.y);
+ int dx_l = int(leftSlope * 0x10000);
+ int dx_r = int(rightSlope * 0x10000);
+ int x_l = int((topLeft.x + (0.5 + fromY - topLeft.y) * leftSlope + 0.5) * 0x10000);
+ int x_r = int((topRight.x + (0.5 + fromY - topRight.y) * rightSlope + 0.5) * 0x10000);
+
+ int fromX, toX, x1, x2, u, v, i, ii;
+ DestT *line;
+ for (int y = fromY; y < toY; ++y) {
+ line = reinterpret_cast<DestT *>(reinterpret_cast<uchar *>(destPixels) + y * dbpl);
+
+ fromX = qMax(x_l >> 16, clip.left());
+ toX = qMin(x_r >> 16, clip.left() + clip.width());
+ if (fromX < toX) {
+ // Because of rounding, we can get source coordinates outside the source image.
+ // Clamp these coordinates to the source rect to avoid segmentation fault and
+ // garbage on the screen.
+
+ // Find the first pixel on the current scan line where the source coordinates are within the source rect.
+ x1 = fromX;
+ u = x1 * dudx + y * dudy + u0;
+ v = x1 * dvdx + y * dvdy + v0;
+ for (; x1 < toX; ++x1) {
+ int uu = u >> 16;
+ int vv = v >> 16;
+ if (uu >= sourceRect.left() && uu < sourceRect.left() + sourceRect.width()
+ && vv >= sourceRect.top() && vv < sourceRect.top() + sourceRect.height()) {
+ break;
+ }
+ u += dudx;
+ v += dvdx;
+ }
+
+ // Find the last pixel on the current scan line where the source coordinates are within the source rect.
+ x2 = toX;
+ u = (x2 - 1) * dudx + y * dudy + u0;
+ v = (x2 - 1) * dvdx + y * dvdy + v0;
+ for (; x2 > x1; --x2) {
+ int uu = u >> 16;
+ int vv = v >> 16;
+ if (uu >= sourceRect.left() && uu < sourceRect.left() + sourceRect.width()
+ && vv >= sourceRect.top() && vv < sourceRect.top() + sourceRect.height()) {
+ break;
+ }
+ u -= dudx;
+ v -= dvdx;
+ }
+
+ // Set up values at the beginning of the scan line.
+ u = fromX * dudx + y * dudy + u0;
+ v = fromX * dvdx + y * dvdy + v0;
+ line += fromX;
+
+ // Beginning of the scan line, with per-pixel checks.
+ i = x1 - fromX;
+ while (i) {
+ int uu = qBound(sourceRect.left(), u >> 16, sourceRect.left() + sourceRect.width() - 1);
+ int vv = qBound(sourceRect.top(), v >> 16, sourceRect.top() + sourceRect.height() - 1);
+ blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + vv * sbpl)[uu]);
+ u += dudx;
+ v += dvdx;
+ ++line;
+ --i;
+ }
+
+ // Middle of the scan line, without checks.
+ // Manual loop unrolling.
+ i = x2 - x1;
+ ii = i >> 3;
+ while (ii) {
+ blender.write(&line[0], reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx;
+ blender.write(&line[1], reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx;
+ blender.write(&line[2], reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx;
+ blender.write(&line[3], reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx;
+ blender.write(&line[4], reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx;
+ blender.write(&line[5], reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx;
+ blender.write(&line[6], reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx;
+ blender.write(&line[7], reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx;
+ line += 8;
+ --ii;
+ }
+ switch (i & 7) {
+ case 7: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line;
+ case 6: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line;
+ case 5: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line;
+ case 4: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line;
+ case 3: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line;
+ case 2: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line;
+ case 1: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line;
+ }
+
+ // End of the scan line, with per-pixel checks.
+ i = toX - x2;
+ while (i) {
+ int uu = qBound(sourceRect.left(), u >> 16, sourceRect.left() + sourceRect.width() - 1);
+ int vv = qBound(sourceRect.top(), v >> 16, sourceRect.top() + sourceRect.height() - 1);
+ blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + vv * sbpl)[uu]);
+ u += dudx;
+ v += dvdx;
+ ++line;
+ --i;
+ }
+ }
+ x_l += dx_l;
+ x_r += dx_r;
+ }
+}
+
+template <class SrcT, class DestT, class Blender>
+void qt_transform_image(DestT *destPixels, int dbpl,
+ const SrcT *srcPixels, int sbpl,
+ const QRectF &targetRect,
+ const QRectF &sourceRect,
+ const QRect &clip,
+ const QTransform &targetRectTransform,
+ Blender blender)
+{
+ enum Corner
+ {
+ TopLeft,
+ TopRight,
+ BottomRight,
+ BottomLeft
+ };
+
+ // map source rectangle to destination.
+ QTransformImageVertex v[4];
+ v[TopLeft].u = v[BottomLeft].u = sourceRect.left();
+ v[TopLeft].v = v[TopRight].v = sourceRect.top();
+ v[TopRight].u = v[BottomRight].u = sourceRect.right();
+ v[BottomLeft].v = v[BottomRight].v = sourceRect.bottom();
+ targetRectTransform.map(targetRect.left(), targetRect.top(), &v[TopLeft].x, &v[TopLeft].y);
+ targetRectTransform.map(targetRect.right(), targetRect.top(), &v[TopRight].x, &v[TopRight].y);
+ targetRectTransform.map(targetRect.left(), targetRect.bottom(), &v[BottomLeft].x, &v[BottomLeft].y);
+ targetRectTransform.map(targetRect.right(), targetRect.bottom(), &v[BottomRight].x, &v[BottomRight].y);
+
+ // find topmost vertex.
+ int topmost = 0;
+ for (int i = 1; i < 4; ++i) {
+ if (v[i].y < v[topmost].y)
+ topmost = i;
+ }
+ // rearrange array such that topmost vertex is at index 0.
+ switch (topmost) {
+ case 1:
+ {
+ QTransformImageVertex t = v[0];
+ for (int i = 0; i < 3; ++i)
+ v[i] = v[i+1];
+ v[3] = t;
+ }
+ break;
+ case 2:
+ qSwap(v[0], v[2]);
+ qSwap(v[1], v[3]);
+ break;
+ case 3:
+ {
+ QTransformImageVertex t = v[3];
+ for (int i = 3; i > 0; --i)
+ v[i] = v[i-1];
+ v[0] = t;
+ }
+ break;
+ }
+
+ // if necessary, swap vertex 1 and 3 such that 1 is to the left of 3.
+ qreal dx1 = v[1].x - v[0].x;
+ qreal dy1 = v[1].y - v[0].y;
+ qreal dx2 = v[3].x - v[0].x;
+ qreal dy2 = v[3].y - v[0].y;
+ if (dx1 * dy2 - dx2 * dy1 > 0)
+ qSwap(v[1], v[3]);
+
+ QTransformImageVertex u = {v[1].x - v[0].x, v[1].y - v[0].y, v[1].u - v[0].u, v[1].v - v[0].v};
+ QTransformImageVertex w = {v[2].x - v[0].x, v[2].y - v[0].y, v[2].u - v[0].u, v[2].v - v[0].v};
+
+ qreal det = u.x * w.y - u.y * w.x;
+ if (det == 0)
+ return;
+
+ qreal invDet = 1.0 / det;
+ qreal m11, m12, m21, m22, mdx, mdy;
+
+ m11 = (u.u * w.y - u.y * w.u) * invDet;
+ m12 = (u.x * w.u - u.u * w.x) * invDet;
+ m21 = (u.v * w.y - u.y * w.v) * invDet;
+ m22 = (u.x * w.v - u.v * w.x) * invDet;
+ mdx = v[0].u - m11 * v[0].x - m12 * v[0].y;
+ mdy = v[0].v - m21 * v[0].x - m22 * v[0].y;
+
+ int dudx = int(m11 * 0x10000);
+ int dvdx = int(m21 * 0x10000);
+ int dudy = int(m12 * 0x10000);
+ int dvdy = int(m22 * 0x10000);
+ int u0 = qCeil((0.5 * m11 + 0.5 * m12 + mdx) * 0x10000) - 1;
+ int v0 = qCeil((0.5 * m21 + 0.5 * m22 + mdy) * 0x10000) - 1;
+
+ int x1 = qFloor(sourceRect.left());
+ int y1 = qFloor(sourceRect.top());
+ int x2 = qCeil(sourceRect.right());
+ int y2 = qCeil(sourceRect.bottom());
+ QRect sourceRectI(x1, y1, x2 - x1, y2 - y1);
+
+ // rasterize trapezoids.
+ if (v[1].y < v[3].y) {
+ qt_transform_image_rasterize(destPixels, dbpl, srcPixels, sbpl, v[0], v[1], v[0], v[3], sourceRectI, clip, v[0].y, v[1].y, dudx, dvdx, dudy, dvdy, u0, v0, blender);
+ qt_transform_image_rasterize(destPixels, dbpl, srcPixels, sbpl, v[1], v[2], v[0], v[3], sourceRectI, clip, v[1].y, v[3].y, dudx, dvdx, dudy, dvdy, u0, v0, blender);
+ qt_transform_image_rasterize(destPixels, dbpl, srcPixels, sbpl, v[1], v[2], v[3], v[2], sourceRectI, clip, v[3].y, v[2].y, dudx, dvdx, dudy, dvdy, u0, v0, blender);
+ } else {
+ qt_transform_image_rasterize(destPixels, dbpl, srcPixels, sbpl, v[0], v[1], v[0], v[3], sourceRectI, clip, v[0].y, v[3].y, dudx, dvdx, dudy, dvdy, u0, v0, blender);
+ qt_transform_image_rasterize(destPixels, dbpl, srcPixels, sbpl, v[0], v[1], v[3], v[2], sourceRectI, clip, v[3].y, v[1].y, dudx, dvdx, dudy, dvdy, u0, v0, blender);
+ qt_transform_image_rasterize(destPixels, dbpl, srcPixels, sbpl, v[1], v[2], v[3], v[2], sourceRectI, clip, v[1].y, v[2].y, dudx, dvdx, dudy, dvdy, u0, v0, blender);
+ }
+}
+
+void qt_transform_image_rgb16_on_rgb16(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ const QRectF &targetRect,
+ const QRectF &sourceRect,
+ const QRect &clip,
+ const QTransform &targetRectTransform,
+ int const_alpha)
+{
+ if (const_alpha == 256) {
+ Blend_RGB16_on_RGB16_NoAlpha noAlpha;
+ qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl,
+ reinterpret_cast<const quint16 *>(srcPixels), sbpl,
+ targetRect, sourceRect, clip, targetRectTransform, noAlpha);
+ } else {
+ Blend_RGB16_on_RGB16_ConstAlpha constAlpha(const_alpha);
+ qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl,
+ reinterpret_cast<const quint16 *>(srcPixels), sbpl,
+ targetRect, sourceRect, clip, targetRectTransform, constAlpha);
+ }
+}
+
+void qt_transform_image_argb24_on_rgb16(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ const QRectF &targetRect,
+ const QRectF &sourceRect,
+ const QRect &clip,
+ const QTransform &targetRectTransform,
+ int const_alpha)
+{
+ if (const_alpha == 256) {
+ Blend_ARGB24_on_RGB16_SourceAlpha noAlpha;
+ qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl,
+ reinterpret_cast<const qargb8565 *>(srcPixels), sbpl,
+ targetRect, sourceRect, clip, targetRectTransform, noAlpha);
+ } else {
+ Blend_ARGB24_on_RGB16_SourceAndConstAlpha constAlpha(const_alpha);
+ qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl,
+ reinterpret_cast<const qargb8565 *>(srcPixels), sbpl,
+ targetRect, sourceRect, clip, targetRectTransform, constAlpha);
+ }
+}
+void qt_transform_image_argb32_on_rgb16(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ const QRectF &targetRect,
+ const QRectF &sourceRect,
+ const QRect &clip,
+ const QTransform &targetRectTransform,
+ int const_alpha)
+{
+ if (const_alpha == 256) {
+ Blend_ARGB32_on_RGB16_SourceAlpha noAlpha;
+ qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl,
+ reinterpret_cast<const quint32 *>(srcPixels), sbpl,
+ targetRect, sourceRect, clip, targetRectTransform, noAlpha);
+ } else {
+ Blend_ARGB32_on_RGB16_SourceAndConstAlpha constAlpha(const_alpha);
+ qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl,
+ reinterpret_cast<const quint32 *>(srcPixels), sbpl,
+ targetRect, sourceRect, clip, targetRectTransform, constAlpha);
+ }
+}
+
+
+void qt_transform_image_rgb32_on_rgb32(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ const QRectF &targetRect,
+ const QRectF &sourceRect,
+ const QRect &clip,
+ const QTransform &targetRectTransform,
+ int const_alpha)
+{
+ if (const_alpha == 256) {
+ Blend_RGB32_on_RGB32_NoAlpha noAlpha;
+ qt_transform_image(reinterpret_cast<quint32 *>(destPixels), dbpl,
+ reinterpret_cast<const quint32 *>(srcPixels), sbpl,
+ targetRect, sourceRect, clip, targetRectTransform, noAlpha);
+ } else {
+ Blend_RGB32_on_RGB32_ConstAlpha constAlpha(const_alpha);
+ qt_transform_image(reinterpret_cast<quint32 *>(destPixels), dbpl,
+ reinterpret_cast<const quint32 *>(srcPixels), sbpl,
+ targetRect, sourceRect, clip, targetRectTransform, constAlpha);
+ }
+}
+
+void qt_transform_image_argb32_on_argb32(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ const QRectF &targetRect,
+ const QRectF &sourceRect,
+ const QRect &clip,
+ const QTransform &targetRectTransform,
+ int const_alpha)
+{
+ if (const_alpha == 256) {
+ Blend_ARGB32_on_ARGB32_SourceAlpha sourceAlpha;
+ qt_transform_image(reinterpret_cast<quint32 *>(destPixels), dbpl,
+ reinterpret_cast<const quint32 *>(srcPixels), sbpl,
+ targetRect, sourceRect, clip, targetRectTransform, sourceAlpha);
+ } else {
+ Blend_ARGB32_on_ARGB32_SourceAndConstAlpha constAlpha(const_alpha);
+ qt_transform_image(reinterpret_cast<quint32 *>(destPixels), dbpl,
+ reinterpret_cast<const quint32 *>(srcPixels), sbpl,
+ targetRect, sourceRect, clip, targetRectTransform, constAlpha);
+ }
+}
+
SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = {
{ // Format_Invalid
0, // Format_Invalid,
@@ -1378,5 +1721,295 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
}
};
+SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats] = {
+ { // Format_Invalid
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0 // Format_ARGB4444_Premultiplied,
+ },
+ { // Format_Mono
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0 // Format_ARGB4444_Premultiplied,
+ },
+ { // Format_MonoLSB
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0 // Format_ARGB4444_Premultiplied,
+ },
+ { // Format_Indexed8
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0 // Format_ARGB4444_Premultiplied,
+ },
+ { // Format_RGB32
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ qt_transform_image_rgb32_on_rgb32, // Format_RGB32,
+ 0, // Format_ARGB32,
+ qt_transform_image_argb32_on_argb32, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0 // Format_ARGB4444_Premultiplied,
+ },
+ { // Format_ARGB32
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0 // Format_ARGB4444_Premultiplied,
+ },
+ { // Format_ARGB32_Premultiplied
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ qt_transform_image_rgb32_on_rgb32, // Format_RGB32,
+ 0, // Format_ARGB32,
+ qt_transform_image_argb32_on_argb32, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0 // Format_ARGB4444_Premultiplied,
+ },
+ { // Format_RGB16
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ qt_transform_image_argb32_on_rgb16, // Format_ARGB32_Premultiplied,
+ qt_transform_image_rgb16_on_rgb16, // Format_RGB16,
+ qt_transform_image_argb24_on_rgb16, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0 // Format_ARGB4444_Premultiplied,
+ },
+ { // Format_ARGB8565_Premultiplied
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0 // Format_ARGB4444_Premultiplied,
+ },
+ { // Format_RGB666
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0 // Format_ARGB4444_Premultiplied,
+ },
+ { // Format_ARGB6666_Premultiplied
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0 // Format_ARGB4444_Premultiplied,
+ },
+ { // Format_RGB555
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0 // Format_ARGB4444_Premultiplied,
+ },
+ { // Format_ARGB8555_Premultiplied
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0 // Format_ARGB4444_Premultiplied,
+ },
+ { // Format_RGB888
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0 // Format_ARGB4444_Premultiplied,
+ },
+ { // Format_RGB444
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0 // Format_ARGB4444_Premultiplied,
+ },
+ { // Format_ARGB4444_Premultiplied
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0 // Format_ARGB4444_Premultiplied,
+ }
+};
QT_END_NAMESPACE
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 128940376e..b005842a16 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -258,7 +258,7 @@ struct QBrushDataPointerDeleter
/*!
\class QBrush
- \ingroup multimedia
+ \ingroup painting
\ingroup shared
\brief The QBrush class defines the fill pattern of shapes drawn
@@ -1164,7 +1164,7 @@ QDataStream &operator>>(QDataStream &s, QBrush &b)
/*!
\class QGradient
- \ingroup multimedia
+ \ingroup painting
\ingroup shared
\brief The QGradient class is used in combination with QBrush to
@@ -1528,7 +1528,7 @@ bool QGradient::operator==(const QGradient &gradient)
/*!
\class QLinearGradient
- \ingroup multimedia
+ \ingroup painting
\brief The QLinearGradient class is used in combination with QBrush to
specify a linear gradient brush.
@@ -1707,7 +1707,7 @@ void QLinearGradient::setFinalStop(const QPointF &stop)
/*!
\class QRadialGradient
- \ingroup multimedia
+ \ingroup painting
\brief The QRadialGradient class is used in combination with QBrush to
specify a radial gradient brush.
@@ -1964,7 +1964,7 @@ void QRadialGradient::setFocalPoint(const QPointF &focalPoint)
/*!
\class QConicalGradient
- \ingroup multimedia
+ \ingroup painting
\brief The QConicalGradient class is used in combination with QBrush to
specify a conical gradient brush.
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 11a9ae70ba..4e93f04d51 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -66,9 +66,9 @@ QT_BEGIN_NAMESPACE
\class QColor
\brief The QColor class provides colors based on RGB, HSV or CMYK values.
- \ingroup multimedia
+ \ingroup painting
\ingroup appearance
- \mainclass
+
A color is normally specified in terms of RGB (red, green, and
blue) components, but it is also possible to specify it in terms
diff --git a/src/gui/painting/qcolormap.qdoc b/src/gui/painting/qcolormap.qdoc
new file mode 100644
index 0000000000..e4a88f05ef
--- /dev/null
+++ b/src/gui/painting/qcolormap.qdoc
@@ -0,0 +1,152 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \class QColormap
+ \ingroup painting
+
+ \brief The QColormap class maps device independent QColors to device
+ dependent pixel values.
+*/
+
+/*! \enum QColormap::Mode
+
+ This enum describes how QColormap maps device independent RGB
+ values to device dependent pixel values.
+
+ \value Direct Pixel values are derived directly from the RGB
+ values, also known as "True Color."
+
+ \value Indexed Pixel values represent indexes into a vector of
+ available colors, i.e. QColormap uses the index of the color that
+ most closely matches an RGB value.
+
+ \value Gray Similar to \c Indexed, pixel values represent a vector
+ of available gray tones. QColormap uses the index of the gray
+ tone that most closely matches the computed gray tone of an RGB
+ value.
+*/
+
+/*!
+ \fn QColormap QColormap::instance(int screen)
+
+ Returns the colormap for the specified \a screen. If \a screen is
+ -1, this function returns the colormap for the default screen.
+*/
+
+/*!
+ \fn QColormap::QColormap(const QColormap &colormap)
+
+ Constructs a copy of another \a colormap.
+*/
+
+/*!
+ \fn QColormap::~QColormap()
+
+ Destroys the colormap.
+*/
+
+/*!
+ \fn int QColormap::size() const
+
+ Returns the size of the colormap for \c Indexed and \c Gray modes;
+ Returns -1 for \c Direct mode.
+
+ \sa colormap()
+*/
+
+/*!
+ \fn uint QColormap::pixel(const QColor &color) const
+
+ Returns a device dependent pixel value for the \a color.
+
+ \sa colorAt()
+*/
+
+/*!
+ \fn int QColormap::depth() const
+
+ Returns the depth of the device.
+
+ \sa size()
+*/
+
+/*!
+ \fn QColormap::Mode QColormap::mode() const
+
+ Returns the mode of this colormap.
+
+ \sa QColormap::Mode
+*/
+
+/*!
+ \fn const QColor QColormap::colorAt(uint pixel) const
+
+ Returns a QColor for the \a pixel.
+
+ \sa pixel()
+*/
+
+/*!
+ \fn const QVector<QColor> QColormap::colormap() const
+
+ Returns a vector of colors which represents the devices colormap
+ for \c Indexed and \c Gray modes. This function returns an empty
+ vector for \c Direct mode.
+
+ \sa size()
+*/
+
+/*! \fn HPALETTE QColormap::hPal()
+
+ This function is only available on Windows.
+
+ Returns an handle to the HPALETTE used by this colormap. If no
+ HPALETTE is being used, this function returns zero.
+*/
+
+/*! \since 4.2
+
+ \fn QColormap &QColormap::operator=(const QColormap &colormap)
+
+ Assigns the given \a colormap to \e this color map and returns
+ a reference to \e this color map.
+*/
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 942b088c4c..0607867bbe 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -146,6 +146,14 @@ typedef void (*SrcOverScaleFunc)(uchar *destPixels, int dbpl,
const QRect &clipRect,
int const_alpha);
+typedef void (*SrcOverTransformFunc)(uchar *destPixels, int dbpl,
+ const uchar *src, int spbl,
+ const QRectF &targetRect,
+ const QRectF &sourceRect,
+ const QRect &clipRect,
+ const QTransform &targetRectTransform,
+ int const_alpha);
+
struct DrawHelper {
ProcessSpans blendColor;
@@ -158,6 +166,7 @@ struct DrawHelper {
extern SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats];
extern SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats];
+extern SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats];
extern DrawHelper qDrawHelper[QImage::NImageFormats];
diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp
index ce71a84f5c..abff9bf6f6 100644
--- a/src/gui/painting/qmatrix.cpp
+++ b/src/gui/painting/qmatrix.cpp
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
coordinate system.
\obsolete
- \ingroup multimedia
+ \ingroup painting
A matrix specifies how to translate, scale, shear or rotate the
coordinate system, and is typically used when rendering graphics.
diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp
new file mode 100644
index 0000000000..6477952395
--- /dev/null
+++ b/src/gui/painting/qpaintdevice.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpaintdevice.h"
+
+QT_BEGIN_NAMESPACE
+
+extern void qt_painter_removePaintDevice(QPaintDevice *); //qpainter.cpp
+
+QPaintDevice::QPaintDevice()
+{
+ painters = 0;
+}
+
+QPaintDevice::~QPaintDevice()
+{
+ if (paintingActive())
+ qWarning("QPaintDevice: Cannot destroy paint device that is being "
+ "painted");
+ qt_painter_removePaintDevice(this);
+}
+
+
+int QPaintDevice::metric(PaintDeviceMetric) const
+{
+ qWarning("QPaintDevice::metrics: Device has no metric information");
+ return 0;
+}
diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc
new file mode 100644
index 0000000000..5933484383
--- /dev/null
+++ b/src/gui/painting/qpaintdevice.qdoc
@@ -0,0 +1,289 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \class QPaintDevice
+ \brief The QPaintDevice class is the base class of objects that
+ can be painted.
+
+ \ingroup painting
+
+ A paint device is an abstraction of a two-dimensional space that
+ can be drawn using a QPainter. Its default coordinate system has
+ its origin located at the top-left position. X increases to the
+ right and Y increases downwards. The unit is one pixel.
+
+ The drawing capabilities of QPaintDevice are currently implemented
+ by the QWidget, QImage, QPixmap, QGLPixelBuffer, QPicture, and
+ QPrinter subclasses.
+
+ To implement support for a new backend, you must derive from
+ QPaintDevice and reimplement the virtual paintEngine() function to
+ tell QPainter which paint engine should be used to draw on this
+ particular device. Note that you also must create a corresponding
+ paint engine to be able to draw on the device, i.e derive from
+ QPaintEngine and reimplement its virtual functions.
+
+ \warning Qt 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.
+
+ The QPaintDevice class provides several functions returning the
+ various device metrics: The depth() function returns its bit depth
+ (number of bit planes). The height() function returns its height
+ in default coordinate system units (e.g. pixels for QPixmap and
+ QWidget) while heightMM() returns the height of the device in
+ millimeters. Similiarily, the width() and widthMM() functions
+ return the width of the device in default coordinate system units
+ and in millimeters, respectively. Alternatively, the protected
+ metric() function can be used to retrieve the metric information
+ by specifying the desired PaintDeviceMetric as argument.
+
+ The logicalDpiX() and logicalDpiY() functions return the
+ horizontal and vertical resolution of the device in dots per
+ inch. The physicalDpiX() and physicalDpiY() functions also return
+ the resolution of the device in dots per inch, but note that if
+ the logical and vertical resolution differ, the corresponding
+ QPaintEngine must handle the mapping. Finally, the numColors()
+ function returns the number of different colors available for the
+ paint device.
+
+ \sa QPaintEngine, QPainter, {The Coordinate System}, {The Paint
+ System}
+*/
+
+/*!
+ \enum QPaintDevice::PaintDeviceMetric
+
+ Describes the various metrics of a paint device.
+
+ \value PdmWidth The width of the paint device in default
+ coordinate system units (e.g. pixels for QPixmap and QWidget). See
+ also width().
+
+ \value PdmHeight The height of the paint device in default
+ coordinate system units (e.g. pixels for QPixmap and QWidget). See
+ also height().
+
+ \value PdmWidthMM The width of the paint device in millimeters. See
+ also widthMM().
+
+ \value PdmHeightMM The height of the paint device in millimeters. See
+ also heightMM().
+
+ \value PdmNumColors The number of different colors available for
+ the paint device. See also numColors().
+
+ \value PdmDepth The bit depth (number of bit planes) of the paint
+ device. See also depth().
+
+ \value PdmDpiX The horizontal resolution of the device in dots per
+ inch. See also logicalDpiX().
+
+ \value PdmDpiY The vertical resolution of the device in dots per inch. See
+ also logicalDpiY().
+
+ \value PdmPhysicalDpiX The horizontal resolution of the device in
+ dots per inch. See also physicalDpiX().
+
+ \value PdmPhysicalDpiY The vertical resolution of the device in
+ dots per inch. See also physicalDpiY().
+
+ \sa metric()
+*/
+
+/*!
+ \fn QPaintDevice::QPaintDevice()
+
+ Constructs a paint device. This constructor can be invoked only from
+ subclasses of QPaintDevice.
+*/
+
+/*!
+ \fn QPaintDevice::~QPaintDevice()
+
+ Destroys the paint device and frees window system resources.
+*/
+
+/*!
+ \fn int QPaintDevice::devType() const
+
+ \internal
+
+ Returns the device type identifier, which is QInternal::Widget
+ if the device is a QWidget, QInternal::Pixmap if it's a
+ QPixmap, QInternal::Printer if it's a QPrinter,
+ QInternal::Picture if it's a QPicture, or
+ QInternal::UnknownDevice in other cases.
+*/
+
+/*!
+ \fn bool QPaintDevice::paintingActive() const
+
+ Returns true if the device is currently being painted on, i.e. someone has
+ called QPainter::begin() but not yet called QPainter::end() for
+ this device; otherwise returns false.
+
+ \sa QPainter::isActive()
+*/
+
+/*!
+ \fn QPaintEngine *QPaintDevice::paintEngine() const
+
+ Returns a pointer to the paint engine used for drawing on the
+ device.
+*/
+
+/*!
+ \fn int QPaintDevice::metric(PaintDeviceMetric metric) const
+
+ Returns the metric information for the given paint device \a metric.
+
+ \sa PaintDeviceMetric
+*/
+
+/*!
+ \fn int QPaintDevice::width() const
+
+ Returns the width of the paint device in default coordinate system
+ units (e.g. pixels for QPixmap and QWidget).
+
+ \sa widthMM()
+*/
+
+/*!
+ \fn int QPaintDevice::height() const
+
+ Returns the height of the paint device in default coordinate
+ system units (e.g. pixels for QPixmap and QWidget).
+
+ \sa heightMM()
+*/
+
+/*!
+ \fn int QPaintDevice::widthMM() const
+
+ Returns the width of the paint device in millimeters. Due to platform
+ limitations it may not be possible to use this function to determine
+ the actual physical size of a widget on the screen.
+
+ \sa width()
+*/
+
+/*!
+ \fn int QPaintDevice::heightMM() const
+
+ Returns the height of the paint device in millimeters. Due to platform
+ limitations it may not be possible to use this function to determine
+ the actual physical size of a widget on the screen.
+
+ \sa height()
+*/
+
+/*!
+ \fn int QPaintDevice::numColors() const
+
+ Returns the number of different colors available for the paint
+ device. Since this value is an int, it will not be sufficient to represent
+ the number of colors on 32 bit displays, in this case INT_MAX is
+ returned instead.
+*/
+
+/*!
+ \fn int QPaintDevice::depth() const
+
+ Returns the bit depth (number of bit planes) of the paint device.
+*/
+
+/*!
+ \fn int QPaintDevice::logicalDpiX() const
+
+ Returns the horizontal resolution of the device in dots per inch,
+ which is used when computing font sizes. For X11, this is usually
+ the same as could be computed from widthMM().
+
+ Note that if the logicalDpiX() doesn't equal the physicalDpiX(),
+ the corresponding QPaintEngine must handle the resolution mapping.
+
+ \sa logicalDpiY(), physicalDpiX()
+*/
+
+/*!
+ \fn int QPaintDevice::logicalDpiY() const
+
+ Returns the vertical resolution of the device in dots per inch,
+ which is used when computing font sizes. For X11, this is usually
+ the same as could be computed from heightMM().
+
+ Note that if the logicalDpiY() doesn't equal the physicalDpiY(),
+ the corresponding QPaintEngine must handle the resolution mapping.
+
+ \sa logicalDpiX(), physicalDpiY()
+*/
+
+/*!
+ \fn int QPaintDevice::physicalDpiX() const
+
+ Returns the horizontal resolution of the device in dots per inch.
+ For example, when printing, this resolution refers to the physical
+ printer's resolution. The logical DPI on the other hand, refers to
+ the resolution used by the actual paint engine.
+
+ Note that if the physicalDpiX() doesn't equal the logicalDpiX(),
+ the corresponding QPaintEngine must handle the resolution mapping.
+
+ \sa physicalDpiY(), logicalDpiX()
+*/
+
+/*!
+ \fn int QPaintDevice::physicalDpiY() const
+
+ Returns the horizontal resolution of the device in dots per inch.
+ For example, when printing, this resolution refers to the physical
+ printer's resolution. The logical DPI on the other hand, refers to
+ the resolution used by the actual paint engine.
+
+ Note that if the physicalDpiY() doesn't equal the logicalDpiY(),
+ the corresponding QPaintEngine must handle the resolution mapping.
+
+ \sa physicalDpiX(), logicalDpiY()
+*/
diff --git a/src/gui/painting/qpaintdevice_mac.cpp b/src/gui/painting/qpaintdevice_mac.cpp
index bf5e261c89..aa7c2acddd 100644
--- a/src/gui/painting/qpaintdevice_mac.cpp
+++ b/src/gui/painting/qpaintdevice_mac.cpp
@@ -57,34 +57,6 @@ QT_BEGIN_NAMESPACE
Internal variables and functions
*****************************************************************************/
-
-/*****************************************************************************
- External functions
- *****************************************************************************/
-
-extern void qt_painter_removePaintDevice(QPaintDevice *); //qpainter.cpp
-
-/*****************************************************************************
- QPaintDevice member functions
- *****************************************************************************/
-QPaintDevice::QPaintDevice()
-{
- painters = 0;
-}
-
-QPaintDevice::~QPaintDevice()
-{
- if(paintingActive())
- qWarning("QPaintDevice: Cannot destroy paint device that is being "
- "painted, be sure to QPainter::end() painters");
- qt_painter_removePaintDevice(this);
-}
-
-int QPaintDevice::metric(PaintDeviceMetric) const
-{
- return 0;
-}
-
/*! \internal */
float qt_mac_defaultDpi_x()
{
diff --git a/src/gui/painting/qpaintdevice_qws.cpp b/src/gui/painting/qpaintdevice_qws.cpp
index 9a6a3d36b8..b161cb82ed 100644
--- a/src/gui/painting/qpaintdevice_qws.cpp
+++ b/src/gui/painting/qpaintdevice_qws.cpp
@@ -48,39 +48,6 @@
QT_BEGIN_NAMESPACE
-QPaintDevice::QPaintDevice()
-{
- painters = 0;
-}
-
-extern void qt_painter_removePaintDevice(QPaintDevice *); //qpainter.cpp
-
-
-QPaintDevice::~QPaintDevice()
-{
- if (paintingActive())
- qWarning("QPaintDevice: Cannot destroy paint device that is being "
- "painted");
- qt_painter_removePaintDevice(this);
-}
-
-
-int QPaintDevice::metric(PaintDeviceMetric m) const
-{
- qWarning("QPaintDevice::metrics: Device has no metric information");
- if (m == PdmDpiX) {
- return 72;
- } else if (m == PdmDpiY) {
- return 72;
- } else if (m == PdmNumColors) {
- // FIXME: does this need to be a real value?
- return 256;
- } else {
- qDebug("Unrecognised metric %d!",m);
- return 0;
- }
-}
-
QWSDisplay *QPaintDevice::qwsDisplay()
{
return qt_fbdpy;
diff --git a/src/gui/painting/qpaintdevice_win.cpp b/src/gui/painting/qpaintdevice_win.cpp
index 86de028dbe..f964feb68e 100644
--- a/src/gui/painting/qpaintdevice_win.cpp
+++ b/src/gui/painting/qpaintdevice_win.cpp
@@ -50,27 +50,6 @@
QT_BEGIN_NAMESPACE
-QPaintDevice::QPaintDevice()
-{
- painters = 0;
-}
-
-extern void qt_painter_removePaintDevice(QPaintDevice *); //qpainter.cpp
-
-QPaintDevice::~QPaintDevice()
-{
- if (paintingActive())
- qWarning("QPaintDevice: Cannot destroy paint device that is being "
- "painted. Be sure to QPainter::end() painters!");
- qt_painter_removePaintDevice(this);
-}
-
-int QPaintDevice::metric(PaintDeviceMetric) const
-{
- qWarning("QPaintDevice::metrics: Device has no metric information");
- return 0;
-}
-
HDC QPaintDevice::getDC() const
{
return 0;
diff --git a/src/gui/painting/qpaintdevice_x11.cpp b/src/gui/painting/qpaintdevice_x11.cpp
index b0ed7326b3..474f3f18dc 100644
--- a/src/gui/painting/qpaintdevice_x11.cpp
+++ b/src/gui/painting/qpaintdevice_x11.cpp
@@ -49,21 +49,6 @@
QT_BEGIN_NAMESPACE
-QPaintDevice::QPaintDevice()
-{
- painters = 0;
-}
-
-extern void qt_painter_removePaintDevice(QPaintDevice *); //qpainter.cpp
-
-QPaintDevice::~QPaintDevice()
-{
- if (paintingActive())
- qWarning("QPaintDevice: Cannot destroy paint device that is being "
- "painted");
- qt_painter_removePaintDevice(this);
-}
-
/*! \internal
Returns the X11 Drawable of the paint device. 0 is returned if it
@@ -96,12 +81,6 @@ const Q_GUI_EXPORT QX11Info *qt_x11Info(const QPaintDevice *pd)
return 0;
}
-int QPaintDevice::metric(PaintDeviceMetric) const
-{
- qWarning("QPaintDevice::metrics: Device has no metric information");
- return 0;
-}
-
#ifdef QT3_SUPPORT
diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp
index a91db26d25..5dc0922485 100644
--- a/src/gui/painting/qpaintengine.cpp
+++ b/src/gui/painting/qpaintengine.cpp
@@ -145,7 +145,7 @@ QFont QTextItem::font() const
/*!
\class QPaintEngine
- \ingroup multimedia
+ \ingroup painting
\brief The QPaintEngine class provides an abstract definition of how
QPainter draws to a given device on a given platform.
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index d4e988b14b..ef4904f06e 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1019,9 +1019,6 @@ void QRasterPaintEnginePrivate::drawImage(const QPointF &pt,
if (alpha == 0 || !clip.isValid())
return;
- if (alpha ==0)
- return;
-
Q_ASSERT(img.depth() >= 8);
int srcBPL = img.bytesPerLine();
@@ -2495,10 +2492,7 @@ void QRasterPaintEngine::drawImage(const QPointF &p, const QImage &img)
const QClipData *clip = d->clip();
QPointF pt(p.x() + s->matrix.dx(), p.y() + s->matrix.dy());
- // ### TODO: remove this eventually...
- static bool NO_BLEND_FUNC = !qgetenv("QT_NO_BLEND_FUNCTIONS").isNull();
-
- if (s->flags.fast_images && !NO_BLEND_FUNC) {
+ if (s->flags.fast_images) {
SrcOverBlendFunc func = qBlendFunctions[d->rasterBuffer->format][img.format()];
if (func) {
if (!clip) {
@@ -2511,6 +2505,8 @@ void QRasterPaintEngine::drawImage(const QPointF &p, const QImage &img)
}
}
+
+
d->image_filler.clip = clip;
d->image_filler.initTexture(&img, s->intOpacity, QTextureData::Plain, img.rect());
if (!d->image_filler.blend)
@@ -2562,14 +2558,24 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
if (s->matrix.type() > QTransform::TxTranslate || stretch_sr) {
if (s->flags.fast_images) {
- SrcOverScaleFunc func = qScaleFunctions[d->rasterBuffer->format][img.format()];
- if (func && (!clip || clip->hasRectClip)) {
- func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(),
- img.bits(), img.bytesPerLine(),
- qt_mapRect_non_normalizing(r, s->matrix), sr,
- !clip ? d->deviceRect : clip->clipRect,
- s->intOpacity);
- return;
+ if (s->matrix.type() > QTransform::TxScale) {
+ SrcOverTransformFunc func = qTransformFunctions[d->rasterBuffer->format][img.format()];
+ if (func && (!clip || clip->hasRectClip)) {
+ func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(), img.bits(),
+ img.bytesPerLine(), r, sr, !clip ? d->deviceRect : clip->clipRect,
+ s->matrix, s->intOpacity);
+ return;
+ }
+ } else {
+ SrcOverScaleFunc func = qScaleFunctions[d->rasterBuffer->format][img.format()];
+ if (func && (!clip || clip->hasRectClip)) {
+ func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(),
+ img.bits(), img.bytesPerLine(),
+ qt_mapRect_non_normalizing(r, s->matrix), sr,
+ !clip ? d->deviceRect : clip->clipRect,
+ s->intOpacity);
+ return;
+ }
}
}
@@ -4057,7 +4063,7 @@ void QRasterPaintEnginePrivate::recalculateFastImages()
s->flags.fast_images = !(s->renderHints & QPainter::SmoothPixmapTransform)
&& rasterBuffer->compositionMode == QPainter::CompositionMode_SourceOver
- && s->matrix.type() <= QTransform::TxScale;
+ && s->matrix.type() <= QTransform::TxShear;
}
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index fe1fb060db..0bca8f7b67 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -924,8 +924,8 @@ void QPainterPrivate::updateState(QPainterState *newState)
\brief The QPainter class performs low-level painting on widgets and
other paint devices.
- \ingroup multimedia
- \mainclass
+ \ingroup painting
+
\reentrant
QPainter provides highly optimized functions to do most of the
@@ -7501,8 +7501,8 @@ void qt_format_text(const QFont &fnt, const QRectF &_r,
QFontMetricsF fm(fnt);
QString text = str;
int offset = 0;
-start_lenghtVariant:
- bool hasMoreLenghtVariants = false;
+start_lengthVariant:
+ bool hasMoreLengthVariants = false;
// compatible behaviour to the old implementation. Replace
// tabs by spaces
bool has_tab = false;
@@ -7524,7 +7524,7 @@ start_lenghtVariant:
has_tab = true;
} else if (chr == QChar(ushort(0x9c))) {
// string with multiple length variants
- hasMoreLenghtVariants = true;
+ hasMoreLengthVariants = true;
break;
}
}
@@ -7648,9 +7648,9 @@ start_lenghtVariant:
}
QRectF bounds = QRectF(r.x() + xoff, r.y() + yoff, width, height);
- if (hasMoreLenghtVariants && !(tf & Qt::TextLongestVariant) && !r.contains(bounds)) {
+ if (hasMoreLengthVariants && !(tf & Qt::TextLongestVariant) && !r.contains(bounds)) {
offset++;
- goto start_lenghtVariant;
+ goto start_lengthVariant;
}
if (brect)
*brect = bounds;
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 994217e7a8..eb8b964df0 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -164,7 +164,7 @@ static void qt_debug_path(const QPainterPath &path)
/*!
\class QPainterPath
- \ingroup multimedia
+ \ingroup painting
\ingroup shared
\brief The QPainterPath class provides a container for painting operations,
@@ -2399,7 +2399,7 @@ void qt_path_stroke_cubic_to(qfixed c1x, qfixed c1y,
/*!
\since 4.1
\class QPainterPathStroker
- \ingroup multimedia
+ \ingroup painting
\brief The QPainterPathStroker class is used to generate fillable
outlines for a given painter path.
diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h
index eb1c7d3ccc..21894a7cb1 100644
--- a/src/gui/painting/qpainterpath.h
+++ b/src/gui/painting/qpainterpath.h
@@ -301,9 +301,9 @@ inline void QPainterPath::lineTo(qreal x, qreal y)
lineTo(QPointF(x, y));
}
-inline void QPainterPath::arcTo(qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal arcLenght)
+inline void QPainterPath::arcTo(qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal arcLength)
{
- arcTo(QRectF(x, y, w, h), startAngle, arcLenght);
+ arcTo(QRectF(x, y, w, h), startAngle, arcLength);
}
inline void QPainterPath::arcMoveTo(qreal x, qreal y, qreal w, qreal h, qreal angle)
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 3f5643e45e..478a2a83f0 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -313,7 +313,7 @@ QByteArray QPdf::generatePath(const QPainterPath &path, const QTransform &matrix
Qt::FillRule fillRule = path.fillRule();
- const char *op = 0;
+ const char *op = "";
switch (flags) {
case ClipPath:
op = (fillRule == Qt::WindingFill) ? "W n\n" : "W* n\n";
@@ -1471,10 +1471,10 @@ void QPdfBaseEngine::setProperty(PrintEnginePropertyKey key, const QVariant &val
{
QList<QVariant> margins(value.toList());
Q_ASSERT(margins.size() == 4);
- d->leftMargin = margins.at(0).toDouble();
- d->topMargin = margins.at(1).toDouble();
- d->rightMargin = margins.at(2).toDouble();
- d->bottomMargin = margins.at(3).toDouble();
+ d->leftMargin = margins.at(0).toReal();
+ d->topMargin = margins.at(1).toReal();
+ d->rightMargin = margins.at(2).toReal();
+ d->bottomMargin = margins.at(3).toReal();
d->hasCustomPageMargins = true;
break;
}
@@ -1576,7 +1576,7 @@ QVariant QPdfBaseEngine::property(PrintEnginePropertyKey key) const
margins << d->leftMargin << d->topMargin
<< d->rightMargin << d->bottomMargin;
} else {
- const int defaultMargin = 10; // ~3.5 mm
+ const qreal defaultMargin = 10; // ~3.5 mm
margins << defaultMargin << defaultMargin
<< defaultMargin << defaultMargin;
}
@@ -1773,6 +1773,9 @@ bool QPdfBaseEnginePrivate::openPrintDevice()
(void)execv("/bin/lpr", lprargs);
(void)execv("/usr/bin/lp", lpargs);
(void)execv("/usr/bin/lpr", lprargs);
+
+ delete []lpargs;
+ delete []lprargs;
}
// if we couldn't exec anything, close the fd,
// wait for a second so the parent process (the
diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp
index 047fd9be12..51929a22db 100644
--- a/src/gui/painting/qpen.cpp
+++ b/src/gui/painting/qpen.cpp
@@ -52,9 +52,9 @@ typedef QPenPrivate QPenData;
/*!
\class QPen
- \ingroup multimedia
+ \ingroup painting
\ingroup shared
- \mainclass
+
\brief The QPen class defines how a QPainter should draw lines and outlines
of shapes.
diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp
index 87a98480f5..044b2c5d0b 100644
--- a/src/gui/painting/qpolygon.cpp
+++ b/src/gui/painting/qpolygon.cpp
@@ -91,7 +91,7 @@ static void qt_polygon_isect_line(const QPointF &p1, const QPointF &p2, const QP
\reentrant
- \ingroup multimedia
+ \ingroup painting
\ingroup shared
A QPolygon object is a QVector<QPoint>. The easiest way to add
@@ -489,7 +489,7 @@ QDebug operator<<(QDebug dbg, const QPolygon &a)
floating point precision.
\reentrant
- \ingroup multimedia
+ \ingroup painting
\ingroup shared
A QPolygonF is a QVector<QPointF>. The easiest way to add points
diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp
index 7ac3224e5b..21c0873128 100644
--- a/src/gui/painting/qprintengine_win.cpp
+++ b/src/gui/painting/qprintengine_win.cpp
@@ -1360,10 +1360,10 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
Q_ASSERT(margins.size() == 4);
int left, top, right, bottom;
// specified in 1/100 mm
- left = (margins.at(0).toDouble()*25.4/72.0) * 100;
- top = (margins.at(1).toDouble()*25.4/72.0) * 100;
- right = (margins.at(2).toDouble()*25.4/72.0) * 100;
- bottom = (margins.at(3).toDouble()*25.4/72.0) * 100;
+ left = (margins.at(0).toReal()*25.4/72.0) * 100;
+ top = (margins.at(1).toReal()*25.4/72.0) * 100;
+ right = (margins.at(2).toReal()*25.4/72.0) * 100;
+ bottom = (margins.at(3).toReal()*25.4/72.0) * 100;
d->setPageMargins(left, top, right, bottom);
break;
}
diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp
index 326b7b07af..df330343b3 100644
--- a/src/gui/painting/qprinter.cpp
+++ b/src/gui/painting/qprinter.cpp
@@ -268,8 +268,8 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke
\brief The QPrinter class is a paint device that paints on a printer.
- \ingroup multimedia
- \mainclass
+ \ingroup printing
+
This device represents a series of pages of printed output, and is
used in almost exactly the same way as other paint devices such as
@@ -1664,10 +1664,10 @@ void QPrinter::getPageMargins(qreal *left, qreal *top, qreal *right, qreal *bott
Q_ASSERT(left && top && right && bottom);
const qreal multiplier = qt_multiplierForUnit(unit, resolution());
QList<QVariant> margins(d->printEngine->property(QPrintEngine::PPK_PageMargins).toList());
- *left = margins.at(0).toDouble() / multiplier;
- *top = margins.at(1).toDouble() / multiplier;
- *right = margins.at(2).toDouble() / multiplier;
- *bottom = margins.at(3).toDouble() / multiplier;
+ *left = margins.at(0).toReal() / multiplier;
+ *top = margins.at(1).toReal() / multiplier;
+ *right = margins.at(2).toReal() / multiplier;
+ *bottom = margins.at(3).toReal() / multiplier;
}
/*!
@@ -2203,7 +2203,7 @@ bool QPrinter::isOptionEnabled( PrinterOption option ) const
\class QPrintEngine
\reentrant
- \ingroup multimedia
+ \ingroup printing
\brief The QPrintEngine class defines an interface for how QPrinter
interacts with a given printing subsystem.
diff --git a/src/gui/painting/qprinterinfo.qdoc b/src/gui/painting/qprinterinfo.qdoc
new file mode 100644
index 0000000000..e3cbe96979
--- /dev/null
+++ b/src/gui/painting/qprinterinfo.qdoc
@@ -0,0 +1,139 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \class QPrinterInfo
+
+ \brief The QPrinterInfo class gives access to information about
+ existing printers.
+
+ \ingroup printing
+
+ Use the static functions to generate a list of QPrinterInfo
+ objects. Each QPrinterInfo object in the list represents a single
+ printer and can be queried for name, supported paper sizes, and
+ whether or not it is the default printer.
+
+ \since 4.4
+*/
+
+/*!
+ \fn QList<QPrinterInfo> QPrinterInfo::availablePrinters()
+
+ Returns a list of available printers on the system.
+*/
+
+/*!
+ \fn QPrinterInfo QPrinterInfo::defaultPrinter()
+
+ Returns the default printer on the system.
+
+ The return value should be checked using isNull() before being
+ used, in case there is no default printer.
+
+ \sa isNull()
+*/
+
+/*!
+ \fn QPrinterInfo::QPrinterInfo()
+
+ Constructs an empty QPrinterInfo object.
+
+ \sa isNull()
+*/
+
+/*!
+ \fn QPrinterInfo::QPrinterInfo(const QPrinterInfo& src)
+
+ Constructs a copy of \a src.
+*/
+
+/*!
+ \fn QPrinterInfo::QPrinterInfo(const QPrinter& printer)
+
+ Constructs a QPrinterInfo object from \a printer.
+*/
+
+/*!
+ \fn QPrinterInfo::~QPrinterInfo()
+
+ Destroys the QPrinterInfo object. References to the values in the
+ object become invalid.
+*/
+
+/*!
+ \fn QPrinterInfo& QPrinterInfo::operator=(const QPrinterInfo& src)
+
+ Sets the QPrinterInfo object to be equal to \a src.
+*/
+
+/*!
+ \fn QString QPrinterInfo::printerName() const
+
+ Returns the name of the printer.
+
+ \sa QPrinter::setPrinterName()
+*/
+
+/*!
+ \fn bool QPrinterInfo::isNull() const
+
+ Returns whether this QPrinterInfo object holds a printer definition.
+
+ An empty QPrinterInfo object could result for example from calling
+ defaultPrinter() when there are no printers on the system.
+*/
+
+/*!
+ \fn bool QPrinterInfo::isDefault() const
+
+ Returns whether this printer is the default printer.
+*/
+
+/*!
+ \fn QList< QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const
+ \since 4.4
+
+ Returns a list of supported paper sizes by the printer.
+
+ Not all printer drivers support this query, so the list may be empty.
+ On Mac OS X 10.3, this function always returns an empty list.
+*/
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index dd684db9da..0db700ac74 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE
\class QRegion
\brief The QRegion class specifies a clip region for a painter.
- \ingroup multimedia
+ \ingroup painting
\ingroup shared
QRegion is used with QPainter::setClipRegion() to limit the paint
diff --git a/src/gui/painting/qstylepainter.cpp b/src/gui/painting/qstylepainter.cpp
index 959caa9e6d..93512d0c4d 100644
--- a/src/gui/painting/qstylepainter.cpp
+++ b/src/gui/painting/qstylepainter.cpp
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
elements inside a widget.
\ingroup appearance
- \ingroup multimedia
+ \ingroup painting
QStylePainter extends QPainter with a set of high-level \c
draw...() functions implemented on top of QStyle's API. The
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 8832a3dd6f..859767b0f7 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -93,7 +93,7 @@ QT_BEGIN_NAMESPACE
\class QTransform
\brief The QTransform class specifies 2D transformations of a coordinate system.
\since 4.3
- \ingroup multimedia
+ \ingroup painting
A transformation specifies how to translate, scale, shear, rotate
or project the coordinate system, and is typically used when