RFC: QImage scaling

Lubos Lunak l.lunak at suse.cz
Tue Mar 27 14:40:19 BST 2007


 Hello,

 Problem description: Untar attachment, compile (g++ a.cpp asm_scale.S 
scale.cpp ...) run and compare times.

 Solution: That should be the two scale sources, but I'm not sure where to put 
and how much of it. The full sources are actually at 
http://websvn.kde.org/trunk/extragear/graphics/gwenview/imageutils/ and 
scale.cpp contains scaling code from ImageMagick (tad a bit more optimized) 
that can do rather high-quality scaling (Lanczos, Mitchell) and still be 
faster than Qt, fast sampling (i.e. no smoothing) from ImageMagick and 
scaling code from Imlib2 ported by Mosfet (I don't even remember where I got 
that) that's very fast and the quality is about the same like with Qt. The 
question, as already said, are where to put it and how much of it.

 Besides Gwenview there are currently copies of it also in Krita and KSplashX. 
KSplashX is bound to have its own copy due to its design, so it doesn't 
count, but I suppose the rest shouldn't keep its own copies. Especially given 
that additionally e.g. KDesktop^W ... Plasma could use it for wallpaper and 
there would be more cases. Gwenview uses both methods (config option to 
select the higher quality) but in general I think just Imlib2/Mosfet could in 
general do.

 I've been originally thinking about putting the Imlib2/Mosfet code to kdefx 
as some QImage scaling function, but that'd probably end up the same way like 
KPixmapIO, so I'm considering adding it as a qt-copy patch simply replacing 
QImage::scaled(). The licenses in the code look all BSD-style to me, so it 
should be ok.

 So, would that be ok with everybody or would there be apps that could use 
more than just this one scaling function, working automagically(TM)?

PS: Don't bother asking the obvious question with qt-blackhole@ ... er, 
qt-bugs@ in it. The answer is #48590.

-- 
Lubos Lunak
KDE developer
--------------------------------------------------------------
SUSE LINUX, s.r.o.   e-mail: l.lunak at suse.cz , l.lunak at kde.org
Lihovarska 1060/12   tel: +420 284 028 972
190 00 Prague 9      fax: +420 284 028 951
Czech Republic       http//www.suse.cz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scale.tar.gz
Type: application/x-tgz
Size: 9594 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070327/bb4d03ab/attachment.bin>


More information about the kde-core-devel mailing list