Qt 4.8
|
The QTransform class specifies 2D transformations of a coordinate system. More...
#include <qtransform.h>
Public Types | |
enum | TransformationType { TxNone = 0x00, TxTranslate = 0x01, TxScale = 0x02, TxRotate = 0x04, TxShear = 0x08, TxProject = 0x10 } |
Public Functions | |
QTransform | adjoint () const |
Returns the adjoint of this matrix. More... | |
qreal | det () const |
Returns the matrix's determinant. More... | |
qreal | determinant () const |
Returns the matrix's determinant. More... | |
qreal | dx () const |
Returns the horizontal translation factor. More... | |
qreal | dy () const |
Returns the vertical translation factor. More... | |
QTransform | inverted (bool *invertible=0) const |
Returns an inverted copy of this matrix. More... | |
bool | isAffine () const |
Returns true if the matrix represent an affine transformation, otherwise returns false. More... | |
bool | isIdentity () const |
Returns true if the matrix is the identity matrix, otherwise returns false. More... | |
bool | isInvertible () const |
Returns true if the matrix is invertible, otherwise returns false. More... | |
bool | isRotating () const |
Returns true if the matrix represents some kind of a rotating transformation, otherwise returns false. More... | |
bool | isScaling () const |
Returns true if the matrix represents a scaling transformation, otherwise returns false. More... | |
bool | isTranslating () const |
Returns true if the matrix represents a translating transformation, otherwise returns false. More... | |
qreal | m11 () const |
Returns the horizontal scaling factor. More... | |
qreal | m12 () const |
Returns the vertical shearing factor. More... | |
qreal | m13 () const |
Returns the horizontal projection factor. More... | |
qreal | m21 () const |
Returns the horizontal shearing factor. More... | |
qreal | m22 () const |
Returns the vertical scaling factor. More... | |
qreal | m23 () const |
Returns the vertical projection factor. More... | |
qreal | m31 () const |
Returns the horizontal translation factor. More... | |
qreal | m32 () const |
Returns the vertical translation factor. More... | |
qreal | m33 () const |
Returns the division factor. More... | |
QPoint | map (const QPoint &p) const |
Creates and returns a QPoint object that is a copy of the given point, mapped into the coordinate system defined by this matrix. More... | |
QPointF | map (const QPointF &p) const |
Creates and returns a QPointF object that is a copy of the given point, p, mapped into the coordinate system defined by this matrix. More... | |
QLine | map (const QLine &l) const |
Creates and returns a QLineF object that is a copy of the given line, l, mapped into the coordinate system defined by this matrix. More... | |
QLineF | map (const QLineF &l) const |
Creates and returns a QLine object that is a copy of the given line, mapped into the coordinate system defined by this matrix. More... | |
QPolygonF | map (const QPolygonF &a) const |
Creates and returns a QPolygonF object that is a copy of the given polygon, mapped into the coordinate system defined by this matrix. More... | |
QPolygon | map (const QPolygon &a) const |
Creates and returns a QPolygon object that is a copy of the given polygon, mapped into the coordinate system defined by this matrix. More... | |
QRegion | map (const QRegion &r) const |
Creates and returns a QRegion object that is a copy of the given region, mapped into the coordinate system defined by this matrix. More... | |
QPainterPath | map (const QPainterPath &p) const |
Creates and returns a QPainterPath object that is a copy of the given path, mapped into the coordinate system defined by this matrix. More... | |
void | map (int x, int y, int *tx, int *ty) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Maps the given coordinates x and y into the coordinate system defined by this matrix. More... | |
void | map (qreal x, qreal y, qreal *tx, qreal *ty) const |
Maps the given coordinates x and y into the coordinate system defined by this matrix. More... | |
QRect | mapRect (const QRect &) const |
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate system defined by this matrix. More... | |
QRectF | mapRect (const QRectF &) const |
Creates and returns a QRectF object that is a copy of the given rectangle, mapped into the coordinate system defined by this matrix. More... | |
QPolygon | mapToPolygon (const QRect &r) const |
Creates and returns a QPolygon representation of the given rectangle, mapped into the coordinate system defined by this matrix. More... | |
operator QVariant () const | |
Returns the transform as a QVariant. More... | |
bool | operator!= (const QTransform &) const |
Returns true if this matrix is not equal to the given matrix, otherwise returns false. More... | |
QTransform | operator* (const QTransform &o) const |
Returns the result of multiplying this matrix by the given matrix. More... | |
QTransform & | operator*= (const QTransform &) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the result of multiplying this matrix by the given matrix. More... | |
QTransform & | operator*= (qreal div) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the result of performing an element-wise multiplication of this matrix with the given scalar. More... | |
QTransform & | operator+= (qreal div) |
Returns the matrix obtained by adding the given scalar to each element of this matrix. More... | |
QTransform & | operator-= (qreal div) |
Returns the matrix obtained by subtracting the given scalar from each element of this matrix. More... | |
QTransform & | operator/= (qreal div) |
Returns the result of performing an element-wise division of this matrix by the given scalar. More... | |
QTransform & | operator= (const QTransform &) |
Assigns the given matrix's values to this matrix. More... | |
bool | operator== (const QTransform &) const |
Returns true if this matrix is equal to the given matrix, otherwise returns false. More... | |
QTransform (Qt::Initialization) | |
QTransform () | |
Constructs an identity matrix. More... | |
QTransform (qreal h11, qreal h12, qreal h13, qreal h21, qreal h22, qreal h23, qreal h31, qreal h32, qreal h33=1.0) | |
Constructs a matrix with the elements, m11, m12, m13, m21, m22, m23, m31, m32, m33. More... | |
QTransform (qreal h11, qreal h12, qreal h21, qreal h22, qreal dx, qreal dy) | |
Constructs a matrix with the elements, m11, m12, m21, m22, dx and dy. More... | |
QTransform (const QMatrix &mtx) | |
Constructs a matrix that is a copy of the given matrix. More... | |
void | reset () |
Resets the matrix to an identity matrix, i.e. More... | |
QTransform & | rotate (qreal a, Qt::Axis axis=Qt::ZAxis) |
Rotates the coordinate system counterclockwise by the given angle about the specified axis and returns a reference to the matrix. More... | |
QTransform & | rotateRadians (qreal a, Qt::Axis axis=Qt::ZAxis) |
Rotates the coordinate system counterclockwise by the given angle about the specified axis and returns a reference to the matrix. More... | |
QTransform & | scale (qreal sx, qreal sy) |
Scales the coordinate system by sx horizontally and sy vertically, and returns a reference to the matrix. More... | |
void | setMatrix (qreal m11, qreal m12, qreal m13, qreal m21, qreal m22, qreal m23, qreal m31, qreal m32, qreal m33) |
Sets the matrix elements to the specified values, m11, m12, m13 m21, m22, m23 m31, m32 and m33. More... | |
QTransform & | shear (qreal sh, qreal sv) |
Shears the coordinate system by sh horizontally and sv vertically, and returns a reference to the matrix. More... | |
const QMatrix & | toAffine () const |
Returns the QTransform as an affine matrix. More... | |
QTransform & | translate (qreal dx, qreal dy) |
Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to the matrix. More... | |
QTransform | transposed () const |
Returns the transpose of this matrix. More... | |
TransformationType | type () const |
Returns the transformation type of this matrix. More... | |
Static Public Functions | |
static QTransform | fromScale (qreal dx, qreal dy) |
Creates a matrix which corresponds to a scaling of sx horizontally and sy vertically. More... | |
static QTransform | fromTranslate (qreal dx, qreal dy) |
Creates a matrix which corresponds to a translation of dx along the x axis and dy along the y axis. More... | |
static bool | quadToQuad (const QPolygonF &one, const QPolygonF &two, QTransform &result) |
Creates a transformation matrix, trans, that maps a four-sided polygon, one, to another four-sided polygon, two. More... | |
static bool | quadToSquare (const QPolygonF &quad, QTransform &result) |
Creates a transformation matrix, trans, that maps a four-sided polygon, quad, to a unit square. More... | |
static bool | squareToQuad (const QPolygonF &square, QTransform &result) |
Creates a transformation matrix, trans, that maps a unit square to a four-sided polygon, quad. More... | |
Private Functions | |
TransformationType | inline_type () const |
QTransform (qreal h11, qreal h12, qreal h13, qreal h21, qreal h22, qreal h23, qreal h31, qreal h32, qreal h33, bool) | |
QTransform (bool) | |
Properties | |
QMatrix | affine |
Private * | d |
qreal | m_13 |
qreal | m_23 |
qreal | m_33 |
uint | m_dirty: 5 |
uint | m_type: 5 |
Related Functions | |
(Note that these are not member functions.) | |
QPoint | operator* (const QPoint &point, const QTransform &matrix) |
QPointF | operator* (const QPointF &point, const QTransform &matrix) |
QLineF | operator* (const QLineF &line, const QTransform &matrix) |
QLine | operator* (const QLine &line, const QTransform &matrix) |
QPolygonF | operator* (const QPolygonF &polygon, const QTransform &matrix) |
QPolygon | operator* (const QPolygon &polygon, const QTransform &matrix) |
QRegion | operator* (const QRegion ®ion, const QTransform &matrix) |
QPainterPath | operator* (const QPainterPath &path, const QTransform &matrix) |
QDataStream & | operator<< (QDataStream &stream, const QTransform &matrix) |
Writes the given matrix to the given stream and returns a reference to the stream. More... | |
QDataStream & | operator>> (QDataStream &stream, QTransform &matrix) |
Reads the given matrix from the given stream and returns a reference to the stream. More... | |
bool | qFuzzyCompare (const QTransform &t1, const QTransform &t2) |
Returns true if t1 and t2 are equal, allowing for a small fuzziness factor for floating-point comparisons; false otherwise. More... | |
The QTransform class specifies 2D transformations of a coordinate system.
A transformation specifies how to translate, scale, shear, rotate or project the coordinate system, and is typically used when rendering graphics.
QTransform differs from QMatrix in that it is a true 3x3 matrix, allowing perspective transformations. QTransform's toAffine() method allows casting QTransform to QMatrix. If a perspective transformation has been specified on the matrix, then the conversion will cause loss of data.
QTransform is the recommended transformation class in Qt.
A QTransform object can be built using the setMatrix(), scale(), rotate(), translate() and shear() functions. Alternatively, it can be built by applying basic matrix operations. The matrix can also be defined when constructed, and it can be reset to the identity matrix (the default) using the reset() function.
The QTransform class supports mapping of graphic primitives: A given point, line, polygon, region, or painter path can be mapped to the coordinate system defined by this matrix using the map() function. In case of a rectangle, its coordinates can be transformed using the mapRect() function. A rectangle can also be transformed into a polygon (mapped to the coordinate system defined by this matrix), using the mapToPolygon() function.
QTransform provides the isIdentity() function which returns true if the matrix is the identity matrix, and the isInvertible() function which returns true if the matrix is non-singular (i.e. AB = BA = I). The inverted() function returns an inverted copy of this matrix if it is invertible (otherwise it returns the identity matrix), and adjoint() returns the matrix's classical adjoint. In addition, QTransform provides the determinant() function which returns the matrix's determinant.
Finally, the QTransform class supports matrix multiplication, addition and subtraction, and objects of the class can be streamed as well as compared.
When rendering graphics, the matrix defines the transformations but the actual transformation is performed by the drawing routines in QPainter.
By default, QPainter operates on the associated device's own coordinate system. The standard coordinate system of a QPaintDevice has its origin located at the top-left position. The x values increase to the right; y values increase downward. For a complete description, see the Coordinate System documentation.
QPainter has functions to translate, scale, shear and rotate the coordinate system without using a QTransform. For example:
void SimpleTransformation::paintEvent(QPaintEvent *) { QPainter painter(this); painter.drawRect(0, 0, 100, 100); painter.rotate(45); painter.setFont(QFont("Helvetica", 24)); painter.drawText(20, 10, "QTransform"); } |
Although these functions are very convenient, it can be more efficient to build a QTransform and call QPainter::setTransform() if you want to perform more than a single transform operation. For example:
void CombinedTransformation::paintEvent(QPaintEvent *) { QPainter painter(this); painter.drawRect(0, 0, 100, 100); QTransform transform; transform.translate(50, 50); transform.rotate(45); transform.scale(0.5, 1.0); painter.setTransform(transform); painter.setFont(QFont("Helvetica", 24)); painter.drawText(20, 10, "QTransform"); } |
A QTransform object contains a 3 x 3 matrix. The m31
(dx
) and m32
(dy
) elements specify horizontal and vertical translation. The m11
and m22
elements specify horizontal and vertical scaling. The m21
and m12
elements specify horizontal and vertical shearing. And finally, the m13
and m23
elements specify horizontal and vertical projection, with m33
as an additional projection factor.
QTransform transforms a point in the plane to another point using the following formulas:
The point (x, y) is the original point, and (x', y') is the transformed point. (x', y') can be transformed back to (x, y) by performing the same operation on the inverted() matrix.
The various matrix elements can be set when constructing the matrix, or by using the setMatrix() function later on. They can also be manipulated using the translate(), rotate(), scale() and shear() convenience functions. The currently set values can be retrieved using the m11(), m12(), m13(), m21(), m22(), m23(), m31(), m32(), m33(), dx() and dy() functions.
Translation is the simplest transformation. Setting dx
and dy
will move the coordinate system dx
units along the X axis and dy
units along the Y axis. Scaling can be done by setting m11
and m22
. For example, setting m11
to 2 and m22
to 1.5 will double the height and increase the width by 50%. The identity matrix has m11
, m22
, and m33
set to 1 (all others are set to 0) mapping a point to itself. Shearing is controlled by m12
and m21
. Setting these elements to values different from zero will twist the coordinate system. Rotation is achieved by setting both the shearing factors and the scaling factors. Perspective transformation is achieved by setting both the projection factors and the scaling factors.
Here's the combined transformations example using basic matrix operations:
void BasicOperations::paintEvent(QPaintEvent *) { double pi = 3.14; double a = pi/180 * 45.0; double sina = sin(a); double cosa = cos(a); QTransform translationTransform(1, 0, 0, 1, 50.0, 50.0); QTransform rotationTransform(cosa, sina, -sina, cosa, 0, 0); QTransform scalingTransform(0.5, 0, 0, 1.0, 0, 0); QTransform transform; transform = scalingTransform * rotationTransform * translationTransform; QPainter painter(this); painter.drawRect(0, 0, 100, 100); painter.setTransform(transform); painter.setFont(QFont("Helvetica", 24)); painter.drawText(20, 10, "QTransform"); } |
Definition at line 65 of file qtransform.h.
Enumerator | |
---|---|
TxNone | |
TxTranslate | |
TxScale | |
TxRotate | |
TxShear | |
TxProject |
Definition at line 68 of file qtransform.h.
|
inlineexplicit |
Definition at line 77 of file qtransform.h.
QTransform::QTransform | ( | ) |
Constructs an identity matrix.
All elements are set to zero except m11
and m22
(specifying the scale) and m13
which are set to 1.
Definition at line 252 of file qtransform.cpp.
Referenced by adjoint(), fromScale(), fromTranslate(), and map().
QTransform::QTransform | ( | qreal | m11, |
qreal | m12, | ||
qreal | m13, | ||
qreal | m21, | ||
qreal | m22, | ||
qreal | m23, | ||
qreal | m31, | ||
qreal | m32, | ||
qreal | m33 = 1.0 |
||
) |
Constructs a matrix with the elements, m11, m12, m13, m21, m22, m23, m31, m32, m33.
Definition at line 271 of file qtransform.cpp.
Constructs a matrix with the elements, m11, m12, m21, m22, dx and dy.
Definition at line 291 of file qtransform.cpp.
|
explicit |
Constructs a matrix that is a copy of the given matrix.
Note that the m13
, m23
, and m33
elements are set to 0, 0, and 1 respectively.
Definition at line 310 of file qtransform.cpp.
|
inlineprivate |
Definition at line 166 of file qtransform.h.
|
inlineprivate |
Definition at line 173 of file qtransform.h.
QTransform QTransform::adjoint | ( | ) | const |
Returns the adjoint of this matrix.
Definition at line 321 of file qtransform.cpp.
Referenced by inverted().
|
inline |
Returns the matrix's determinant.
Use determinant() instead.
Definition at line 233 of file qtransform.h.
Referenced by inverted(), and QFontEngineFT::loadTransformedGlyphSet().
|
inline |
Returns the matrix's determinant.
Definition at line 228 of file qtransform.h.
Referenced by QGL2PaintEngineEx::drawStaticTextItem(), QGL2PaintEngineEx::drawTextItem(), inverted(), and QRasterPaintEngine::supportsTransformations().
|
inline |
Returns the horizontal translation factor.
Definition at line 273 of file qtransform.h.
Referenced by QPdfEnginePrivate::addBrushPattern(), QGL2PaintEngineEx::beginNativePainting(), QProxyFontEngine::canRender(), QPixmapConvolutionFilter::draw(), QFontEngineQPF::draw(), QFontEngineQPF1::draw(), draw_text_item_win(), QVGPaintEngine::drawCachedGlyphs(), QRasterPaintEngine::drawImage(), QRasterPaintEngine::drawPixmap(), QRasterPaintEngine::drawRects(), QGraphicsScenePrivate::drawSubtreeRecursive(), QRasterPaintEngine::drawTiledPixmap(), QBlitterPaintEngine::fillRect(), QRasterPaintEngine::fillRect(), QGraphicsView::fitInView(), QPdf::generateMatrix(), QFontEngine::getGlyphPositions(), QGraphicsSceneIndexRectIntersector::intersect(), QGraphicsSceneIndexPointIntersector::intersect(), QGraphicsSceneIndexPathIntersector::intersect(), QGraphicsItem::mapFromScene(), QGraphicsItem::mapRectFromScene(), QGraphicsItem::mapRectToScene(), QGraphicsItem::mapToScene(), QGraphicsItem::prepareGeometryChange(), QGraphicsScenePrivate::processDirtyItemsRecursive(), QMacCGContext::QMacCGContext(), QMatrix4x4::QMatrix4x4(), qt_mac_convert_transform_to_cg(), qt_xForm_helper(), QGraphicsSceneIndexPrivate::recursive_items_helper(), QGraphicsItem::sceneBoundingRect(), QOutlineMapper::setMatrix(), QGraphicsViewPrivate::setUpdateClip(), QSpanData::setupMatrix(), QPaintBufferEngine::transformChanged(), QPaintEnginePrivate::transformSystemClip(), translate(), updateHelper(), QOpenGLPaintEngine::updateMatrix(), QRasterPaintEngine::updateMatrix(), QGL2PaintEngineExPrivate::updateMatrix(), and QRasterPaintEnginePrivate::updateMatrixData().
|
inline |
Returns the vertical translation factor.
Definition at line 277 of file qtransform.h.
Referenced by QPdfEnginePrivate::addBrushPattern(), QGL2PaintEngineEx::beginNativePainting(), QProxyFontEngine::canRender(), QPixmapConvolutionFilter::draw(), QFontEngineQPF::draw(), QFontEngineQPF1::draw(), draw_text_item_win(), QVGPaintEngine::drawCachedGlyphs(), QRasterPaintEngine::drawImage(), QRasterPaintEngine::drawPixmap(), QRasterPaintEngine::drawRects(), QGraphicsScenePrivate::drawSubtreeRecursive(), QRasterPaintEngine::drawTiledPixmap(), QBlitterPaintEngine::fillRect(), QRasterPaintEngine::fillRect(), QGraphicsView::fitInView(), QPdf::generateMatrix(), QFontEngine::getGlyphPositions(), QGraphicsSceneIndexRectIntersector::intersect(), QGraphicsSceneIndexPointIntersector::intersect(), QGraphicsSceneIndexPathIntersector::intersect(), QGraphicsItem::mapFromScene(), QGraphicsItem::mapRectFromScene(), QGraphicsItem::mapRectToScene(), QGraphicsItem::mapToScene(), QGraphicsItem::prepareGeometryChange(), QGraphicsScenePrivate::processDirtyItemsRecursive(), QMacCGContext::QMacCGContext(), QMatrix4x4::QMatrix4x4(), qt_mac_convert_transform_to_cg(), qt_xForm_helper(), QGraphicsSceneIndexPrivate::recursive_items_helper(), QGraphicsItem::sceneBoundingRect(), QOutlineMapper::setMatrix(), QGraphicsViewPrivate::setUpdateClip(), QSpanData::setupMatrix(), QPaintBufferEngine::transformChanged(), QPaintEnginePrivate::transformSystemClip(), translate(), updateHelper(), QOpenGLPaintEngine::updateMatrix(), QRasterPaintEngine::updateMatrix(), QGL2PaintEngineExPrivate::updateMatrix(), and QRasterPaintEnginePrivate::updateMatrixData().
|
static |
Creates a matrix which corresponds to a scaling of sx horizontally and sy vertically.
This is the same as QTransform().scale(sx, sy) but slightly faster.
Definition at line 528 of file qtransform.cpp.
Referenced by QGraphicsItem::boundingRegion(), QWin32PrintEngine::drawPixmap(), QGraphicsItem::scale(), QPixmap::scaled(), QImage::scaled(), QPixmap::scaledToHeight(), QImage::scaledToHeight(), QPixmap::scaledToWidth(), and QImage::scaledToWidth().
|
static |
Creates a matrix which corresponds to a translation of dx along the x axis and dy along the y axis.
This is the same as QTransform().translate(dx, dy) but slightly faster.
Definition at line 462 of file qtransform.cpp.
Referenced by QFontEngine::addOutlineToPath(), QFontEngineBox::addOutlineToPath(), QGraphicsItemGroup::addToGroup(), QPainterPrivate::attachPainterPrivate(), QFontEngineBox::boundingBox(), QGraphicsItemPrivate::combineTransformToParent(), QGraphicsItem::deviceTransform(), QGraphicsOpacityEffect::draw(), draw_text_item_win(), QPaintEnginePrivate::drawBoxTextItem(), QCommonStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QGtkStyle::drawControl(), QRasterPaintEngine::drawImage(), QOpenGLPaintEnginePrivate::drawImageAsPath(), QGraphicsScenePrivate::drawItemHelper(), QGL2PaintEngineEx::drawTextItem(), QOpenGLPaintEngine::drawTextItem(), QPdfBaseEnginePrivate::drawTextItem(), QOpenGLPaintEnginePrivate::drawTiledImageAsPath(), QVGPaintEngine::drawTiledPixmap(), QPaintEngineEx::drawTiledPixmap(), QVGPaintEnginePrivate::ensurePathTransform(), fillBackground(), QGraphicsScenePrivate::gestureEventHandler(), QGraphicsItem::itemTransform(), QGraphicsView::mapFromScene(), QGraphicsView::mapToScene(), QGraphicsItemEffectSourcePrivate::pixmap(), qt_true_matrix(), QGraphicsItemGroup::removeFromGroup(), QGraphicsView::render(), QWidgetPrivate::render_helper(), QGraphicsItem::translate(), QGraphicsItemPrivate::updateSceneTransformFromParent(), and QGraphicsView::viewportTransform().
|
inlineprivate |
Definition at line 193 of file qtransform.h.
Referenced by inverted(), map(), mapRect(), mapToPolygon(), operator*(), operator*=(), rotate(), rotateRadians(), scale(), shear(), and translate().
QTransform QTransform::inverted | ( | bool * | invertible = 0 | ) | const |
Returns an inverted copy of this matrix.
If the matrix is singular (not invertible), the returned matrix is the identity matrix. If invertible is valid (i.e. not 0), its value is set to true if the matrix is invertible, otherwise it is set to false.
Definition at line 364 of file qtransform.cpp.
Referenced by QGraphicsItemGroup::addToGroup(), QGraphicsItem::boundingRegion(), draw_text_item_win(), QRasterPaintEngine::drawImage(), QGraphicsScenePrivate::drawItemHelper(), QGraphicsScenePrivate::drawItems(), QGLEllipseMaskGenerator::drawMask(), QGraphicsScenePrivate::gestureEventHandler(), QGraphicsItemPrivate::initStyleOption(), QGraphicsSceneIndexRectIntersector::intersect(), QGraphicsSceneIndexPointIntersector::intersect(), QGraphicsSceneIndexPathIntersector::intersect(), QGraphicsView::items(), QGraphicsScenePrivate::itemsAtPosition(), QGraphicsItem::itemTransform(), QMacPixmapData::macCreatePixels(), QGraphicsItem::mapFromParent(), QGraphicsItem::mapFromScene(), QGraphicsItem::mapRectFromParent(), QGraphicsItem::mapRectFromScene(), QGraphicsViewPrivate::mapRectToScene(), QGraphicsItem::mouseMoveEvent(), QDeclarativePaintedItem::paint(), QGraphicsItemEffectSourcePrivate::pixmap(), quadToSquare(), QGraphicsItemGroup::removeFromGroup(), QGL2PaintEngineExPrivate::resetClipIfNeeded(), roundInDeviceCoordinates(), QPaintEngineEx::stroke(), QImage::transformed(), QGL2PaintEngineExPrivate::updateBrushUniforms(), QPainterPrivate::updateInvMatrix(), and QRasterPaintEngine::updatePen().
|
inline |
Returns true if the matrix represent an affine transformation, otherwise returns false.
Definition at line 200 of file qtransform.h.
Referenced by QDeclarativeTextLayout::draw(), QRasterPaintEngine::drawCachedGlyphs(), QPaintEngineEx::supportsTransformations(), QPainterPrivate::updateEmulationSpecifier(), and QGLEngineShaderManager::useCorrectShaderProg().
|
inline |
Returns true if the matrix is the identity matrix, otherwise returns false.
Definition at line 204 of file qtransform.h.
Referenced by QGraphicsItemPrivate::TransformData::computedFullTransform(), QDeclarativeImage::paint(), qt_plastique_draw_gradient(), QVGPaintEnginePrivate::setBrushTransform(), QPaintEnginePrivate::setSystemTransform(), QStrokerOps::strokeEllipse(), QStrokerOps::strokePath(), QStrokerOps::strokePolygon(), QPainterPrivate::updateEmulationSpecifier(), and QCoreGraphicsPaintEngine::updateMatrix().
|
inline |
Returns true if the matrix is invertible, otherwise returns false.
Definition at line 209 of file qtransform.h.
|
inline |
Returns true if the matrix represents some kind of a rotating transformation, otherwise returns false.
Definition at line 218 of file qtransform.h.
|
inline |
Returns true if the matrix represents a scaling transformation, otherwise returns false.
Definition at line 214 of file qtransform.h.
Referenced by QDirectFBPaintEngine::drawTiledPixmap(), QDirectFBPaintEnginePrivate::drawTiledPixmap(), QDirectFBPaintEngine::fillRect(), and QWidgetPrivate::render_helper().
|
inline |
Returns true if the matrix represents a translating transformation, otherwise returns false.
Definition at line 223 of file qtransform.h.
Referenced by QPainter::drawStaticText().
|
inline |
Returns the horizontal scaling factor.
Definition at line 237 of file qtransform.h.
Referenced by QPdfEnginePrivate::addBrushPattern(), QFontEngineDirectWrite::alphaMapBoundingBox(), QFontEngineFT::alphaMapBoundingBox(), QGL2PaintEngineEx::beginNativePainting(), QFontEngineWin::boundingBox(), QVGPaintEngine::canVgWritePixels(), clipTransformIsSimple(), QDeclarativeParentChangePrivate::doChange(), QPainterPrivate::draw_helper(), draw_text_item_win(), QRasterPaintEngine::drawCachedGlyphs(), QFontEngineWin::drawGDIGlyph(), QRasterPaintEngine::drawImage(), QRasterPaintEngine::drawTextItem(), QPainter::drawTextItem(), QDirectFBPaintEnginePrivate::drawTiledPixmap(), QRasterPaintEngine::drawTiledPixmap(), QPdf::generateMatrix(), QFontEngine::getGlyphPositions(), QDirectFBPaintEnginePrivate::getTransformationType(), QGLMaskTextureCache::hash(), QFontEngineDirectWrite::imageForGlyph(), QFontEngineFT::loadTransformedGlyphSet(), QMacPixmapData::macCreatePixels(), mapHomogeneous(), operator*(), operator*=(), operator<<(), operator>>(), qFuzzyCompare(), QMatrix4x4::QMatrix4x4(), qt_format_text(), qt_mac_convert_transform_to_cg(), qt_scaleForTransform(), qt_xForm_helper(), qtransform_equals_no_translate(), QVGPaintEnginePrivate::setBrushTransform(), QOpenGLPaintEnginePrivate::setInvMatrixData(), QOutlineMapper::setMatrix(), setMatrix(), QVGPaintEnginePrivate::setTransform(), QGLShaderProgram::setUniformValue(), QSpanData::setupMatrix(), QX11PixmapData::transformed(), QImage::transformed(), transformIsSimple(), QDeclarativeParentAnimation::transition(), QOpenGLPaintEnginePrivate::updateGradient(), QCoreGraphicsPaintEngine::updateMatrix(), QOpenGLPaintEngine::updateMatrix(), QRasterPaintEngine::updateMatrix(), QGL2PaintEngineExPrivate::updateMatrix(), and QBlitterPaintEnginePrivate::updateTransformState().
|
inline |
Returns the vertical shearing factor.
Definition at line 241 of file qtransform.h.
Referenced by QPdfEnginePrivate::addBrushPattern(), QFontEngineDirectWrite::alphaMapBoundingBox(), QFontEngineFT::alphaMapBoundingBox(), QGL2PaintEngineEx::beginNativePainting(), QFontEngineWin::boundingBox(), clipTransformIsSimple(), QDeclarativeParentChangePrivate::doChange(), draw_text_item_win(), QFontEngineWin::drawGDIGlyph(), QRasterPaintEngine::drawImage(), QPainter::drawTextItem(), QPdf::generateMatrix(), QFontEngine::getGlyphPositions(), QGLMaskTextureCache::hash(), QFontEngineDirectWrite::imageForGlyph(), QFontEngineFT::loadTransformedGlyphSet(), QMacPixmapData::macCreatePixels(), mapHomogeneous(), operator*(), operator*=(), operator<<(), operator>>(), qFuzzyCompare(), QMatrix4x4::QMatrix4x4(), qt_mac_convert_transform_to_cg(), qt_scaleForTransform(), qt_xForm_helper(), qtransform_equals_no_translate(), QGLEllipseMaskGenerator::screenRect(), QVGPaintEnginePrivate::setBrushTransform(), QOpenGLPaintEnginePrivate::setInvMatrixData(), QOutlineMapper::setMatrix(), setMatrix(), QVGPaintEnginePrivate::setTransform(), QGLShaderProgram::setUniformValue(), QSpanData::setupMatrix(), QX11PixmapData::transformed(), QImage::transformed(), transformIsSimple(), QDeclarativeParentAnimation::transition(), QOpenGLPaintEnginePrivate::updateGradient(), QCoreGraphicsPaintEngine::updateMatrix(), QOpenGLPaintEngine::updateMatrix(), QRasterPaintEngine::updateMatrix(), and QGL2PaintEngineExPrivate::updateMatrix().
|
inline |
Returns the horizontal projection factor.
Definition at line 245 of file qtransform.h.
Referenced by QGL2PaintEngineEx::beginNativePainting(), QRasterPaintEngine::drawImage(), QGLMaskTextureCache::hash(), mapHomogeneous(), needsPerspectiveClipping(), operator*(), operator*=(), operator<<(), operator>>(), qFuzzyCompare(), QMatrix4x4::QMatrix4x4(), QVGPaintEnginePrivate::setBrushTransform(), QOpenGLPaintEnginePrivate::setInvMatrixData(), QOutlineMapper::setMatrix(), setMatrix(), QVGPaintEnginePrivate::setTransform(), QGLShaderProgram::setUniformValue(), QSpanData::setupMatrix(), QX11PixmapData::transformed(), QCoreGraphicsPaintEngine::updateMatrix(), QOpenGLPaintEngine::updateMatrix(), QGL2PaintEngineExPrivate::updateMatrix(), and QVGPaintEnginePrivate::updateTransform().
|
inline |
Returns the horizontal shearing factor.
Definition at line 249 of file qtransform.h.
Referenced by QPdfEnginePrivate::addBrushPattern(), QFontEngineDirectWrite::alphaMapBoundingBox(), QFontEngineFT::alphaMapBoundingBox(), QGL2PaintEngineEx::beginNativePainting(), QFontEngineWin::boundingBox(), clipTransformIsSimple(), draw_text_item_win(), QFontEngineWin::drawGDIGlyph(), QRasterPaintEngine::drawImage(), QPainter::drawTextItem(), QPdf::generateMatrix(), QFontEngine::getGlyphPositions(), QGLMaskTextureCache::hash(), QFontEngineDirectWrite::imageForGlyph(), QFontEngineFT::loadTransformedGlyphSet(), QMacPixmapData::macCreatePixels(), mapHomogeneous(), operator*(), operator*=(), operator<<(), operator>>(), qFuzzyCompare(), QMatrix4x4::QMatrix4x4(), qt_mac_convert_transform_to_cg(), qt_scaleForTransform(), qt_xForm_helper(), qtransform_equals_no_translate(), QGLEllipseMaskGenerator::screenRect(), QVGPaintEnginePrivate::setBrushTransform(), QOpenGLPaintEnginePrivate::setInvMatrixData(), QOutlineMapper::setMatrix(), setMatrix(), QVGPaintEnginePrivate::setTransform(), QGLShaderProgram::setUniformValue(), QSpanData::setupMatrix(), QX11PixmapData::transformed(), QImage::transformed(), transformIsSimple(), QOpenGLPaintEnginePrivate::updateGradient(), QCoreGraphicsPaintEngine::updateMatrix(), QOpenGLPaintEngine::updateMatrix(), QRasterPaintEngine::updateMatrix(), and QGL2PaintEngineExPrivate::updateMatrix().
|
inline |
Returns the vertical scaling factor.
Definition at line 253 of file qtransform.h.
Referenced by QPdfEnginePrivate::addBrushPattern(), QFontEngineDirectWrite::alphaMapBoundingBox(), QFontEngineFT::alphaMapBoundingBox(), QGL2PaintEngineEx::beginNativePainting(), QFontEngineWin::boundingBox(), QVGPaintEngine::canVgWritePixels(), QGL2PaintEngineEx::clip(), clipTransformIsSimple(), QDeclarativeParentChangePrivate::doChange(), QPainterPrivate::draw_helper(), draw_text_item_win(), QFontEngineWin::drawGDIGlyph(), QVGPaintEngine::drawImage(), QRasterPaintEngine::drawImage(), QRasterPaintEngine::drawTextItem(), QPainter::drawTextItem(), QDirectFBPaintEnginePrivate::drawTiledPixmap(), QRasterPaintEngine::drawTiledPixmap(), QPdf::generateMatrix(), QFontEngine::getGlyphPositions(), QDirectFBPaintEnginePrivate::getTransformationType(), QGLMaskTextureCache::hash(), QFontEngineDirectWrite::imageForGlyph(), QFontEngineFT::loadTransformedGlyphSet(), QMacPixmapData::macCreatePixels(), mapHomogeneous(), operator*(), operator*=(), operator<<(), operator>>(), qFuzzyCompare(), QMatrix4x4::QMatrix4x4(), qt_format_text(), qt_mac_convert_transform_to_cg(), qt_scaleForTransform(), qt_xForm_helper(), qtransform_equals_no_translate(), QGLEllipseMaskGenerator::screenRect(), QVGPaintEnginePrivate::setBrushTransform(), QOpenGLPaintEnginePrivate::setInvMatrixData(), QOutlineMapper::setMatrix(), setMatrix(), QVGPaintEnginePrivate::setTransform(), QGLShaderProgram::setUniformValue(), QSpanData::setupMatrix(), QX11PixmapData::transformed(), QImage::transformed(), transformIsSimple(), QDeclarativeParentAnimation::transition(), QOpenGLPaintEnginePrivate::updateGradient(), QCoreGraphicsPaintEngine::updateMatrix(), QOpenGLPaintEngine::updateMatrix(), QRasterPaintEngine::updateMatrix(), QGL2PaintEngineExPrivate::updateMatrix(), and QBlitterPaintEnginePrivate::updateTransformState().
|
inline |
Returns the vertical projection factor.
Definition at line 257 of file qtransform.h.
Referenced by QGL2PaintEngineEx::beginNativePainting(), QRasterPaintEngine::drawImage(), QGLMaskTextureCache::hash(), mapHomogeneous(), needsPerspectiveClipping(), operator*(), operator*=(), operator<<(), operator>>(), qFuzzyCompare(), QMatrix4x4::QMatrix4x4(), QVGPaintEnginePrivate::setBrushTransform(), QOpenGLPaintEnginePrivate::setInvMatrixData(), QOutlineMapper::setMatrix(), setMatrix(), QVGPaintEnginePrivate::setTransform(), QGLShaderProgram::setUniformValue(), QSpanData::setupMatrix(), QX11PixmapData::transformed(), QCoreGraphicsPaintEngine::updateMatrix(), QOpenGLPaintEngine::updateMatrix(), QGL2PaintEngineExPrivate::updateMatrix(), and QVGPaintEnginePrivate::updateTransform().
|
inline |
Returns the horizontal translation factor.
Definition at line 261 of file qtransform.h.
Referenced by QRasterPaintEngine::drawImage(), QGLMaskTextureCache::hash(), mapHomogeneous(), operator*(), operator*=(), operator<<(), operator>>(), qFuzzyCompare(), QVGPaintEnginePrivate::setBrushTransform(), QOpenGLPaintEnginePrivate::setInvMatrixData(), setMatrix(), QVGPaintEnginePrivate::setTransform(), QGLShaderProgram::setUniformValue(), and QCoreGraphicsPaintEngine::updateMatrix().
|
inline |
Returns the vertical translation factor.
Definition at line 265 of file qtransform.h.
Referenced by QRasterPaintEngine::drawImage(), QGLMaskTextureCache::hash(), mapHomogeneous(), operator*(), operator*=(), operator<<(), operator>>(), qFuzzyCompare(), QVGPaintEnginePrivate::setBrushTransform(), QOpenGLPaintEnginePrivate::setInvMatrixData(), setMatrix(), QVGPaintEnginePrivate::setTransform(), QGLShaderProgram::setUniformValue(), and QCoreGraphicsPaintEngine::updateMatrix().
|
inline |
Returns the division factor.
Definition at line 269 of file qtransform.h.
Referenced by QGL2PaintEngineEx::beginNativePainting(), QRasterPaintEngine::drawImage(), QGLMaskTextureCache::hash(), mapHomogeneous(), needsPerspectiveClipping(), operator*(), operator*=(), operator<<(), operator>>(), qFuzzyCompare(), QMatrix4x4::QMatrix4x4(), QVGPaintEnginePrivate::setBrushTransform(), QOpenGLPaintEnginePrivate::setInvMatrixData(), QOutlineMapper::setMatrix(), setMatrix(), QVGPaintEnginePrivate::setTransform(), QGLShaderProgram::setUniformValue(), QSpanData::setupMatrix(), QCoreGraphicsPaintEngine::updateMatrix(), QOpenGLPaintEngine::updateMatrix(), QGL2PaintEngineExPrivate::updateMatrix(), and QVGPaintEnginePrivate::updateTransform().
Creates and returns a QPoint object that is a copy of the given point, mapped into the coordinate system defined by this matrix.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Note that the transformed coordinates are rounded to the nearest integer.
Definition at line 1154 of file qtransform.cpp.
Referenced by QGraphicsItem::boundingRegion(), QSvgArc::bounds(), QSvgEllipse::bounds(), QSvgLine::bounds(), QSvgPath::bounds(), QSvgPolygon::bounds(), QSvgPolyline::bounds(), boundsOnStroke(), QRasterPaintEngine::clip(), QGraphicsItem::clipPath(), QPainter::clipRegion(), QOpenGLPaintEnginePrivate::composite(), QGLLineMaskGenerator::computeScreenRect(), QGLRectMaskGenerator::computeScreenRect(), cubicToHook(), QDeclarativeParentChangePrivate::doChange(), draw_text_item_win(), QVGPaintEngine::drawImage(), QRasterPaintEngine::drawImage(), QPaintEngine::drawPoints(), QRasterPaintEngine::drawRects(), QPdfEnginePrivate::drawTextItem(), QRasterPaintEngine::drawTiledPixmap(), QOutlineMapper::endOutline(), QRasterPaintEngine::fill(), QRasterPaintEngine::fillRect(), QGraphicsView::fitInView(), QPdf::generatePath(), QGraphicsScenePrivate::gestureEventHandler(), QTriangulator< T >::initialize(), QGraphicsScene::inputMethodQuery(), QGraphicsSceneIndexRectIntersector::intersect(), QGraphicsSceneIndexPointIntersector::intersect(), QGraphicsSceneIndexPathIntersector::intersect(), QGraphicsScenePrivate::itemsAtPosition(), QStyleOptionGraphicsItem::levelOfDetailFromTransform(), lineToHook(), QMacPixmapData::macCreatePixels(), map(), map(), QBezier::mapBy(), QGraphicsItem::mapFromItem(), QGraphicsItem::mapFromParent(), QGraphicsView::mapFromScene(), QGraphicsItem::mapFromScene(), mapProjective(), mapRect(), QGraphicsItem::mapToItem(), QGraphicsItem::mapToParent(), QGraphicsView::mapToScene(), QGraphicsViewPrivate::mapToScene(), QGraphicsItem::mapToScene(), QGraphicsItem::mouseMoveEvent(), moveToHook(), operator*(), QDeclarativePaintedItem::paint(), QVGPaintEnginePrivate::painterPathToVGPath(), QPaintBufferEngine::penChanged(), QWidgetEffectSourcePrivate::pixmap(), qt_transform_image(), QGraphicsSceneIndexPrivate::recursive_items_helper(), QWidget::render(), roundInDeviceCoordinates(), QPaintEngineEx::stroke(), QRasterPaintEngine::stroke(), QOpenGLPaintEnginePrivate::strokePath(), glyph_metrics_t::transformed(), QImage::transformed(), QPaintEnginePrivate::transformSystemClip(), QDeclarativeParentAnimation::transition(), QWin32PrintEngine::updateClipPath(), QOpenGLPaintEnginePrivate::updateGradient(), QGraphicsViewPrivate::updateRegion(), QDeclarativeFlipablePrivate::updateSceneTransformFromParent(), QVGPaintEnginePrivate::vectorPathToVGPath(), and QPdfEnginePrivate::~QPdfEnginePrivate().
Creates and returns a QPointF object that is a copy of the given point, p, mapped into the coordinate system defined by this matrix.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1208 of file qtransform.cpp.
Creates and returns a QLineF object that is a copy of the given line, l, mapped into the coordinate system defined by this matrix.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1283 of file qtransform.cpp.
Creates and returns a QLine object that is a copy of the given line, mapped into the coordinate system defined by this matrix.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Note that the transformed coordinates are rounded to the nearest integer.
Definition at line 1345 of file qtransform.cpp.
Creates and returns a QPolygonF object that is a copy of the given polygon, mapped into the coordinate system defined by this matrix.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1443 of file qtransform.cpp.
Creates and returns a QPolygon object that is a copy of the given polygon, mapped into the coordinate system defined by this matrix.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Note that the transformed coordinates are rounded to the nearest integer.
Definition at line 1476 of file qtransform.cpp.
Creates and returns a QRegion object that is a copy of the given region, mapped into the coordinate system defined by this matrix.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Calling this method can be rather expensive if rotations or shearing are used.
Definition at line 1524 of file qtransform.cpp.
QPainterPath QTransform::map | ( | const QPainterPath & | path | ) | const |
Creates and returns a QPainterPath object that is a copy of the given path, mapped into the coordinate system defined by this matrix.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1687 of file qtransform.cpp.
void QTransform::map | ( | int | x, |
int | y, | ||
int * | tx, | ||
int * | ty | ||
) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Maps the given coordinates x and y into the coordinate system defined by this matrix.
The resulting values are put in *tx and *ty, respectively. Note that the transformed coordinates are rounded to the nearest integer.
Definition at line 2084 of file qtransform.cpp.
Maps the given coordinates x and y into the coordinate system defined by this matrix.
The resulting values are put in *tx and *ty, respectively.
The coordinates are transformed using the following formulas:
The point (x, y) is the original point, and (x', y') is the transformed point.
Definition at line 2070 of file qtransform.cpp.
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate system defined by this matrix.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Note that the transformed coordinates are rounded to the nearest integer.
Definition at line 1920 of file qtransform.cpp.
Referenced by QGraphicsItemGroup::addToGroup(), QDirectFBPaintEnginePrivate::blit(), QGraphicsItem::boundingRegion(), QSvgImage::bounds(), QSvgRect::bounds(), QGraphicsItemPrivate::childrenBoundingRectHelper(), QGL2PaintEngineEx::clip(), QRasterPaintEngine::clip(), QPainter::clipBoundingRect(), QPainter::clipRegion(), QStyleSheetStyle::drawControl(), QRasterPaintEngine::drawEllipse(), QDirectFBPaintEngine::drawImage(), QRasterPaintEngine::drawImage(), QGraphicsScenePrivate::drawItemHelper(), QGraphicsScenePrivate::drawItems(), QBlitterPaintEngine::drawPixmap(), QDirectFBPaintEngine::drawPixmap(), QGraphicsScenePrivate::drawSubtreeRecursive(), QGraphicsItem::ensureVisible(), QRasterPaintEngine::fill(), QRasterPaintEngine::fillPath(), QBlitterPaintEngine::fillRect(), QDirectFBPaintEngine::fillRect(), QRasterPaintEngine::fillRect(), QGraphicsItemPrivate::initStyleOption(), QGraphicsScene::inputMethodQuery(), QGraphicsSceneIndexRectIntersector::intersect(), QGraphicsSceneIndexPointIntersector::intersect(), QGraphicsSceneIndexPathIntersector::intersect(), QOpenGLPaintEnginePrivate::isFastRect(), QGraphicsView::items(), QGraphicsScenePrivate::itemsAtPosition(), map(), map(), QGraphicsItem::mapRectFromItem(), QGraphicsItem::mapRectFromParent(), QGraphicsViewPrivate::mapRectFromScene(), QGraphicsItem::mapRectFromScene(), QGraphicsItem::mapRectToItem(), QGraphicsItem::mapRectToParent(), QGraphicsViewPrivate::mapRectToScene(), QGraphicsItem::mapRectToScene(), QSvgTinyDocument::mapSourceToTarget(), QGraphicsViewPrivate::mapToViewRect(), QGraphicsViewPrivate::mapToViewRegion(), QDeclarativePaintedItem::paint(), QBlittablePixmapData::paintEngine(), QGraphicsView::paintEvent(), QWidgetEffectSourcePrivate::pixmap(), QGraphicsItem::prepareGeometryChange(), QGraphicsScenePrivate::processDirtyItemsRecursive(), QWin32PrintEngine::property(), qt_graphicsItem_highlightSelected(), qt_true_matrix(), QSvgIOHandler::read(), QGraphicsViewPrivate::recalculateContentSize(), QWidgetPrivate::render_helper(), QGL2PaintEngineExPrivate::resetClipIfNeeded(), QGraphicsItem::sceneBoundingRect(), QGraphicsItemPrivate::sceneEffectiveBoundingRect(), QGLEllipseMaskGenerator::screenRect(), QGraphicsViewPrivate::setUpdateClip(), QPaintEngineEx::stroke(), QDirectFBPixmapData::transformed(), glyph_metrics_t::transformed(), QImage::trueMatrix(), QGraphicsScene::update(), QPaintBufferPrivate::updateBoundingRect(), updateHelper(), QRasterPaintEngine::updatePen(), QGraphicsViewPrivate::updateRegion(), QGraphicsView::updateScene(), and QPicturePaintEngine::writeCmdLength().
Creates and returns a QRectF object that is a copy of the given rectangle, mapped into the coordinate system defined by this matrix.
The rectangle's coordinates are transformed using the following formulas:
If rotation or shearing has been specified, this function returns the bounding rectangle. To retrieve the exact region the given rectangle maps to, use the mapToPolygon() function instead.
Definition at line 1993 of file qtransform.cpp.
Creates and returns a QPolygon representation of the given rectangle, mapped into the coordinate system defined by this matrix.
The rectangle's coordinates are transformed using the following formulas:
Polygons and rectangles behave slightly differently when transformed (due to integer rounding), so matrix.map(QPolygon(rectangle))
is not always the same as matrix.mapToPolygon(rectangle)
.
Definition at line 1735 of file qtransform.cpp.
QTransform::operator QVariant | ( | ) | const |
Returns the transform as a QVariant.
Definition at line 2160 of file qtransform.cpp.
bool QTransform::operator!= | ( | const QTransform & | matrix | ) | const |
Returns true if this matrix is not equal to the given matrix, otherwise returns false.
Definition at line 804 of file qtransform.cpp.
QTransform QTransform::operator* | ( | const QTransform & | matrix | ) | const |
Returns the result of multiplying this matrix by the given matrix.
Note that matrix multiplication is not commutative, i.e. a*b != b*a.
Definition at line 898 of file qtransform.cpp.
QTransform & QTransform::operator*= | ( | const QTransform & | matrix | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the result of multiplying this matrix by the given matrix.
Definition at line 816 of file qtransform.cpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the result of performing an element-wise multiplication of this matrix with the given scalar.
Definition at line 282 of file qtransform.h.
|
inline |
Returns the matrix obtained by adding the given scalar to each element of this matrix.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 306 of file qtransform.h.
|
inline |
Returns the matrix obtained by subtracting the given scalar from each element of this matrix.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 322 of file qtransform.h.
|
inline |
Returns the result of performing an element-wise division of this matrix by the given scalar.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 299 of file qtransform.h.
QTransform & QTransform::operator= | ( | const QTransform & | matrix | ) |
Assigns the given matrix's values to this matrix.
Definition at line 1017 of file qtransform.cpp.
Referenced by operator*=().
bool QTransform::operator== | ( | const QTransform & | matrix | ) | const |
Returns true if this matrix is equal to the given matrix, otherwise returns false.
Definition at line 783 of file qtransform.cpp.
Referenced by operator!=().
|
static |
Creates a transformation matrix, trans, that maps a four-sided polygon, one, to another four-sided polygon, two.
Returns true if the transformation is possible; otherwise returns false.
This is a convenience method combining quadToSquare() and squareToQuad() methods. It allows the input quad to be transformed into any other quad.
Definition at line 1876 of file qtransform.cpp.
|
static |
Creates a transformation matrix, trans, that maps a four-sided polygon, quad, to a unit square.
Returns true if the transformation is constructed or false if such a transformation does not exist.
Definition at line 1853 of file qtransform.cpp.
Referenced by quadToQuad().
void QTransform::reset | ( | ) |
Resets the matrix to an identity matrix, i.e.
all elements are set to zero, except m11
and m22
(specifying the scale) and m33
which are set to 1.
Definition at line 1042 of file qtransform.cpp.
Referenced by QPainterState::init().
QTransform & QTransform::rotate | ( | qreal | angle, |
Qt::Axis | axis = Qt::ZAxis |
||
) |
Rotates the coordinate system counterclockwise by the given angle about the specified axis and returns a reference to the matrix.
Note that if you apply a QTransform to a point defined in widget coordinates, the direction of the rotation will be clockwise because the y-axis points downwards.
The angle is specified in degrees.
Definition at line 615 of file qtransform.cpp.
Referenced by QGraphicsItemGroup::addToGroup(), QGraphicsItemPrivate::TransformData::computedFullTransform(), QDeclarativeParentChangePrivate::doChange(), QCommonStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QStyleSheetStyle::drawControl(), QEmulationPaintEngine::drawPixmapFragments(), QVGPaintEngine::drawPixmapFragments(), QPaintEngineEx::drawPixmapFragments(), QPainter::drawPixmapFragments(), QWindowsMobileStylePrivate::drawScrollbarGrip(), QWindowsMobileStylePrivate::drawScrollbarHandleDown(), QWindowsMobileStylePrivate::drawScrollbarHandleUp(), qDrawPlainRect(), QGraphicsItemGroup::removeFromGroup(), QSvgAnimateTransform::resolveMatrix(), QGraphicsView::rotate(), QDeclarativeFlipablePrivate::setBackTransform(), and QDeclarativeParentAnimation::transition().
QTransform & QTransform::rotateRadians | ( | qreal | angle, |
Qt::Axis | axis = Qt::ZAxis |
||
) |
Rotates the coordinate system counterclockwise by the given angle about the specified axis and returns a reference to the matrix.
Note that if you apply a QTransform to a point defined in widget coordinates, the direction of the rotation will be clockwise because the y-axis points downwards.
The angle is specified in radians.
Definition at line 711 of file qtransform.cpp.
QTransform & QTransform::scale | ( | qreal | sx, |
qreal | sy | ||
) |
Scales the coordinate system by sx horizontally and sy vertically, and returns a reference to the matrix.
Definition at line 485 of file qtransform.cpp.
Referenced by QPrintPreviewWidgetPrivate::_q_fit(), QGraphicsItemGroup::addToGroup(), QGraphicsItemPrivate::TransformData::computedFullTransform(), cubicTo_clipped(), QDeclarativeParentChangePrivate::doChange(), QAlphaPaintEnginePrivate::drawAlphaImage(), QVGPaintEngine::drawCachedGlyphs(), QCleanlooksStyle::drawControl(), QRasterPaintEngine::drawImage(), QOpenGLPaintEnginePrivate::drawImageAsPath(), QGraphicsScenePrivate::drawItemHelper(), QVGPaintEngine::drawPixmapFragments(), QEmulationPaintEngine::drawTextItem(), QOpenGLPaintEnginePrivate::drawTiledImageAsPath(), drawVGImage(), QPicture::exec(), QEmulationPaintEngine::fill(), fillBackground(), QAlphaPaintEngine::flushAndInit(), lineTo_clipped(), QSvgTinyDocument::mapSourceToTarget(), QmlJSDebugger::ZoomTool::mouseReleaseEvent(), QDeclarativeImage::paint(), QSvgIOHandler::read(), QGraphicsItemGroup::removeFromGroup(), QSvgAnimateTransform::resolveMatrix(), QGraphicsView::scale(), QmlJSDebugger::ZoomTool::scaleView(), QPainterReplayer::setupTransform(), QEmulationPaintEngine::stroke(), and QDeclarativeParentAnimation::transition().
void QTransform::setMatrix | ( | qreal | m11, |
qreal | m12, | ||
qreal | m13, | ||
qreal | m21, | ||
qreal | m22, | ||
qreal | m23, | ||
qreal | m31, | ||
qreal | m32, | ||
qreal | m33 | ||
) |
Sets the matrix elements to the specified values, m11, m12, m13 m21, m22, m23 m31, m32 and m33.
Note that this function replaces the previous values. QTransform provides the translate(), rotate(), scale() and shear() convenience functions to manipulate the various matrix elements based on the currently defined coordinate system.
Definition at line 1901 of file qtransform.cpp.
Referenced by operator>>(), and squareToQuad().
QTransform & QTransform::shear | ( | qreal | sh, |
qreal | sv | ||
) |
Shears the coordinate system by sh horizontally and sv vertically, and returns a reference to the matrix.
Definition at line 551 of file qtransform.cpp.
Referenced by QSvgAnimateTransform::resolveMatrix(), and QGraphicsView::shear().
|
static |
Creates a transformation matrix, trans, that maps a unit square to a four-sided polygon, quad.
Returns true if the transformation is constructed or false if such a transformation does not exist.
Definition at line 1785 of file qtransform.cpp.
Referenced by quadToQuad(), and quadToSquare().
const QMatrix & QTransform::toAffine | ( | ) | const |
Returns the QTransform as an affine matrix.
Definition at line 2099 of file qtransform.cpp.
Referenced by QPainter::combinedMatrix(), QGraphicsItemPrivate::initStyleOption(), QGraphicsItem::matrix(), QPaintEngineState::matrix(), QSvgTinyDocument::matrixForElement(), QGraphicsItem::sceneMatrix(), and QGraphicsItem::setMatrix().
QTransform & QTransform::translate | ( | qreal | dx, |
qreal | dy | ||
) |
Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to the matrix.
Definition at line 417 of file qtransform.cpp.
Referenced by QPdfEnginePrivate::addBrushPattern(), QFontEngineFT::addOutlineToPath(), QGraphicsItemGroup::addToGroup(), QPainterPrivate::attachPainterPrivate(), QVGCompositionHelper::blitWindow(), QRasterPaintEnginePrivate::brushMatrix(), QProxyFontEngine::canRender(), QGraphicsItemPrivate::combineTransformFromParent(), QGraphicsItemPrivate::TransformData::computedFullTransform(), QDeclarativeParentChangePrivate::doChange(), QFontEngineMac::draw(), QFontEngineQPF::draw(), QFontEngineQPF1::draw(), QVGPaintEngine::drawCachedGlyphs(), QRasterPaintEngine::drawCachedGlyphs(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QMotifStyle::drawControl(), QStyleSheetStyle::drawControl(), QVGCompositionHelper::drawCursorPixmap(), QX11PaintEngine::drawFreetype(), QRasterPaintEngine::drawImage(), QOpenGLPaintEnginePrivate::drawImageAsPath(), QGraphicsScenePrivate::drawItemHelper(), QEmulationPaintEngine::drawPixmapFragments(), QVGPaintEngine::drawPixmapFragments(), QPaintEngineEx::drawPixmapFragments(), QPainter::drawPixmapFragments(), QEmulationPaintEngine::drawTextItem(), QRasterPaintEngine::drawTextItem(), QOpenGLPaintEnginePrivate::drawTiledImageAsPath(), QRasterPaintEngine::drawTiledPixmap(), drawVGImage(), QX11PaintEngine::drawXLFD(), QEmulationPaintEngine::fill(), fillBackground(), QDirectFBPaintEngine::fillRect(), QStaticTextPrivate::get(), QGraphicsItem::mouseMoveEvent(), QPdfEnginePrivate::pageMatrix(), QDeclarativeImage::paint(), QDeclarativeBorderImage::paint(), qDrawPlainRect(), qt_vg_drawVGImageStencil(), QSvgIOHandler::read(), QGraphicsItemGroup::removeFromGroup(), QGraphicsScene::render(), QGraphicsView::render(), QWidgetPrivate::render_helper(), QSvgAnimateTransform::resolveMatrix(), QDeclarativeFlipablePrivate::setBackTransform(), QVGPaintEnginePrivate::setBrushTransform(), QSpanData::setupMatrix(), QEmulationPaintEngine::stroke(), QDeclarativeParentAnimation::transition(), QGraphicsView::translate(), QImage::trueMatrix(), QGL2PaintEngineExPrivate::updateBrushUniforms(), QOpenGLPaintEnginePrivate::updateGradient(), and QGraphicsItemPrivate::updateSceneTransformFromParent().
QTransform QTransform::transposed | ( | ) | const |
Returns the transpose of this matrix.
Definition at line 344 of file qtransform.cpp.
QTransform::TransformationType QTransform::type | ( | ) | const |
Returns the transformation type of this matrix.
The transformation type is the highest enumeration value capturing all of the matrix's transformations. For example, if the matrix both scales and shears, the type would be TxShear
, because TxShear
has a higher enumeration value than TxScale
.
Knowing the transformation type of a matrix is useful for optimization: you can often handle specific types more optimally than handling the generic case.
Definition at line 2116 of file qtransform.cpp.
Referenced by QFontEngineFT::alphaMapBoundingBox(), QFontEngine::alphaMapForGlyph(), QFontEngineMac::alphaRGBMapForGlyph(), QFontEngineFT::alphaRGBMapForGlyph(), QFontEngineWin::boundingBox(), QFontEngine::boundingBox(), QVGPaintEngine::canVgWritePixels(), QGL2PaintEngineEx::clip(), QRasterPaintEngine::clip(), QPainter::clipRegion(), clipTransformIsSimple(), QDeclarativeParentChangePrivate::doChange(), QPixmapConvolutionFilter::draw(), QPainterPrivate::draw_helper(), QWindowsXPStylePrivate::drawBackground(), QVGPaintEngine::drawCachedGlyphs(), QGL2PaintEngineExPrivate::drawCachedGlyphs(), QRasterPaintEngine::drawCachedGlyphs(), QTextLayout::drawCursor(), QRasterPaintEngine::drawEllipse(), QFontEngineWin::drawGDIGlyph(), QRasterPaintEngine::drawImage(), QGraphicsScenePrivate::drawItemHelper(), QRasterPaintEngine::drawPixmap(), QRasterPaintEngine::drawRects(), QGL2PaintEngineEx::drawStaticTextItem(), QGraphicsScenePrivate::drawSubtreeRecursive(), QGL2PaintEngineEx::drawTextItem(), QRasterPaintEngine::drawTextItem(), QDirectFBPaintEnginePrivate::drawTiledPixmap(), QRasterPaintEngine::drawTiledPixmap(), QRasterPaintEngine::fill(), QBlitterPaintEngine::fillRect(), QRasterPaintEngine::fillRect(), QGraphicsViewPrivate::findItems(), QGLRectMaskGenerator::generateTrapezoids(), QRasterPaintEnginePrivate::getPenFunc(), QDirectFBPaintEnginePrivate::getTransformationType(), QOpenGLPaintEnginePrivate::isFastRect(), QGraphicsScenePrivate::itemsAtPosition(), QStyleOptionGraphicsItem::levelOfDetailFromTransform(), QFontEngineFT::loadTransformedGlyphSet(), operator*(), operator<<(), QDeclarativePaintedItem::paint(), qDrawBorderPixmap(), qt_format_text(), qt_scaleForTransform(), qtransform_equals_no_translate(), QRasterPaintEnginePrivate::recalculateFastImages(), QGL2PaintEngineExPrivate::setBrush(), QOutlineMapper::setMatrix(), QSpanData::setupMatrix(), QPaintEngineEx::stroke(), QRasterPaintEngine::supportsTransformations(), QTextureGlyphCache::textureMapForGlyph(), QPaintBufferEngine::transformChanged(), QDirectFBPixmapData::transformed(), QX11PixmapData::transformed(), glyph_metrics_t::transformed(), QPixmap::transformed(), QImage::transformed(), transformIsSimple(), QPaintEnginePrivate::transformSystemClip(), QDeclarativeParentAnimation::transition(), QRasterPaintEngine::updateBrush(), QPainterPrivate::updateEmulationSpecifier(), QX11PaintEngine::updateMatrix(), QOpenGLPaintEngine::updateMatrix(), QRasterPaintEngine::updateMatrix(), QGL2PaintEngineExPrivate::updateMatrix(), QRasterPaintEnginePrivate::updateMatrixData(), QRasterPaintEngine::updatePen(), and QBlitterPaintEnginePrivate::updateTransformState().
|
related |
This is the same as {matrix}.map({point}).
Definition at line 365 of file qtransform.h.
|
related |
Same as {matrix}.map({point}).
Definition at line 367 of file qtransform.h.
|
related |
This is the same as {matrix}.map({line}).
Definition at line 369 of file qtransform.h.
|
related |
This is the same as {matrix}.map({line}).
Definition at line 371 of file qtransform.h.
|
related |
This is the same as {matrix}.map({polygon}).
Definition at line 375 of file qtransform.h.
|
related |
This is the same as {matrix}.map({polygon}).
Definition at line 373 of file qtransform.h.
|
related |
This is the same as {matrix}.map({region}).
Definition at line 377 of file qtransform.h.
|
related |
This is the same as {matrix}.map({path}).
Definition at line 379 of file qtransform.h.
|
related |
Writes the given matrix to the given stream and returns a reference to the stream.
Definition at line 1064 of file qtransform.cpp.
|
related |
Reads the given matrix from the given stream and returns a reference to the stream.
Definition at line 1091 of file qtransform.cpp.
|
related |
Returns true if t1 and t2 are equal, allowing for a small fuzziness factor for floating-point comparisons; false otherwise.
Definition at line 339 of file qtransform.h.
Referenced by qt_scaleForTransform().
|
private |
Definition at line 179 of file qtransform.h.
Referenced by adjoint(), inverted(), map(), mapRect(), mapToPolygon(), operator*(), operator*=(), operator=(), operator==(), reset(), rotate(), rotateRadians(), scale(), setMatrix(), shear(), toAffine(), translate(), transposed(), and type().
|
private |
Definition at line 187 of file qtransform.h.
Referenced by squareToQuad().
|
private |
Definition at line 180 of file qtransform.h.
Referenced by adjoint(), map(), operator*(), operator*=(), operator=(), operator==(), reset(), rotate(), rotateRadians(), scale(), setMatrix(), shear(), translate(), transposed(), and type().
|
private |
Definition at line 181 of file qtransform.h.
Referenced by adjoint(), map(), operator*(), operator*=(), operator=(), operator==(), reset(), rotate(), rotateRadians(), scale(), setMatrix(), shear(), translate(), transposed(), and type().
|
private |
Definition at line 182 of file qtransform.h.
Referenced by adjoint(), map(), operator*(), operator*=(), operator=(), operator==(), reset(), setMatrix(), translate(), transposed(), and type().
|
mutableprivate |
Definition at line 185 of file qtransform.h.
Referenced by fromScale(), fromTranslate(), inverted(), operator*(), operator*=(), operator=(), reset(), rotate(), rotateRadians(), scale(), setMatrix(), shear(), translate(), transposed(), and type().
|
mutableprivate |
Definition at line 184 of file qtransform.h.
Referenced by fromScale(), fromTranslate(), inverted(), operator*(), operator*=(), operator=(), reset(), rotate(), rotateRadians(), setMatrix(), transposed(), and type().