bicubic scaling filter
Boudewijn Rempt
boud at valdyas.org
Wed Jun 21 21:32:26 CEST 2006
We got a bug report recently () asking for a bicubic scaling filter. The
report pointed me to the ImageMagick source via Gwenview and on nothing the
similariteis between that code and our own filters, I thought I'd try my hand
at it. Didn't work -- my filter destroys the image, just like the lanzcos
filter. I haven't got a clue why, though. Here's my filter code:
double KisCubicFilterStrategy::valueAt(double x) const {
if (x < -2.0)
return(0.0);
if (x < -1.0)
return((2.0+x)*(2.0+x)*(2.0+x)/6.0);
if (x < 0.0)
return((4.0+x*x*(-6.0-3.0*x))/6.0);
if (x < 1.0)
return((4.0+x*x*(-6.0+3.0*x))/6.0);
if (x < 2.0)
return((2.0-x)*(2.0-x)*(2.0-x)/6.0);
return(0.0);
}
Q_UINT32 KisCubicFilterStrategy::intValueAt(Q_INT32 x) const {
if (x < 2)
return 0;
if (x < -1)
return (2 + x) * (2 + x) * ( 2 + x) / 6;
if ( x < 0)
return (4 + x * x * ( -6 - 3 * x)) / 6;
if (x < 1)
return (4 + x * x * ( -6 + 3 * x)) / 6;
if (x < 2)
return (2 - x) * ( 2 - x) * (2 - x) / 6;
return 0;
}
Anyone any ideas?
--
Boudewijn Rempt
http://www.valdyas.org/fading/index.cgi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kimageshop/attachments/20060621/a2f685c6/attachment.pgp
More information about the kimageshop
mailing list