本文整理汇总了C++中KisPaintDeviceSP::createVLineIterator方法的典型用法代码示例。如果您正苦于以下问题:C++ KisPaintDeviceSP::createVLineIterator方法的具体用法?C++ KisPaintDeviceSP::createVLineIterator怎么用?C++ KisPaintDeviceSP::createVLineIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisPaintDeviceSP
的用法示例。
在下文中一共展示了KisPaintDeviceSP::createVLineIterator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: yShear
KisPaintDeviceSP KisShearVisitor::yShear(KisPaintDeviceSP src, qreal shearY, KoUpdater *progress)
{
int start = progress->progress();
KisPaintDeviceSP dst = KisPaintDeviceSP(new KisPaintDevice(src->colorSpace()));
KoMixColorsOp * mixOp = src->colorSpace()->mixColorsOp();
dst->setX(src->x());
dst->setY(src->y());
QRect r = src->exactBounds();
qreal displacement;
qint32 displacementInt;
qreal weight;
for (qint32 x = r.left(); x <= r.right(); x++) {
//calculate displacement
displacement = x * shearY;
displacementInt = (qint32)(floor(displacement));
weight = displacement - displacementInt;
qint16 pixelWeights[2];
pixelWeights[0] = static_cast<quint8>(weight * 255 + 0.5);
pixelWeights[1] = 255 - pixelWeights[0];
KisVLineConstIteratorPixel srcIt = src->createVLineIterator(x, r.y(), r.height() + 1);
KisVLineIteratorPixel leftSrcIt = src->createVLineIterator(x, r.y() - 1, r.height() + 1);
KisVLineIteratorPixel dstIt = dst->createVLineIterator(x, r.y() + displacementInt, r.height() + 1);
while (!srcIt.isDone()) {
const quint8 *pixelPtrs[2];
pixelPtrs[0] = leftSrcIt.rawData();
pixelPtrs[1] = srcIt.rawData();
mixOp->mixColors(pixelPtrs, pixelWeights, 2, dstIt.rawData());
++srcIt;
++leftSrcIt;
++dstIt;
}
progress->setProgress(start + x);
}
return dst;
}