Qt 4.8
Functions
qimagescale_p.h File Reference
#include <qimage.h>

Go to the source code of this file.

Functions

QImage qSmoothScaleImage (const QImage &img, int w, int h)
 

Function Documentation

◆ qSmoothScaleImage()

QImage qSmoothScaleImage ( const QImage img,
int  w,
int  h 
)

Definition at line 1000 of file qimagescale.cpp.

Referenced by smoothScaled().

1001 {
1002  QImage buffer;
1003  if (src.isNull() || dw <= 0 || dh <= 0)
1004  return buffer;
1005 
1006  int w = src.width();
1007  int h = src.height();
1008  QImageScaleInfo *scaleinfo =
1009  qimageCalcScaleInfo(src, w, h, dw, dh, true);
1010  if (!scaleinfo)
1011  return buffer;
1012 
1013  buffer = QImage(dw, dh, src.format());
1014  if (buffer.isNull()) {
1015  qWarning("QImage: out of memory, returning null");
1016  qimageFreeScaleInfo(scaleinfo);
1017  return QImage();
1018  }
1019 
1020  if (src.format() == QImage::Format_ARGB32_Premultiplied)
1021  qt_qimageScaleArgb(scaleinfo, (unsigned int *)buffer.scanLine(0),
1022  0, 0, 0, 0, dw, dh, dw, src.bytesPerLine() / 4);
1023  else
1024  qt_qimageScaleRgb(scaleinfo, (unsigned int *)buffer.scanLine(0),
1025  0, 0, 0, 0, dw, dh, dw, src.bytesPerLine() / 4);
1026 
1027  qimageFreeScaleInfo(scaleinfo);
1028  return buffer;
1029 }
QImageScaleInfo * qimageFreeScaleInfo(QImageScaleInfo *isi)
qt_qimageScaleFunc qt_qimageScaleArgb
Definition: qimagescale.cpp:65
bool isNull() const
Returns true if it is a null image, otherwise returns false.
Definition: qimage.cpp:1542
qt_qimageScaleFunc qt_qimageScaleRgb
Definition: qimagescale.cpp:66
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
int width() const
Returns the width of the image.
Definition: qimage.cpp:1557
QImageScaleInfo * qimageCalcScaleInfo(const QImage &img, int sw, int sh, int dw, int dh, char aa)
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
Definition: qimage.cpp:1886