本文整理汇总了C++中QTransform::m31方法的典型用法代码示例。如果您正苦于以下问题:C++ QTransform::m31方法的具体用法?C++ QTransform::m31怎么用?C++ QTransform::m31使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTransform
的用法示例。
在下文中一共展示了QTransform::m31方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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
}
示例2: enu
QVector3D Conversions::xyz2enu(const QVector3D &xyz, qreal reflat, qreal reflon, qreal refalt)
{
QVector3D refxyz = Conversions::lla2xyz(reflat,reflon,refalt);
QVector3D diffxyz = xyz - refxyz;
QTransform R1 = Conversions::rot(90.0 + reflon,3);
QTransform R2 = Conversions::rot(90.0-reflat,1);
QTransform R = R2*R1;
//MAKE THIS MATRIX MULTIPLY
qreal x = R.m11()*diffxyz.x() + R.m12()*diffxyz.y() + R.m13()*diffxyz.z();
qreal y = R.m21()*diffxyz.x() + R.m22()*diffxyz.y() + R.m23()*diffxyz.z();
qreal z = R.m31()*diffxyz.x() + R.m32()*diffxyz.y() + R.m33()*diffxyz.z();
QVector3D enu(x,y,z);
return enu;
}
示例3: renderCompositedLayers
void TextureMapperLayerClientQt::renderCompositedLayers(GraphicsContext* context, const IntRect& clip)
{
if (!m_rootTextureMapperLayer || !m_textureMapper)
return;
m_textureMapper->setGraphicsContext(context);
// GraphicsContext::imageInterpolationQuality is always InterpolationDefault here,
// but 'default' may be interpreted differently due to a different backend QPainter,
// so we need to set an explicit imageInterpolationQuality.
if (context->platformContext()->renderHints() & QPainter::SmoothPixmapTransform)
m_textureMapper->setImageInterpolationQuality(WebCore::InterpolationMedium);
else
m_textureMapper->setImageInterpolationQuality(WebCore::InterpolationNone);
m_textureMapper->setTextDrawingMode(context->textDrawingMode());
QPainter* painter = context->platformContext();
QTransform transform;
if (m_textureMapper->accelerationMode() == TextureMapper::OpenGLMode) {
// TextureMapperGL needs to duplicate the entire transform QPainter would do,
// including the transforms QPainter would normally do behind the scenes.
transform = painter->deviceTransform();
} else {
// TextureMapperImageBuffer needs a transform that can be used
// with QPainter::setWorldTransform.
transform = painter->worldTransform();
}
const TransformationMatrix matrix(
transform.m11(), transform.m12(), 0, transform.m13(),
transform.m21(), transform.m22(), 0, transform.m23(),
0, 0, 1, 0,
transform.m31(), transform.m32(), 0, transform.m33()
);
if (m_rootGraphicsLayer->opacity() != painter->opacity() || m_rootGraphicsLayer->transform() != matrix) {
m_rootGraphicsLayer->setOpacity(painter->opacity());
m_rootGraphicsLayer->setTransform(matrix);
m_rootGraphicsLayer->flushCompositingStateForThisLayerOnly();
}
m_textureMapper->beginPainting();
m_textureMapper->beginClip(matrix, clip);
m_rootTextureMapperLayer->paint();
m_fpsCounter.updateFPSAndDisplay(m_textureMapper.get(), IntPoint::zero(), matrix);
m_textureMapper->endClip();
m_textureMapper->endPainting();
}
示例4: inverted
/*!
Returns an inverted copy of this matrix.
If the matrix is singular (not invertible), the returned matrix is
the identity matrix. If \a invertible is valid (i.e. not 0), its
value is set to true if the matrix is invertible, otherwise it is
set to false.
\sa isInvertible()
*/
QTransform QTransform::inverted(bool *invertible) const
{
qreal det = determinant();
if (qFuzzyCompare(det, qreal(0.0))) {
if (invertible)
*invertible = false;
return QTransform();
}
if (invertible)
*invertible = true;
QTransform adjA = adjoint();
QTransform invert = adjA / det;
invert = QTransform(invert.m11()/invert.m33(), invert.m12()/invert.m33(), invert.m13()/invert.m33(),
invert.m21()/invert.m33(), invert.m22()/invert.m33(), invert.m23()/invert.m33(),
invert.m31()/invert.m33(), invert.m32()/invert.m33(), 1);
// inverting doesn't change the type
invert.m_type = m_type;
invert.m_dirty = m_dirty;
return invert;
}
示例5: saveValue
void saveValue(QDomElement *parent, const QString &tag, const QTransform &t)
{
QDomDocument doc = parent->ownerDocument();
QDomElement e = doc.createElement(tag);
parent->appendChild(e);
e.setAttribute("type", "transform");
e.setAttribute("m11", toString(t.m11()));
e.setAttribute("m12", toString(t.m12()));
e.setAttribute("m13", toString(t.m13()));
e.setAttribute("m21", toString(t.m21()));
e.setAttribute("m22", toString(t.m22()));
e.setAttribute("m23", toString(t.m23()));
e.setAttribute("m31", toString(t.m31()));
e.setAttribute("m32", toString(t.m32()));
e.setAttribute("m33", toString(t.m33()));
}
示例6: QTransformToString
QString QTransformToString (const QTransform &transform)
{
const int FIELD_WIDTH = 12;
QString str = QString ("%1 %2 %3 %4\n"
"%5 %6 %7 %8\n"
"%9 %10 %11 %12")
.arg (INDENTATION_PAST_TIMESTAMP)
.arg (transform.m11 (), FIELD_WIDTH)
.arg (transform.m12 (), FIELD_WIDTH)
.arg (transform.m13 (), FIELD_WIDTH)
.arg (INDENTATION_PAST_TIMESTAMP)
.arg (transform.m21 (), FIELD_WIDTH)
.arg (transform.m22 (), FIELD_WIDTH)
.arg (transform.m23 (), FIELD_WIDTH)
.arg (INDENTATION_PAST_TIMESTAMP)
.arg (transform.m31 (), FIELD_WIDTH)
.arg (transform.m32 (), FIELD_WIDTH)
.arg (transform.m33 (), FIELD_WIDTH);
return str;
}
示例7: 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);
}
示例8: 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;
}
示例9: diffxyz
QVector3D Conversions::enu2xyz(const QVector3D & enu, qreal reflat, qreal reflon, qreal refalt)
{
const QTransform R1 = Conversions::rot(90.0 + reflon,3);
const QTransform R2 = Conversions::rot(90.0 - reflat,1);
const QTransform R = R2*R1;
const QTransform invR = R.inverted();
if (invR.isIdentity())
{
qDebug() << "Failed to invert rotation matrix --- did you enter a bad lat,lon,or alt?";
return enu;
}
qreal x = invR.m11()*enu.x() + invR.m12()*enu.y() + invR.m13()*enu.z();
qreal y = invR.m21()*enu.x() + invR.m22()*enu.y() + invR.m23()*enu.z();
qreal z = invR.m31()*enu.x() + invR.m32()*enu.y() + invR.m33()*enu.z();
QVector3D diffxyz(x,y,z);
QVector3D refxyz = Conversions::lla2xyz(reflat,reflon,refalt);
return (diffxyz + refxyz);
}
示例10: checkEigenvalues
bool Features::checkEigenvalues(QTransform tr){
double eig1, eig2, eig3, minDist;
//qDebug() << "EIGENVALUES";
QString program = "./eig/eig.exe";
QStringList arguments;
arguments << QString::number(tr.m11());
arguments << QString::number(tr.m12());
arguments << QString::number(tr.m13());
arguments << QString::number(tr.m21());
arguments << QString::number(tr.m22());
arguments << QString::number(tr.m23());
arguments << QString::number(tr.m31());
arguments << QString::number(tr.m32());
arguments << QString::number(tr.m33());
QProcess *eig = new QProcess();
eig->start(program, arguments);
eig->waitForFinished();
QString line;
line = eig->readLine();
eig1 = line.left(line.indexOf('.') + 5).remove('\n').toDouble();
line = eig->readLine();
eig2 = line.left(line.indexOf('.') + 5).remove('\n').toDouble();
line = eig->readLine();
eig3 = line.left(line.indexOf('.') + 5).remove('\n').toDouble();
//qDebug() << "Eig1:" << eig1 << "| Eig2:" << eig2 << "| Eig3:" << eig3;
minDist = abs(eig1 - eig2);
if(abs(eig1 - eig3) < minDist) minDist = abs(eig1 - eig3);
if(abs(eig2 - eig3) < minDist) minDist = abs(eig2 - eig3);
//qDebug() << "MinDist:" << minDist;
return minDist <= 0.5;
}
示例11: paintCheckerPattern
void Tile::paintCheckerPattern(GraphicsContext* context, const FloatRect& target)
{
QPainter* painter = context->platformContext();
QTransform worldTransform = painter->worldTransform();
qreal scaleX = worldTransform.m11();
qreal scaleY = worldTransform.m22();
QRect targetViewRect = QRectF(target.x() * scaleX,
target.y() * scaleY,
target.width() * scaleX,
target.height() * scaleY).toAlignedRect();
QTransform adjustedTransform(1., worldTransform.m12(), worldTransform.m13(),
worldTransform.m21(), 1., worldTransform.m23(),
worldTransform.m31(), worldTransform.m32(), worldTransform.m33());
painter->setWorldTransform(adjustedTransform);
painter->drawTiledPixmap(targetViewRect,
checkeredPixmap(),
QPoint(targetViewRect.left() % checkerSize,
targetViewRect.top() % checkerSize));
painter->setWorldTransform(worldTransform);
}
示例12: displayString
//.........这里部分代码省略.........
}
case QVariant::Palette:
{
const QPalette pal = value.value<QPalette>();
if (pal == qApp->palette()) {
return QLatin1String("<inherited>");
}
return QLatin1String("<custom>");
}
case QVariant::Size:
return
QString::fromLatin1("%1x%2").
arg(value.toSize().width()).
arg(value.toSize().height());
case QVariant::SizeF:
return
QString::fromLatin1("%1x%2").
arg(value.toSizeF().width()).
arg(value.toSizeF().height());
case QVariant::StringList:
return value.toStringList().join(", ");
case QVariant::Transform:
{
const QTransform t = value.value<QTransform>();
return
QString::fromLatin1("[%1 %2 %3, %4 %5 %6, %7 %8 %9]").
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());
}
default:
break;
}
// types with dynamic type ids
if (value.type() == (QVariant::Type)qMetaTypeId<QTextLength>()) {
const QTextLength l = value.value<QTextLength>();
QString typeStr;
switch (l.type()) {
case QTextLength::VariableLength:
typeStr = QObject::tr("variable");
break;
case QTextLength::FixedLength:
typeStr = QObject::tr("fixed");
break;
case QTextLength::PercentageLength:
typeStr = QObject::tr("percentage");
break;
}
return QString::fromLatin1("%1 (%2)").arg(l.rawValue()).arg(typeStr);
}
if (value.userType() == qMetaTypeId<QPainterPath>()) {
const QPainterPath path = value.value<QPainterPath>();
if (path.isEmpty()) {
return QObject::tr("<empty>");
}
return QObject::tr("<%1 elements>").arg(path.elementCount());
}
if (value.userType() == qMetaTypeId<QMargins>()) {
示例13: 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;
//.........这里部分代码省略.........
示例14: init
bool LcmsColorProfileContainer::init()
{
if (d->profile) {
cmsCloseProfile(d->profile);
}
d->profile = cmsOpenProfileFromMem((void *)d->data->rawData().constData(), d->data->rawData().size());
#ifndef NDEBUG
if (d->data->rawData().size() == 4096) {
qWarning() << "Profile has a size of 4096, which is suspicious and indicates a possible misuse of QIODevice::read(int), check your code.";
}
#endif
if (d->profile) {
wchar_t buffer[_BUFFER_SIZE_];
d->colorSpaceSignature = cmsGetColorSpace(d->profile);
d->deviceClass = cmsGetDeviceClass(d->profile);
cmsGetProfileInfo(d->profile, cmsInfoDescription, cmsNoLanguage, cmsNoCountry, buffer, _BUFFER_SIZE_);
d->name = QString::fromWCharArray(buffer);
//apparantly this should give us a localised string??? Not sure about this.
cmsGetProfileInfo(d->profile, cmsInfoModel, cmsNoLanguage, cmsNoCountry, buffer, _BUFFER_SIZE_);
d->productDescription = QString::fromWCharArray(buffer);
cmsGetProfileInfo(d->profile, cmsInfoManufacturer, cmsNoLanguage, cmsNoCountry, buffer, _BUFFER_SIZE_);
d->manufacturer = QString::fromWCharArray(buffer);
cmsGetProfileInfo(d->profile, cmsInfoCopyright, cmsNoLanguage, cmsNoCountry, buffer, _BUFFER_SIZE_);
d->copyright = QString::fromWCharArray(buffer);
cmsProfileClassSignature profile_class;
profile_class = cmsGetDeviceClass(d->profile);
d->valid = (profile_class != cmsSigNamedColorClass);
//This is where obtain the whitepoint, and convert it to the actual white point of the profile in the case a Chromatic adaption tag is
//present. This is necessary for profiles following the v4 spec.
cmsCIEXYZ baseMediaWhitePoint;//dummy to hold copy of mediawhitepoint if this is modified by chromatic adaption.
if (cmsIsTag(d->profile, cmsSigMediaWhitePointTag)) {
d->mediaWhitePoint = *((cmsCIEXYZ *)cmsReadTag(d->profile, cmsSigMediaWhitePointTag));
baseMediaWhitePoint = d->mediaWhitePoint;
cmsXYZ2xyY(&d->whitePoint, &d->mediaWhitePoint);
if (cmsIsTag(d->profile, cmsSigChromaticAdaptationTag)) {
//the chromatic adaption tag represent a matrix from the actual white point of the profile to D50.
cmsCIEXYZ *CAM1 = (cmsCIEXYZ *)cmsReadTag(d->profile, cmsSigChromaticAdaptationTag);
//We first put all our data into structures we can manipulate.
double d3dummy [3] = {d->mediaWhitePoint.X, d->mediaWhitePoint.Y, d->mediaWhitePoint.Z};
QGenericMatrix<1, 3, double> whitePointMatrix(d3dummy);
QTransform invertDummy(CAM1[0].X, CAM1[0].Y, CAM1[0].Z, CAM1[1].X, CAM1[1].Y, CAM1[1].Z, CAM1[2].X, CAM1[2].Y, CAM1[2].Z);
//we then abuse QTransform's invert function because it probably does matrix invertion 20 times better than I can program.
//if the matrix is uninvertable, invertedDummy will be an identity matrix, which for us means that it won't give any noticeble
//effect when we start multiplying.
QTransform invertedDummy = invertDummy.inverted();
//we then put the QTransform into a generic 3x3 matrix.
double d9dummy [9] = {invertedDummy.m11(), invertedDummy.m12(), invertedDummy.m13(),
invertedDummy.m21(), invertedDummy.m22(), invertedDummy.m23(),
invertedDummy.m31(), invertedDummy.m32(), invertedDummy.m33()
};
QGenericMatrix<3, 3, double> chromaticAdaptionMatrix(d9dummy);
//multiplying our inverted adaption matrix with the whitepoint gives us the right whitepoint.
QGenericMatrix<1, 3, double> result = chromaticAdaptionMatrix * whitePointMatrix;
//and then we pour the matrix into the whitepoint variable. Generic matrix does row/column for indices even though it
//uses column/row for initialising.
d->mediaWhitePoint.X = result(0, 0);
d->mediaWhitePoint.Y = result(1, 0);
d->mediaWhitePoint.Z = result(2, 0);
cmsXYZ2xyY(&d->whitePoint, &d->mediaWhitePoint);
}
}
//This is for RGB profiles, but it only works for matrix profiles. Need to design it to work with non-matrix profiles.
if (cmsIsTag(d->profile, cmsSigRedColorantTag)) {
cmsCIEXYZTRIPLE tempColorants;
tempColorants.Red = *((cmsCIEXYZ *)cmsReadTag(d->profile, cmsSigRedColorantTag));
tempColorants.Green = *((cmsCIEXYZ *)cmsReadTag(d->profile, cmsSigGreenColorantTag));
tempColorants.Blue = *((cmsCIEXYZ *)cmsReadTag(d->profile, cmsSigBlueColorantTag));
//convert to d65, this is useless.
cmsAdaptToIlluminant(&d->colorants.Red, &baseMediaWhitePoint, &d->mediaWhitePoint, &tempColorants.Red);
cmsAdaptToIlluminant(&d->colorants.Green, &baseMediaWhitePoint, &d->mediaWhitePoint, &tempColorants.Green);
cmsAdaptToIlluminant(&d->colorants.Blue, &baseMediaWhitePoint, &d->mediaWhitePoint, &tempColorants.Blue);
//d->colorants = tempColorants;
d->hasColorants = true;
} else {
//qDebug()<<d->name<<": has no colorants";
d->hasColorants = false;
}
//retrieve TRC.
if (cmsIsTag(d->profile, cmsSigRedTRCTag) && cmsIsTag(d->profile, cmsSigBlueTRCTag) && cmsIsTag(d->profile, cmsSigGreenTRCTag)) {
d->redTRC = ((cmsToneCurve *)cmsReadTag (d->profile, cmsSigRedTRCTag));
d->greenTRC = ((cmsToneCurve *)cmsReadTag (d->profile, cmsSigGreenTRCTag));
d->blueTRC = ((cmsToneCurve *)cmsReadTag (d->profile, cmsSigBlueTRCTag));
d->redTRCReverse = cmsReverseToneCurve(d->redTRC);
d->greenTRCReverse = cmsReverseToneCurve(d->greenTRC);
d->blueTRCReverse = cmsReverseToneCurve(d->blueTRC);
d->hasTRC = true;
} else if (cmsIsTag(d->profile, cmsSigGrayTRCTag)) {
d->grayTRC = ((cmsToneCurve *)cmsReadTag (d->profile, cmsSigGrayTRCTag));
d->grayTRCReverse = cmsReverseToneCurve(d->grayTRC);
//.........这里部分代码省略.........
示例15: tr
QString GammaRay::Util::variantToString(const QVariant &value)
{
switch (value.type()) {
case QVariant::Icon:
{
const QIcon icon = value.value<QIcon>();
if (icon.isNull())
return QObject::tr("<no icon>");
QStringList l;
foreach (const QSize &size, icon.availableSizes())
l.push_back(variantToString(size));
return l.join(QLatin1String(", "));
}
case QVariant::Line:
return QString::fromUtf8("%1 x %2 → %3 x %4")
.arg(value.toLine().x1()).arg(value.toLine().y1())
.arg(value.toLine().x2()).arg(value.toLine().y2());
case QVariant::LineF:
return QString::fromUtf8("%1 x %2 → %3 x %4")
.arg(value.toLineF().x1()).arg(value.toLineF().y1())
.arg(value.toLineF().x2()).arg(value.toLineF().y2());
case QVariant::Point:
return QString::fromLatin1("%1x%2").
arg(value.toPoint().x()).
arg(value.toPoint().y());
case QVariant::PointF:
return QString::fromLatin1("%1x%2").
arg(value.toPointF().x()).
arg(value.toPointF().y());
case QVariant::Rect:
return QString::fromLatin1("%1x%2 %3x%4").
arg(value.toRect().x()).
arg(value.toRect().y()).
arg(value.toRect().width()).
arg(value.toRect().height());
case QVariant::RectF:
return QString::fromLatin1("%1x%2 %3x%4").
arg(value.toRectF().x()).
arg(value.toRectF().y()).
arg(value.toRectF().width()).
arg(value.toRectF().height());
case QVariant::Region:
{
const QRegion region = value.value<QRegion>();
if (region.isEmpty()) {
return QLatin1String("<empty>");
}
if (region.rectCount() == 1) {
return variantToString(region.rects().first());
} else {
return QString::fromLatin1("<%1 rects>").arg(region.rectCount());
}
}
case QVariant::Palette:
{
const QPalette pal = value.value<QPalette>();
if (pal == qApp->palette())
return QLatin1String("<inherited>");
return QLatin1String("<custom>");
}
case QVariant::Size:
return QString::fromLatin1("%1x%2").
arg(value.toSize().width()).
arg(value.toSize().height());
case QVariant::SizeF:
return QString::fromLatin1("%1x%2").
arg(value.toSizeF().width()).
arg(value.toSizeF().height());
case QVariant::SizePolicy:
return QString::fromLatin1("%1 x %2").
arg(sizePolicyToString(value.value<QSizePolicy>().horizontalPolicy())).
arg(sizePolicyToString(value.value<QSizePolicy>().verticalPolicy()));
case QVariant::StringList:
return value.toStringList().join(", ");
case QVariant::Transform:
{
const QTransform t = value.value<QTransform>();
return QString::fromLatin1("[%1 %2 %3, %4 %5 %6, %7 %8 %9]").
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());
}
default:
break;
}
// types with dynamic type ids
if (value.type() == qMetaTypeId<QTextLength>()) {
//.........这里部分代码省略.........