本文整理汇总了C++中KisImageSP::xRes方法的典型用法代码示例。如果您正苦于以下问题:C++ KisImageSP::xRes方法的具体用法?C++ KisImageSP::xRes怎么用?C++ KisImageSP::xRes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisImageSP
的用法示例。
在下文中一共展示了KisImageSP::xRes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testScalingUndeferredSmoothingPixelForPixel
void KisPrescaledProjectionTest::testScalingUndeferredSmoothingPixelForPixel()
{
// 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 / 72 , 100 / 72);
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);
// pixel-for-pixel, at 100% zoom
converter.setResolution(image->xRes(), image->yRes());
testProjectionScenario(projection, &converter, "pixel_for_pixel");
}
示例2: 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;
}
示例3: testAddChild
void KisShapeSelectionTest::testAddChild()
{
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
KisImageSP image = new KisImage(new KisUndoAdapter(0), 300, 300, cs, "test");
KisSelectionSP selection = new KisSelection();
QVERIFY(selection->hasPixelSelection() == false);
QVERIFY(selection->hasShapeSelection() == false);
KisPixelSelectionSP pixelSelection = selection->getOrCreatePixelSelection();
pixelSelection->select(QRect(0, 0, 100, 100));
// Selection is using the pixel selection as datamanager so no projection update
// needed
QCOMPARE(pixelSelection->selected(25, 25), MAX_SELECTED);
QCOMPARE(selection->selectedExactRect(), QRect(0, 0, 100, 100));
QRect rect(50, 50, 100, 100);
QTransform matrix;
matrix.scale(1 / image->xRes(), 1 / image->yRes());
rect = matrix.mapRect(rect);
KoPathShape* shape = new KoPathShape();
shape->setShapeId(KoPathShapeId);
shape->moveTo(rect.topLeft());
shape->lineTo(rect.topLeft() + QPointF(rect.width(), 0));
shape->lineTo(rect.bottomRight());
shape->lineTo(rect.topLeft() + QPointF(0, rect.height()));
shape->close();
shape->normalize();
KisShapeSelection * shapeSelection = new KisShapeSelection(image, selection);
selection->setShapeSelection(shapeSelection);
shapeSelection->addShape(shape);
QCOMPARE(pixelSelection->selected(25, 25), MAX_SELECTED);
QCOMPARE(selection->selectedExactRect(), QRect(0, 0, 150, 150));
selection->updateProjection();
}