本文整理汇总了C++中QTransform::setMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ QTransform::setMatrix方法的具体用法?C++ QTransform::setMatrix怎么用?C++ QTransform::setMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTransform
的用法示例。
在下文中一共展示了QTransform::setMatrix方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void Image::draw(QPainter* painter) const
{
bool emptyImage = false;
if (imageType == ImageType::SVG) {
if (!svgDoc)
emptyImage = true;
else
svgDoc->render(painter, bbox());
}
else if (imageType == ImageType::RASTER) {
if (rasterDoc == nullptr)
emptyImage = true;
else {
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() / rasterDoc->width(), s.height() / rasterDoc->height());
painter->drawPixmap(QPointF(0, 0), QPixmap::fromImage(*rasterDoc));
}
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) && rasterDoc && !rasterDoc->isNull()) {
buffer = QPixmap::fromImage(rasterDoc->scaled(ss, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
_dirty = false;
}
if (buffer.isNull())
emptyImage = true;
else
painter->drawPixmap(QPointF(0.0, 0.0), buffer);
}
painter->restore();
}
}
if (emptyImage) {
painter->setBrush(Qt::NoBrush);
painter->setPen(Qt::black);
painter->drawRect(bbox());
painter->drawLine(0.0, 0.0, bbox().width(), bbox().height());
painter->drawLine(bbox().width(), 0.0, 0.0, bbox().height());
}
if (selected() && !(score() && score()->printing())) {
painter->setBrush(Qt::NoBrush);
painter->setPen(MScore::selectColor[0]);
painter->drawRect(bbox());
}
}
示例2: UnsetScale
//-------------------------------------------------------------
void GDeviceQt::UnsetScale()
{
#if absoluteTransform1
QTransform m = mQPainter->worldTransform();
m.setMatrix (1 / mScaleX, m.m12(), m.m13(), m.m21(), 1 / mScaleY, m.m23(), m.m31(), m.m32(), m.m33()),
mQPainter->setWorldTransform (m);
#elif absoluteTransform2
float curxs = GetXScale();
float curys = GetYScale();
mQPainter->scale( mPrevScaleX / curxs, mPrevScaleY / curys);
#else
mQPainter->scale(1 / mScaleX, 1 / mScaleY);
#endif
}
示例3: SetRotation
void Cannon::SetRotation(qreal r)
{
r /= 100;
QTransform t;
QVector2D a(30,-3);
a.normalize();
//t.setMatrix(cos(r), -sin(r), 0, sin(r) , cos(r), 0, 0, 0, 1);
t.setMatrix(a.y(), a.x(), 0, -a.x() , a.y(), 0, 0, 0, 1);
this->transformation = t;
}
示例4: draw
void RasterImage::draw(Painter*) const
{
#if 0
QTransform t = p.worldTransform();
QSize s = QSizeF(sz.width() * t.m11(), sz.height() * t.m22()).toSize();
t.setMatrix(1.0, t.m12(), t.m13(), t.m21(), 1.0, t.m23(), t.m31(), t.m32(), t.m33());
p.setWorldTransform(t);
if (buffer.size() != s || _dirty) {
buffer = QPixmap::fromImage(doc.scaled(s, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
_dirty = false;
}
Image::draw(p, v);
#endif
}
示例5: SetScale
//-------------------------------------------------------------
void GDeviceQt::SetScale( float x, float y )
{
mScaleX = x;
mScaleY = y;
#if absoluteTransform1
QTransform m = mQPainter->worldTransform();
m.setMatrix (x, m.m12(), m.m13(), m.m21(), y, m.m23(), m.m31(), m.m32(), m.m33()),
mQPainter->setWorldTransform (m);
#elif absoluteTransform2
float curxs = GetXScale();
float curys = GetYScale();
mQPainter->scale( x/curxs, y/curys);
#else
mQPainter->scale(x, y);
#endif
}
示例6: getTransform
QTransform QOrientationHandler::getTransform( const ViewPortType &viewPort, const boost::shared_ptr< ImageHolder > image, PlaneOrientation orientation )
{
const util::ivector4 mappedSize = QOrientationHandler::mapCoordsToOrientation( image->getImageSize(), image, orientation );
const util::fvector4 flipVec = QOrientationHandler::mapCoordsToOrientation( util::fvector4( 1, 1, 1 ), image, orientation, false, false );
const util::ivector4 mappedVoxelCoords = QOrientationHandler::mapCoordsToOrientation( image->voxelCoords, image, orientation );
QTransform retTransform;
retTransform.setMatrix( flipVec[0], 0, 0,
0, flipVec[1], 0,
0, 0, 1 );
//calculate crosshair dependent translation
retTransform.translate( flipVec[0] * viewPort[2], flipVec[1] * viewPort[3] );
retTransform.scale( viewPort[0], viewPort[1] );
retTransform.translate( flipVec[0] < 0 ? -mappedSize[0] : 0, flipVec[1] < 0 ? -mappedSize[1] : 0 );
return retTransform;
}
示例7: loadTransform
bool GraphicsUtils::loadTransform(const QDomElement & transformElement, QTransform & transform)
{
if (transformElement.isNull()) return false;
double m11 = transform.m11();
double m12 = transform.m12();
double m13 = transform.m13();
double m21 = transform.m21();
double m22 = transform.m22();
double m23 = transform.m23();
double m31 = transform.m31();
double m32 = transform.m32();
double m33 = transform.m33();
bool ok;
double temp;
temp = transformElement.attribute("m11").toDouble(&ok);
if (ok) m11 = temp;
temp = transformElement.attribute("m12").toDouble(&ok);
if (ok) m12 = temp;
temp = transformElement.attribute("m13").toDouble(&ok);
if (ok) m13 = temp;
temp = transformElement.attribute("m21").toDouble(&ok);
if (ok) m21 = temp;
temp = transformElement.attribute("m22").toDouble(&ok);
if (ok) m22 = temp;
temp = transformElement.attribute("m23").toDouble(&ok);
if (ok) m23 = temp;
temp = transformElement.attribute("m31").toDouble(&ok);
if (ok) m31 = temp;
temp = transformElement.attribute("m32").toDouble(&ok);
if (ok) m32 = temp;
temp = transformElement.attribute("m33").toDouble(&ok);
if (ok) m33 = temp;
transform.setMatrix(m11, m12, m13, m21, m22, m23, m31, m32, m33);
return true;
}
示例8: updateSize
void CWhiteBoardView::updateSize(const QSize &size)
{
if(size.width() <= 0 && size.height() <= 0)
{
return;
}
QSize adjustSize = size;
if(m_data->m_needScale)
{
QRectF sceneRect = m_data->m_baseRect;
if(sceneRect.width() < 0.001 && sceneRect.height() < 0.001)
{
return;
}
qreal sx = size.width() / sceneRect.width();
qreal sy = size.height() / sceneRect.height();
QTransform form = this->transform();
form.setMatrix(sx,form.m12(),form.m13(),form.m21(),sy,form.m23(),form.m31(),form.m32(),form.m33());
this->setTransform(form);
adjustSize = sceneRect.size().toSize();
}
else
{
QTransform form = this->transform();
form.reset();
this->setTransform(form);
m_data->m_scene->setSceneRect(QRect(0,0,adjustSize.width(),adjustSize.height()));
}
if(m_data->m_backgroundColor.alpha() == 0)
{
m_data->m_backgroundColor.setAlpha(1);
}
QPixmap pixmap(adjustSize);
pixmap.fill(m_data->m_backgroundColor);
m_data->m_whiteBoardItem->setPixmap(pixmap);
}
示例9: setData
bool PropertyMatrixModel::setData(const QModelIndex &index, const QVariant &data, int role)
{
if (!index.isValid())
return false;
if (role != Qt::EditRole)
return false;
bool ok = false;
float floatData = data.toFloat(&ok);
if (!ok)
return false;
switch (m_matrix.type()) {
case QVariant::Vector2D: {
QVector2D value = m_matrix.value<QVector2D>();
switch (index.row()) {
case 0: value.setX(floatData); break;
case 1: value.setY(floatData); break;
}
m_matrix = value;
break;
}
case QVariant::Vector3D: {
QVector3D value = m_matrix.value<QVector3D>();
switch (index.row()) {
case 0: value.setX(floatData); break;
case 1: value.setY(floatData); break;
case 2: value.setZ(floatData); break;
}
m_matrix = value;
break;
}
case QVariant::Vector4D: {
QVector4D value = m_matrix.value<QVector4D>();
switch (index.row()) {
case 0: value.setX(floatData); break;
case 1: value.setY(floatData); break;
case 2: value.setZ(floatData); break;
case 3: value.setW(floatData); break;
}
m_matrix = value;
break;
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
case QVariant::Quaternion: {
float pitch, yaw, roll;
const QQuaternion value = m_matrix.value<QQuaternion>();
value.getEulerAngles(&pitch, &yaw, &roll);
switch (index.row()) {
case 0: pitch = floatData; break;
case 1: yaw = floatData; break;
case 2: roll = floatData; break;
}
m_matrix = QQuaternion::fromEulerAngles(pitch, yaw, roll);
break;
}
#endif
case QVariant::Matrix: {
QMatrix value = m_matrix.value<QMatrix>();
switch (index.row() << 4 | index.column()) {
case 0x00: value.setMatrix(floatData, value.m12(), value.m21(), value.m22(), value.dx(), value.dy()); break;
case 0x01: value.setMatrix(value.m11(), floatData, value.m21(), value.m22(), value.dx(), value.dy()); break;
case 0x10: value.setMatrix(value.m11(), value.m12(), floatData, value.m22(), value.dx(), value.dy()); break;
case 0x11: value.setMatrix(value.m11(), value.m12(), value.m21(), floatData, value.dx(), value.dy()); break;
case 0x20: value.setMatrix(value.m11(), value.m12(), value.m21(), value.m22(), floatData, value.dy()); break;
case 0x21: value.setMatrix(value.m11(), value.m12(), value.m21(), value.m22(), value.dx(), floatData); break;
}
m_matrix = value;
break;
}
case QVariant::Transform: {
QTransform value = m_matrix.value<QTransform>();
switch (index.row() << 4 | index.column()) {
case 0x00: value.setMatrix(floatData, value.m12(), value.m13(), value.m21(), value.m22(), value.m23(), value.m31(), value.m32(), value.m33()); break;
case 0x01: value.setMatrix(value.m11(), floatData, value.m13(), value.m21(), value.m22(), value.m23(), value.m31(), value.m32(), value.m33()); break;
case 0x02: value.setMatrix(value.m11(), value.m12(), floatData, value.m21(), value.m22(), value.m23(), value.m31(), value.m32(), value.m33()); break;
case 0x10: value.setMatrix(value.m11(), value.m12(), value.m13(), floatData, value.m22(), value.m23(), value.m31(), value.m32(), value.m33()); break;
case 0x11: value.setMatrix(value.m11(), value.m12(), value.m13(), value.m21(), floatData, value.m23(), value.m31(), value.m32(), value.m33()); break;
case 0x12: value.setMatrix(value.m11(), value.m12(), value.m13(), value.m21(), value.m22(), floatData, value.m31(), value.m32(), value.m33()); break;
case 0x20: value.setMatrix(value.m11(), value.m12(), value.m13(), value.m21(), value.m22(), value.m23(), floatData, value.m32(), value.m33()); break;
case 0x21: value.setMatrix(value.m11(), value.m12(), value.m13(), value.m21(), value.m22(), value.m23(), value.m31(), floatData, value.m33()); break;
case 0x22: value.setMatrix(value.m11(), value.m12(), value.m13(), value.m21(), value.m22(), value.m23(), value.m31(), value.m32(), floatData); break;
}
m_matrix = value;
//.........这里部分代码省略.........
示例10: updateScene
void FieldPanel::updateScene() {
if (refresh) {
dash->ui->gView_field->hide();
dash->ui->gView_field->show();
refresh = false;
}
// Grid
if (dash->ui->check_fieldGrid->isChecked()) {
field->grid = true;
}else{ field->grid = false; };
if (dash->ui->combo_gridScale->currentText() == "200²") {
field->gridScale = 100;
} else if (dash->ui->combo_gridScale->currentText() == "500²") {
field->gridScale = 250;
} else if (dash->ui->combo_gridScale->currentText() == "1000²") {
field->gridScale = 500; // 1000x1000 unit sectors
}
// Colored Goals
if (dash->ui->check_coloredGoals->isChecked()) {
field->coloredGoals = true;
}else{ field->coloredGoals = false;};
// Updating field/sideline colors
sidelines->colorScheme = dash->ui->combo_fieldColor->currentText();
field->colorScheme = dash->ui->combo_fieldColor->currentText();
// updating the ball
ball->setX(dash->objectPos->getBallCoordX());
ball->setY(dash->objectPos->getBallCoordY());
ball->setZValue(2);
// Ball Scale
if (dash->ui->combo_ballScale->currentText() == "100%"){
ball->setScale(.3);
} else if (dash->ui->combo_ballScale->currentText() == "120%"){
ball->setScale(.5);
} else if (dash->ui->combo_ballScale->currentText() == "150%"){
ball->setScale(.8);
}
ball->color = dash->ui->combo_ballColor->currentText();
// Tranformation matrix for robot ID labels
QTransform flipLabel;
flipLabel.setMatrix(1,0,0,0,-1,0,0,200,1);
// Updating objects in scene
for (int i=0; i<dash->teamSize; i++) {
// Blue Team
if (dash->gamemodel->find(i, dash->gamemodel->getMyTeam()) != NULL) {
guiTeam[i]->setX(dash->objectPos->getBotCoordX(true, i));
guiTeam[i]->setY(dash->objectPos->getBotCoordY(true, i));
guiTeam[i]->setZValue(3);
double angle = dash->objectPos->getBotOrientDouble(true, i) ;
guiTeam[i]->setRotation(angle);
// Action colors (may be better in the button slots)
if (i != selectedBot) {
if (dash->gamemodel->find(i, dash->gamemodel->getMyTeam())->getDrible() ) {
guiTeam[i]->dribling = true;
} else { guiTeam[i]->dribling = false; }
if (dash->gamemodel->find(i, dash->gamemodel->getMyTeam())->getKick() == 1) {
guiTeam[i]->kicking = true;
} else { guiTeam[i]->kicking = false; }
}
// Robot Scale
if (dash->ui->combo_botScale->currentText() == "100%") {
guiTeam[i]->setScale(1);
} else if (dash->ui->combo_botScale->currentText() == "120%") {
guiTeam[i]->setScale(1.2);
} else if (dash->ui->combo_botScale->currentText() == "150%") {
guiTeam[i]->setScale(1.5);
}
// labels
guiLabels[i]->setTransform(flipLabel, false);
guiLabels[i]->setRotation(currentFieldAngle);
guiLabels[i]->setZValue(4);
guiLabels[i]->setX(dash->objectPos->getBotCoordX(true,i));
guiLabels[i]->setY(dash->objectPos->getBotCoordY(true,i));
if (dash->ui->check_showIDs->isChecked()) {
guiLabels[i]->hidden = false;
}else{
guiLabels[i]->hidden = true;
}
// drawLine TEST
// drawLine(dash->getBotCoordX(true, 0),dash->getBotCoordY(true, 0), Movement::Move.pathQueue[i].x, Movement::Move.pathQueue[i].y );
// dash->ui->gView_field->update();
}
// Yellow Team
if (dash->gamemodel->find(i, dash->gamemodel->getOponentTeam()) != NULL) {
guiTeamY[i]->setX(dash->objectPos->getBotCoordX(false, i));
guiTeamY[i]->setY(dash->objectPos->getBotCoordY(false, i));
guiTeamY[i]->setZValue(3);
double angleY = dash->objectPos->getBotOrientDouble(false, i) ;
guiTeamY[i]->setRotation(angleY);
// Robot Scale
if (dash->ui->combo_botScale->currentText() == "100%") {
guiTeamY[i]->setScale(1);
} else if (dash->ui->combo_botScale->currentText() == "120%") {
guiTeamY[i]->setScale(1.2);
} else if (dash->ui->combo_botScale->currentText() == "150%") {
//.........这里部分代码省略.........
示例11: position
void File_v2::loadCell(CrochetTab *tab, QXmlStreamReader *stream)
{
Cell *c = new Cell();
Stitch *s = 0;
int row = -1, column = -1;
int group = -1;
QString bgColor, color;
QPointF position(0.0,0.0);
QPointF pivotPoint;
unsigned int layer = 0;
QPointF pivotScale, pivotRotation;
qreal rotation = 0, scaleX = 1, scaleY = 1;
qreal angle = 0.0;
QPointF scale = QPointF(1.0,1.0);
QTransform transform;
qreal m11 = 1, m12 = 0, m13 = 0,
m21 = 0, m22 = 1, m23 = 0,
m31 = 0, m32 = 0, m33 = 1;
while(!(stream->isEndElement() && stream->name() == "cell")) {
stream->readNext();
QString tag = stream->name().toString();
if(tag == "stitch") {
QString st = stream->readElementText();
s = StitchLibrary::inst()->findStitch(st, true);
} else if(tag == "grid") {
row = stream->attributes().value("row").toString().toDouble();
column = stream->attributes().value("column").toString().toDouble();
stream->readElementText();
} else if(tag == "color") {
color = stream->readElementText();
} else if(tag == "bgColor") {
bgColor = stream->readElementText();
} else if(tag == "position") {
position.rx() = stream->attributes().value("x").toString().toDouble();
position.ry() = stream->attributes().value("y").toString().toDouble();
stream->readElementText();
} else if(tag == "angle") {
angle = stream->readElementText().toDouble();
} else if(tag == "scale") {
scale.rx() = stream->attributes().value("x").toString().toDouble();
scale.ry() = stream->attributes().value("y").toString().toDouble();
stream->readElementText();
} else if(tag == "pivotPoint") {
pivotPoint.rx() = stream->attributes().value("x").toString().toDouble();
pivotPoint.ry() = stream->attributes().value("y").toString().toDouble();
stream->readElementText();
} else if(tag == "group") {
group = stream->readElementText().toInt();
} else if (tag == "layer") {
layer = stream->readElementText().toUInt();
} else if(tag == "group") {
group = stream->readElementText().toInt();
} else if (tag == "newscale") {
scaleX = stream->attributes().value("scaleX").toString().toDouble();
scaleY = stream->attributes().value("scaleY").toString().toDouble();
pivotScale.rx() = stream->attributes().value("pivotX").toString().toDouble();
pivotScale.ry() = stream->attributes().value("pivotY").toString().toDouble();
stream->readElementText();
} else if (tag == "rotation") {
rotation = stream->attributes().value("rotation").toString().toDouble();
pivotRotation.rx() = stream->attributes().value("pivotX").toString().toDouble();
pivotRotation.ry() = stream->attributes().value("pivotY").toString().toDouble();
stream->readElementText();
} else if(tag == "transformation") {
m11 = stream->attributes().value("m11").toString().toDouble();
m12 = stream->attributes().value("m12").toString().toDouble();
m13 = stream->attributes().value("m13").toString().toDouble();
m21 = stream->attributes().value("m21").toString().toDouble();
m22 = stream->attributes().value("m22").toString().toDouble();
m23 = stream->attributes().value("m23").toString().toDouble();
m31 = stream->attributes().value("m31").toString().toDouble();
m32 = stream->attributes().value("m32").toString().toDouble();
m33 = stream->attributes().value("m33").toString().toDouble();
stream->readElementText();
}
}
transform.setMatrix(m11, m12, m13, m21, m22, m23, m31, m32, m33);
c->setLayer(layer);
tab->scene()->addItem(c);
if(row > -1 && column > -1) {
c->setStitch(s);
//.........这里部分代码省略.........
示例12: Indicator
void File_v2::loadIndicator(CrochetTab *tab, QXmlStreamReader *stream)
{
Indicator *i = new Indicator();
qreal x = 0, y = 0;
bool fontused = false;
int fontsize;
QString textColor, bgColor, fontname;
QString text, style;
QPointF pivotScale, pivotRotation;
QTransform transform;
qreal m11 = 1, m12 = 0, m13 = 0,
m21 = 0, m22 = 1, m23 = 0,
m31 = 0, m32 = 0, m33 = 1;
qreal rotation = 0, scaleX = 1, scaleY = 1;
int group = -1;
unsigned int layer = 0;
while(!(stream->isEndElement() && stream->name() == "indicator")) {
stream->readNext();
QString tag = stream->name().toString();
if(tag == "x") {
x = stream->readElementText().toDouble();
} else if(tag == "y") {
y = stream->readElementText().toDouble();
} else if(tag == "text") {
text = stream->readElementText();
//the text might be html formatted in old saves, so we need to strip it. A regex could work,
//but is hard to make performant with inline css, and wouldn't work well with text that has
//brackets in it.
QTextDocument doc;
doc.setHtml( text );
text = doc.toPlainText();
} else if(tag == "textColor") {
textColor = stream->readElementText();
} else if(tag == "bgColor") {
bgColor = stream->readElementText();
} else if(tag == "style") {
style = stream->readElementText();
} else if(tag == "group") {
group = stream->readElementText().toInt();
} else if (tag == "fontname") {
fontname = stream->readElementText();
fontused = true;
} else if (tag == "fontsize") {
fontsize = stream->readElementText().toInt();
fontused = true;
} else if (tag == "layer") {
layer = stream->readElementText().toUInt();
} else if (tag == "newscale") {
scaleX = stream->attributes().value("scaleX").toString().toDouble();
scaleY = stream->attributes().value("scaleY").toString().toDouble();
pivotScale.rx() = stream->attributes().value("pivotX").toString().toDouble();
pivotScale.ry() = stream->attributes().value("pivotY").toString().toDouble();
stream->readElementText();
} else if (tag == "rotation") {
rotation = stream->attributes().value("rotation").toString().toDouble();
pivotRotation.rx() = stream->attributes().value("pivotX").toString().toDouble();
pivotRotation.ry() = stream->attributes().value("pivotY").toString().toDouble();
stream->readElementText();
} else if(tag == "transformation") {
m11 = stream->attributes().value("m11").toString().toDouble();
m12 = stream->attributes().value("m12").toString().toDouble();
m13 = stream->attributes().value("m13").toString().toDouble();
m21 = stream->attributes().value("m21").toString().toDouble();
m22 = stream->attributes().value("m22").toString().toDouble();
m23 = stream->attributes().value("m23").toString().toDouble();
m31 = stream->attributes().value("m31").toString().toDouble();
m32 = stream->attributes().value("m32").toString().toDouble();
m33 = stream->attributes().value("m33").toString().toDouble();
stream->readElementText();
}
}
DEBUG("Style is: ");
DEBUG(style);
transform.setMatrix(m11, m12, m13, m21, m22, m23, m31, m32, m33);
tab->scene()->addItem(i);
i->setTransform(transform);
ChartItemTools::setRotation(i, rotation);
ChartItemTools::setScaleX(i, scaleX);
ChartItemTools::setScaleY(i, scaleY);
ChartItemTools::setRotationPivot(i, pivotRotation, false);
ChartItemTools::setScalePivot(i, pivotScale, false);
i->setPos(x,y);
i->setText(text);
qDebug() << "loading text " << text;
i->setTextColor(textColor);
i->setBgColor(bgColor);
i->setLayer(layer);
if (fontused)
i->setFont(QFont(fontname, fontsize));
ChartItemTools::recalculateTransformations(i);
//i->setTextInteractionFlags(Qt::TextEditorInteraction);
//.........这里部分代码省略.........
示例13: painter
void
ImageViewController::imageAndGridDoneSlot(
QImage image,
Carta::Lib::VectorGraphics::VGList gridVG,
Carta::Lib::VectorGraphics::VGList contourVG,
ServiceSync::JobId /*jobId*/ )
{
/// \todo we should make sure the jobId matches the last submitted job, otherwise
/// we are wasting CPU rendering old job...
// qDebug() << "imageAndGridDoneSlot" << jobId << "xyz";
m_renderBuffer = image;
// draw the grid over top
QTime t;
t.restart();
QPainter painter( & m_renderBuffer );
painter.setRenderHint( QPainter::Antialiasing, true );
Carta::Lib::VectorGraphics::VGListQPainterRenderer vgRenderer;
if ( ! vgRenderer.render( gridVG, painter ) ) {
qWarning() << "could not render grid vector graphics";
}
qDebug() << "Grid VG rendered in" << t.elapsed() / 1000.0 << "sec" << "xyz";
t.restart();
{
QPen lineColor( QColor( "red" ), 1 );
lineColor.setCosmetic( true );
painter.setPen( lineColor );
// where does 0.5, 0.5 map to?
QPointF p1 = m_renderService-> img2screen( { 0.5, 0.5 }
);
// where does 1.5, 1.5 map to?
QPointF p2 = m_renderService-> img2screen( { 1.5, 1.5 }
);
QTransform tf;
double m11 = p2.x() - p1.x();
double m22 = p2.y() - p1.y();
double m33 = 1; // no projection
double m13 = 0; // no projection
double m23 = 0; // no projection
double m12 = 0; // no shearing
double m21 = 0; // no shearing
double m31 = p1.x() - m11 * 0.5;
double m32 = p1.y() - m22 * 0.5;
tf.setMatrix( m11, m12, m13, m21, m22, m23, m31, m32, m33 );
painter.setTransform( tf );
}
if ( ! vgRenderer.render( contourVG, painter ) ) {
qWarning() << "could not render contour vector graphics";
}
qDebug() << "Contour VG rendered in" << t.elapsed() / 1000.0 << "sec" << "xyz";
// // paint contours
// QPen lineColor( QColor( "red" ), 1 );
// lineColor.setCosmetic( true );
// painter.setPen( lineColor );
// // where does 0.5, 0.5 map to?
// QPointF p1 = m_renderService-> img2screen( { 0.5, 0.5 }
// );
// // where does 1.5, 1.5 map to?
// QPointF p2 = m_renderService-> img2screen( { 1.5, 1.5 }
// );
// QTransform tf;
// double m11 = p2.x() - p1.x();
// double m22 = p2.y() - p1.y();
// double m33 = 1; // no projection
// double m13 = 0; // no projection
// double m23 = 0; // no projection
// double m12 = 0; // no shearing
// double m21 = 0; // no shearing
// double m31 = p1.x() - m11 * 0.5;
// double m32 = p1.y() - m22 * 0.5;
// tf.setMatrix( m11, m12, m13, m21, m22, m23, m31, m32, m33 );
// painter.setTransform( tf );
// for ( size_t k = 0 ; k < m_contours.size() ; ++k ) {
// std::vector < QPolygonF > con = m_contours[k];
// for ( size_t i = 0 ; i < con.size() ; ++i ) {
// QPolygonF & poly = con[i];
// painter.drawPolyline( poly );
// }
// }
// schedule a repaint with the connector
m_connector-> refreshView( this );
} // imageAndGridDoneSlot