MCPcopy Create free account
hub / github.com/YACReader/yacreader / scalePixmap

Function scalePixmap

image_processing/resize_image.cpp:28–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26// ---- QPixmap API ------------------------------------------------------------
27
28QPixmap scalePixmap(const QPixmap &pixmap, int width, int height, ScaleMethod method)
29{
30 if ((pixmap.width() == width && pixmap.height() == height) || pixmap.isNull())
31 return pixmap;
32
33 switch (method) {
34 case ScaleMethod::Nearest:
35 return pixmap.scaled(width, height, Qt::IgnoreAspectRatio, Qt::FastTransformation);
36 case ScaleMethod::Bilinear:
37 return pixmap.scaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
38 case ScaleMethod::Lanczos:
39 return QPixmap::fromImage(scaleImageLancir(pixmap.toImage(), width, height));
40 }
41 return pixmap;
42}
43
44// ---- QImage API (avoids QPixmap round-trip in ContinuousPageWidget) ---------
45

Callers 1

updateContentSizeMethod · 0.85

Calls 1

scaleImageLancirFunction · 0.85

Tested by

no test coverage detected