| 3 | #include "lancir.h" |
| 4 | |
| 5 | static QImage scaleImageLancir(const QImage &image, int width, int height) |
| 6 | { |
| 7 | QImage src = (image.format() == QImage::Format_ARGB32) |
| 8 | ? image |
| 9 | : image.convertToFormat(QImage::Format_ARGB32); |
| 10 | |
| 11 | QImage dst(width, height, QImage::Format_ARGB32); |
| 12 | |
| 13 | // SrcSSize / NewSSize are in elements; for uint8_t that equals bytes, |
| 14 | // so bytesPerLine() covers any Qt row-alignment padding correctly. |
| 15 | avir::CLancIRParams params(src.bytesPerLine(), dst.bytesPerLine()); |
| 16 | params.la = 4.0; // Lanczos4 |
| 17 | |
| 18 | avir::CLancIR lancir; |
| 19 | lancir.resizeImage<uint8_t, uint8_t>( |
| 20 | src.constBits(), src.width(), src.height(), |
| 21 | dst.bits(), width, height, 4, ¶ms); |
| 22 | |
| 23 | return dst; |
| 24 | } |
| 25 | |
| 26 | // ---- QPixmap API ------------------------------------------------------------ |
| 27 |
no outgoing calls
no test coverage detected