本文整理汇总了C++中KisImageSP::setResolution方法的典型用法代码示例。如果您正苦于以下问题:C++ KisImageSP::setResolution方法的具体用法?C++ KisImageSP::setResolution怎么用?C++ KisImageSP::setResolution使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisImageSP
的用法示例。
在下文中一共展示了KisImageSP::setResolution方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testViewToDocument
void KisImageViewConverterTest::testViewToDocument()
{
const KoColorSpace * colorSpace = KoColorSpaceRegistry::instance()->rgb8();
KisImageSP image = new KisImage(0, 512, 512, colorSpace, "test");
KisImageViewConverter viewConverter(image);
image->setResolution(1.38888888, 1.38888888);
QVERIFY(viewConverter.viewToDocument(QPointF(0.0, 0.0))
== QPointF(0.0, 0.0));
QPointF f = viewConverter.viewToDocument(QPointF(5, 5));
QVERIFY(f.x() < 3.7 && f.x() > 3.5 && f.y() < 3.7 && f.y() > 3.5);
QRectF r = viewConverter.viewToDocument(QRectF(0.0, 0.0, 5, 5));
QVERIFY(r.width() < 3.7 && r.width() > 3.5
&& r.height() < 3.7 && r.height() > 3.5);
QSizeF s = viewConverter.viewToDocument(QSizeF(1.0, 1.0));
QVERIFY(s.width() < 0.721 && s.width() > 0.719
&& s.height() < 0.721 && s.height() > 0.719);
double x = viewConverter.viewToDocumentX(1.0);
QVERIFY(x < 0.721 && x > 0.719);
double y = viewConverter.viewToDocumentY(1.0);
QVERIFY(y < 0.721 && y > 0.719);
}
示例2: testDocumentToView
void KisImageViewConverterTest::testDocumentToView()
{
const KoColorSpace * colorSpace = KoColorSpaceRegistry::instance()->rgb8();
KisImageSP image = new KisImage(0, 512, 512, colorSpace, "test");
KisImageViewConverter viewConverter(image);
image->setResolution(1.38888888, 1.38888888);
QVERIFY(viewConverter.documentToView(QPointF(0.0, 0.0))
== QPointF(0.0, 0.0));
QPointF f = viewConverter.documentToView(QPointF(3.2, 5.2));
QVERIFY(f.x() < 4.44445 && f.x() > 4.44443 && f.y() < 7.22223 && f.y() > 7.22221);
QRectF r = viewConverter.documentToView(QRectF(0.0, 0.0, 10.0, 10.0));
QVERIFY(r.width() < 13.889 && r.width() > 13.8888
&& r.height() < 13.889 && r.height() > 13.8888);
QSizeF s = viewConverter.documentToView(QSizeF(1.0, 1.0));
QVERIFY(s.width() < 1.3888889 && s.width() > 1.388887
&& s.height() < 1.3888889 && s.height() > 1.388887);
double x = viewConverter.documentToViewX(1.0);
QVERIFY(x < 1.3888889 && x > 1.388887);
double y = viewConverter.documentToViewY(1.0);
QVERIFY(y < 1.3888889 && y > 1.388887);
}
示例3: testScalingUndeferredSmoothing
void KisPrescaledProjectionTest::testScalingUndeferredSmoothing()
{
// Set up a nice image
QImage qimage(QString(FILES_DATA_DIR) + QDir::separator() + "lena.png");
// Undo adapter not necessary
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisImageSP image = new KisImage(0, qimage.width(), qimage.height(), cs, "projection test");
// 300 dpi recalculated to pixels per point (of which there are 72
// to the inch)
image->setResolution(100, 100);
KisPaintLayerSP layer = new KisPaintLayer(image, "test", OPACITY_OPAQUE_U8, cs);
image->addNode(layer.data(), image->rootLayer(), 0);
layer->paintDevice()->convertFromQImage(qimage, 0);
KisPrescaledProjection projection;
KisCoordinatesConverter converter;
converter.setImage(image);
projection.setCoordinatesConverter(&converter);
projection.setMonitorProfile(0,
KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::internalConversionFlags());
projection.setImage(image);
testProjectionScenario(projection, &converter, "120dpi");
}
示例4: benchmarkUpdate
void KisPrescaledProjectionTest::benchmarkUpdate()
{
QImage referenceImage(QString(FILES_DATA_DIR) + QDir::separator() + "lena.png");
QRect imageRect = QRect(QPoint(0,0), referenceImage.size());
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisImageSP image = new KisImage(0, imageRect.width(), imageRect.height(), cs, "projection test");
// set up 300dpi
image->setResolution(300 / 72 , 300 / 72);
KisPaintLayerSP layer = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE_U8, cs);
layer->paintDevice()->convertFromQImage(referenceImage, 0);
image->addNode(layer, image->rootLayer(), 0);
KisPrescaledProjection projection;
KisCoordinatesConverter converter;
converter.setImage(image);
projection.setCoordinatesConverter(&converter);
projection.setMonitorProfile(0,
KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::internalConversionFlags());
projection.setImage(image);
// Emulate "Use same aspect as pixels"
converter.setResolution(image->xRes(), image->yRes());
converter.setZoom(1.0);
KisUpdateInfoSP info = projection.updateCache(image->bounds());
projection.recalculateCache(info);
QCOMPARE(imageRect, QRect(0,0,512,512));
QRect dirtyRect(0,0,20,20);
const qint32 numShifts = 25;
const QPoint offset(dirtyRect.width(),dirtyRect.height());
//CALLGRIND_START_INSTRUMENTATION;
QBENCHMARK {
for(qint32 i = 0; i < numShifts; i++) {
KisUpdateInfoSP tempInfo = projection.updateCache(dirtyRect);
projection.recalculateCache(tempInfo);
dirtyRect.translate(offset);
}
}
//CALLGRIND_STOP_INSTRUMENTATION;
}
示例5: testZoom
void KisImageViewConverterTest::testZoom()
{
const KoColorSpace * colorSpace = KoColorSpaceRegistry::instance()->rgb8();
KisImageSP image = new KisImage(0, 512, 512, colorSpace, "test");
KisImageViewConverter viewConverter(image);
image->setResolution(1.38888888, 5.38888888);
qreal zoomX, zoomY;
viewConverter.zoom(&zoomX, &zoomY);
QVERIFY(zoomX < 1.388889 && zoomX > 1.3888887);
QVERIFY(zoomY < 5.388889 && zoomY > 5.3888887);
}