PaintOp and accessing pixels
Cyrille Berger
cberger at cberger.net
Fri Oct 17 08:36:54 CEST 2008
Hello,
First things, you need to use oldRawData for the read accessor, and also use a
KisRectConstIterator.
KisRectConstIterator readIt = device->createConstIterator( curXi - m_radius,
curYi - m_radius, 2 * m_radius, 2 * m_radius );
while( !readIt.isDone() )
{
int x = readIt.x();
int y = readIt.y();
newX = x - centerX;
newY = y - centerY;
//t = sqrt(newX*newX + newY*newY);
//t /= norma;
//rotX = cos(-alpha * t) * newX - sin(-alpha * t) * newY;
//rotY = sin(-alpha * t) * newX + cos(-alpha * t) * newY;
rotX = cos(-alpha) * newX - sin(-alpha ) * newY;
rotY = sin(-alpha) * newX + cos(-alpha ) * newY;
// scale
rotX = newX/scale;
rotY = newY/scale;
newX = rotX + centerX;
newY = rotY + centerY;
if (point_interpolation( &newX, &newY, m_image ) )
{
// read pixelValue
m_writeAccessor->moveTo(x,y);
memcpy(m_writeAccessor->rawData() , readIt->oldRawData() ,
m_pixelSize );
}
}
The use of oldRawData should fix the issue of paint incrementaly. As for
non-incrementaly, well lets say it's not supported by your paintop now ;) I
am not sure if it is useful for deform or duplicate op.
--
Cyrille Berger
More information about the kimageshop
mailing list