[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-kimageshop
Subject: bicubic scaling filter
From: Boudewijn Rempt <boud () valdyas ! org>
Date: 2006-06-21 19:32:26
Message-ID: 200606212132.29571.boud () valdyas ! org
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
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
[Attachment #5 (application/pgp-signature)]
_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic