本文整理汇总了C++中KisPaintDeviceSP::createHLineIterator方法的典型用法代码示例。如果您正苦于以下问题:C++ KisPaintDeviceSP::createHLineIterator方法的具体用法?C++ KisPaintDeviceSP::createHLineIterator怎么用?C++ KisPaintDeviceSP::createHLineIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisPaintDeviceSP
的用法示例。
在下文中一共展示了KisPaintDeviceSP::createHLineIterator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xShear
KisPaintDeviceSP KisShearVisitor::xShear(KisPaintDeviceSP src, qreal shearX, KoUpdater *progress)
{
KisPaintDeviceSP dst = KisPaintDeviceSP(new KisPaintDevice(src->colorSpace()));
dst->setX(src->x());
dst->setY(src->y());
QRect r = src->exactBounds();
qreal displacement;
qint32 displacementInt;
qreal weight;
KoMixColorsOp * mixOp = src->colorSpace()->mixColorsOp();
for (qint32 y = r.top(); y <= r.bottom(); y++) {
//calculate displacement
displacement = -y * shearX;
displacementInt = (qint32)(floor(displacement));
weight = displacement - displacementInt;
qint16 pixelWeights[2];
pixelWeights[0] = static_cast<quint8>(weight * 255 + 0.5);
pixelWeights[1] = 255 - pixelWeights[0];
KisHLineConstIteratorPixel srcIt = src->createHLineIterator(r.x(), y, r.width() + 1);
KisHLineConstIteratorPixel leftSrcIt = src->createHLineIterator(r.x() - 1, y, r.width() + 1);
KisHLineIteratorPixel dstIt = dst->createHLineIterator(r.x() + displacementInt, y, r.width() + 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(y);
}
return dst;
}
示例2: colorize
void KisTotalRandomColorSource::colorize(KisPaintDeviceSP dev, const QRect& rect)
{
KoColor kc(dev->colorSpace());
QColor qc;
int pixelSize = dev->colorSpace()->pixelSize();
KisHLineIteratorPixel it = dev->createHLineIterator(rect.x(), rect.y(), rect.width(), 0);
for (int y = 0; y < rect.height(); y++) {
while (!it.isDone()) {
qc.setRgb((int)((255.0*rand()) / RAND_MAX), (int)((255.0*rand()) / RAND_MAX), (int)((255.0*rand()) / RAND_MAX));
kc.fromQColor(qc);
memcpy(it.rawData(), kc.data(), pixelSize);
++it;
}
it.nextRow();
}
}
示例3: toGrayScale
void KisCurveMagnetic::toGrayScale(const QRect& rect, KisPaintDeviceSP src, GrayMatrix& dst)
{
int grectx = rect.x();
int grecty = rect.y();
int grectw = rect.width();
int grecth = rect.height();
QColor c;
KoColorSpace *cs = src->colorSpace();
KisHLineIteratorPixel srcIt = src->createHLineIterator(grectx, grecty, grectw);
for (int row = 0; row < grecth; row++) {
for (int col = 0; col < grectw; col++) {
cs->toQColor(srcIt.rawData(), &c);
dst[col][row] = qGray(c.rgb());
++srcIt;
}
srcIt.nextRow();
}
}