本文整理汇总了C++中KisFixedPaintDeviceSP::mirror方法的典型用法代码示例。如果您正苦于以下问题:C++ KisFixedPaintDeviceSP::mirror方法的具体用法?C++ KisFixedPaintDeviceSP::mirror怎么用?C++ KisFixedPaintDeviceSP::mirror使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisFixedPaintDeviceSP
的用法示例。
在下文中一共展示了KisFixedPaintDeviceSP::mirror方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: postProcessDab
void KisDabCache::postProcessDab(KisFixedPaintDeviceSP dab,
const KisPaintInformation& info)
{
if (m_d->mirrorOption) {
MirrorProperties mirror = m_d->mirrorOption->apply(info);
dab->mirror(mirror.horizontalMirror, mirror.verticalMirror);
}
if (m_d->sharpnessOption) {
m_d->sharpnessOption->applyThreshold(dab);
}
if (m_d->textureOption) {
m_d->textureOption->apply(dab, info.pos().toPoint(), info);
}
}
示例2: testMirroring
void KisFixedPaintDeviceTest::testMirroring()
{
QFETCH(QRect, rc);
QFETCH(bool, mirrorHorizontally);
QFETCH(bool, mirrorVertically);
const KoColorSpace *cs = KoColorSpaceRegistry::instance()->rgb8();
KisFixedPaintDeviceSP dev = new KisFixedPaintDevice(cs);
dev->setRect(rc);
dev->initialize();
KoColor c(Qt::black, cs);
qsrand(1);
int value = 0;
for (int i = rc.x(); i < rc.x() + rc.width(); i++) {
for (int j = rc.y(); j < rc.y() + rc.height(); j++) {
setPixel(dev, i, j, value);
value = qrand() % 255;
}
value = qrand() % 255;
}
//dev->convertToQImage(0).save("0_a.png");
dev->mirror(mirrorHorizontally, mirrorVertically);
//dev->convertToQImage(0).save("0_b.png");
int startX;
int endX;
int incX;
int startY;
int endY;
int incY;
if (mirrorHorizontally) {
startX = rc.x() + rc.width() - 1;
endX = rc.x() - 1;
incX = -1;
} else {
startX = rc.x();
endX = rc.x() + rc.width();
incX = 1;
}
if (mirrorVertically) {
startY = rc.y() + rc.height() - 1;
endY = rc.y() - 1;
incY = -1;
} else {
startY = rc.y();
endY = rc.y() + rc.height();
incY = 1;
}
qsrand(1);
value = 0;
for (int i = startX; i != endX ; i += incX) {
for (int j = startY; j != endY; j += incY) {
QCOMPARE(pixel(dev, i, j), (quint8)value);
value = qrand() % 255;
}
value = qrand() % 255;
}
}