本文整理汇总了C++中QTransform::m22方法的典型用法代码示例。如果您正苦于以下问题:C++ QTransform::m22方法的具体用法?C++ QTransform::m22怎么用?C++ QTransform::m22使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTransform
的用法示例。
在下文中一共展示了QTransform::m22方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: transform
void VGradientEx::transform( const QTransform &m )
{
double mx, my;
mx = m.m11() * m_origin.x() + m.m21() * m_origin.y() + m.dx();
my = m.m22() * m_origin.y() + m.m12() * m_origin.x() + m.dy();
m_origin = FPoint(mx, my);
mx = m.m11() * m_focalPoint.x() + m.m21() * m_focalPoint.y() + m.dx();
my = m.m22() * m_focalPoint.y() + m.m12() * m_focalPoint.x() + m.dy();
m_focalPoint = FPoint(mx, my);
mx = m.m11() * m_vector.x() + m.m21() * m_vector.y() + m.dx();
my = m.m22() * m_vector.y() + m.m12() * m_vector.x() + m.dy();
m_vector = FPoint(mx, my);
}
示例2: preciselyMap
static QLineF preciselyMap( const QTransform& transform, const QLineF& line )
{
qreal fx1 = line.x1();
qreal fy1 = line.y1();
qreal fx2 = line.x2();
qreal fy2 = line.y2();
qreal x1 = transform.m11() * fx1 + transform.m21() * fy1 + transform.dx();
qreal y1 = transform.m12() * fx1 + transform.m22() * fy1 + transform.dy();
qreal x2 = transform.m11() * fx2 + transform.m21() * fy2 + transform.dx();
qreal y2 = transform.m12() * fx2 + transform.m22() * fy2 + transform.dy();
return QLineF( x1, y1, x2, y2 );
}
示例3: NewSceneRect
/**
* @brief NewSceneRect calculate scene rect what contains all items and doesn't less that size of scene view.
* @param sc scene.
* @param view view.
*/
void VAbstractTool::NewSceneRect(QGraphicsScene *sc, QGraphicsView *view)
{
QRectF rect = sc->itemsBoundingRect();
QRect rec0 = view->rect();
rec0 = QRect(0, 0, rec0.width()-2, rec0.height()-2);
QTransform t = view->transform();
QRectF rec1;
if (t.m11() < 1)
{
qreal width = rec0.width()/t.m11();
qreal height = rec0.height()/t.m22();
rec1 = QRect(0, 0, static_cast<qint32>(width), static_cast<qint32>(height));
rec1.translate(rec0.center().x()-rec1.center().x(), rec0.center().y()-rec1.center().y());
QPolygonF polygone = view->mapToScene(rec1.toRect());
rec1 = polygone.boundingRect();
}
else
{
rec1 = rec0;
}
rec1 = rec1.united(rect.toRect());
sc->setSceneRect(rec1);
}
示例4: glDrawElements
void MGLES2Renderer::draw(const QList<QRect>& targets, const QList<QRect>& sources)
{
GLuint num = d_ptr->setupVertices(d_ptr->m_boundTexSize, sources, targets);
QTransform transform;
GLfloat o = 1.0;
if (d_ptr->m_activePainter) {
transform = d_ptr->m_activePainter->combinedTransform();
o = d_ptr->m_activePainter->opacity();
}
d_ptr->m_matWorld[0][0] = transform.m11();
d_ptr->m_matWorld[0][1] = transform.m12();
d_ptr->m_matWorld[0][3] = transform.m13();
d_ptr->m_matWorld[1][0] = transform.m21();
d_ptr->m_matWorld[1][1] = transform.m22();
d_ptr->m_matWorld[1][3] = transform.m23();
d_ptr->m_matWorld[3][0] = transform.dx();
d_ptr->m_matWorld[3][1] = transform.dy();
d_ptr->m_matWorld[3][3] = transform.m33();
d_ptr->m_activeProgram->setUniformValue("matWorld", d_ptr->m_matWorld);
d_ptr->m_activeProgram->setUniformValue("opacity", o);
glDrawElements(GL_TRIANGLES, num, GL_UNSIGNED_SHORT, d_ptr->m_indices.data());
}
示例5: glDrawArrays
void MGLES2Renderer::draw(const QRect &rectangle)
{
GLfloat *vertices = d_ptr->m_vertices.data();
vertices[0] = rectangle.left(); vertices[1] = rectangle.top();
vertices[2] = rectangle.left(); vertices[3] = rectangle.top() + rectangle.height();
vertices[4] = rectangle.left() + rectangle.width(); vertices[5] = rectangle.top() + rectangle.height();
vertices[6] = rectangle.left() + rectangle.width(); vertices[7] = rectangle.top();
QTransform transform;
GLfloat o = 1.0;
if (d_ptr->m_activePainter) {
transform = d_ptr->m_activePainter->combinedTransform();
o = d_ptr->m_activePainter->opacity();
}
d_ptr->m_matWorld[0][0] = transform.m11();
d_ptr->m_matWorld[0][1] = transform.m12();
d_ptr->m_matWorld[0][3] = transform.m13();
d_ptr->m_matWorld[1][0] = transform.m21();
d_ptr->m_matWorld[1][1] = transform.m22();
d_ptr->m_matWorld[1][3] = transform.m23();
d_ptr->m_matWorld[3][0] = transform.dx();
d_ptr->m_matWorld[3][1] = transform.dy();
d_ptr->m_matWorld[3][3] = transform.m33();
d_ptr->m_activeProgram->setUniformValue("matWorld", d_ptr->m_matWorld);
d_ptr->m_activeProgram->setUniformValue("opacity", o);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
示例6: rotate
void ellipse::rotate(qreal angle)
{
this->transformationRotate = this->transformationRotate.rotate(angle);
QPointF translatePoint(this->transformationTranslate.dx(),this->transformationTranslate.dy());
QTransform tempRotate(1, 0, 0, 1, 0, 0);
tempRotate.rotate(angle);
QPointF rotatedPoint = tempRotate.map(translatePoint);
this->transformationTranslate = QTransform(1, 0, 0, 1, rotatedPoint.x(), rotatedPoint.y());
this->transformationMatrix = this->transformationScale* this->transformationRotate * this->transformationTranslate;
if(!this->transformationMatrix.isInvertible())
{
//qDebug() << "Notinvertible";
}
QTransform inverted = this->transformationMatrix.inverted();
data.scaleX = (cl_float) inverted.m11();
data.scaleY = (cl_float) inverted.m22();
data.angleX = (cl_float) inverted.m21();
data.angleY = (cl_float) inverted.m12();
data.dx = (cl_float) inverted.dx();
data.dy = (cl_float) inverted.dy();
}
示例7: setSceneTransform
void QgsComposerRuler::setSceneTransform( const QTransform& transform )
{
QString debug = QString::number( transform.dx() ) + "," + QString::number( transform.dy() ) + ","
+ QString::number( transform.m11() ) + "," + QString::number( transform.m22() );
mTransform = transform;
update();
}
示例8: transform
void QNanoPainter::transform(const QTransform &transform)
{
nvgTransform(nvgCtx()
, transform.m11(), transform.m12()
, transform.m21(), transform.m22()
, transform.m31(), transform.m32());
}
示例9: transform
void Selection::transform(QTransform transform, int pageNum)
{
m_selectionPolygon = transform.map(m_selectionPolygon);
qreal sx = transform.m11();
qreal sy = transform.m22();
qreal s = (sx + sy) / 2.0;
for (int i = 0; i < m_strokes.size(); ++i)
{
m_strokes[i].points = transform.map(m_strokes[i].points);
/*
'if (!transform.isRotating())' doesn't work, since rotation of 180 and 360 degrees is treated as a scaling transformation. Same goes for
'if (transform.isScaling())'
*/
if (transform.determinant() != 1)
{
m_strokes[i].penWidth = m_strokes[i].penWidth * s;
}
}
if (transform.determinant() != 1)
{
m_x_padding *= sx;
m_y_padding *= sy;
}
if (transform.isRotating())
{
m_x_padding = m_padding;
m_y_padding = m_padding;
}
m_angle = 0.0;
setPageNum(pageNum);
}
示例10:
OutputImageParams::PartialXform::PartialXform(QTransform const& xform)
: m_11(xform.m11()),
m_12(xform.m12()),
m_21(xform.m21()),
m_22(xform.m22())
{
}
示例11: draw
void RasterImage::draw(QPainter* painter) const
{
painter->save();
QSizeF s;
if (_sizeIsSpatium)
s = _size * spatium();
else
s = _size * MScore::DPMM;
if (score()->printing()) {
// use original image size for printing
painter->scale(s.width() / doc.width(), s.height() / doc.height());
painter->drawPixmap(QPointF(0, 0), QPixmap::fromImage(doc));
}
else {
QTransform t = painter->transform();
QSize ss = QSizeF(s.width() * t.m11(), s.height() * t.m22()).toSize();
t.setMatrix(1.0, t.m12(), t.m13(), t.m21(), 1.0, t.m23(), t.m31(), t.m32(), t.m33());
painter->setWorldTransform(t);
if ((buffer.size() != ss || _dirty) && !doc.isNull()) {
buffer = QPixmap::fromImage(doc.scaled(ss, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
_dirty = false;
}
Image::draw(painter, ss);
}
painter->restore();
}
示例12: init
void TransformEditDialog::init(QTransform aTransform, const PropertyAttributes *aAttributes)
{
ui->setupUi(this);
setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
ui->m11SpinBox->setValue(aTransform.m11());
ui->m12SpinBox->setValue(aTransform.m12());
ui->m13SpinBox->setValue(aTransform.m13());
ui->m21SpinBox->setValue(aTransform.m21());
ui->m22SpinBox->setValue(aTransform.m22());
ui->m23SpinBox->setValue(aTransform.m23());
ui->m31SpinBox->setValue(aTransform.m31());
ui->m32SpinBox->setValue(aTransform.m32());
ui->m33SpinBox->setValue(aTransform.m33());
if (aAttributes)
{
aAttributes->applyToDoubleSpinBox(ui->m11SpinBox);
aAttributes->applyToDoubleSpinBox(ui->m12SpinBox);
aAttributes->applyToDoubleSpinBox(ui->m13SpinBox);
aAttributes->applyToDoubleSpinBox(ui->m21SpinBox);
aAttributes->applyToDoubleSpinBox(ui->m22SpinBox);
aAttributes->applyToDoubleSpinBox(ui->m23SpinBox);
aAttributes->applyToDoubleSpinBox(ui->m31SpinBox);
aAttributes->applyToDoubleSpinBox(ui->m32SpinBox);
aAttributes->applyToDoubleSpinBox(ui->m33SpinBox);
}
}
示例13:
QT_BEGIN_NAMESPACE
static inline bool qtransform_equals_no_translate(const QTransform &a, const QTransform &b)
{
if (a.type() <= QTransform::TxTranslate && b.type() <= QTransform::TxTranslate) {
return true;
} else {
// We always use paths for perspective text anyway, so no
// point in checking the full matrix...
Q_ASSERT(a.type() < QTransform::TxProject);
Q_ASSERT(b.type() < QTransform::TxProject);
return a.m11() == b.m11()
&& a.m12() == b.m12()
&& a.m21() == b.m21()
&& a.m22() == b.m22();
}
}
示例14: toOctaveFormat
inline QString toOctaveFormat(const QTransform &t)
{
QString s("T = [%1 %2 %3; %4 %5 %6; %7 %8 %9]");
s = s
.arg(t.m11()).arg(t.m12()).arg(t.m13())
.arg(t.m21()).arg(t.m22()).arg(t.m23())
.arg(t.m31()).arg(t.m32()).arg(t.m33());
return s;
}
示例15: qTransformToTemplateTransform
void qTransformToTemplateTransform(const QTransform& in, TemplateTransform* out)
{
out->template_x = qRound(1000 * in.m31());
out->template_y = qRound(1000 * in.m32());
out->template_rotation = qAtan2(-in.m21(), in.m11());
out->template_scale_x = in.m11() / qCos(out->template_rotation);
out->template_scale_y = in.m22() / qCos(out->template_rotation);
}