Qt 4.8
Classes | Functions
qimage_p.h File Reference
#include <QtCore/qglobal.h>
#include <QVector>
#include <QMap>

Go to the source code of this file.

Classes

struct  QImageData
 

Functions

Q_GUI_EXPORT void qGamma_correct_back_to_linear_cs (QImage *image)
 
void qInitImageConversions ()
 
int qt_depthForFormat (QImage::Format format)
 

Function Documentation

◆ qGamma_correct_back_to_linear_cs()

Q_GUI_EXPORT void qGamma_correct_back_to_linear_cs ( QImage image)

Definition at line 3938 of file qimage.cpp.

Referenced by QFontEngineMac::alphaRGBMapForGlyph().

3939 {
3940  extern uchar qt_pow_rgb_gamma[256];
3941 
3942  // gamma correct the pixels back to linear color space...
3943  int h = image->height();
3944  int w = image->width();
3945 
3946  for (int y=0; y<h; ++y) {
3947  uint *pixels = (uint *) image->scanLine(y);
3948  for (int x=0; x<w; ++x) {
3949  uint p = pixels[x];
3950  uint r = qt_pow_rgb_gamma[qRed(p)];
3951  uint g = qt_pow_rgb_gamma[qGreen(p)];
3952  uint b = qt_pow_rgb_gamma[qBlue(p)];
3953  pixels[x] = (r << 16) | (g << 8) | b | 0xff000000;
3954  }
3955  }
3956 }
uchar qt_pow_rgb_gamma[256]
int qRed(QRgb rgb)
Returns the red component of the ARGB quadruplet rgb.
Definition: qrgb.h:57
unsigned char uchar
Definition: qglobal.h:994
unsigned int uint
Definition: qglobal.h:996
int width() const
Returns the width of the image.
Definition: qimage.cpp:1557
int height() const
Returns the height of the image.
Definition: qimage.cpp:1572
int qGreen(QRgb rgb)
Returns the green component of the ARGB quadruplet rgb.
Definition: qrgb.h:60
int qBlue(QRgb rgb)
Returns the blue component of the ARGB quadruplet rgb.
Definition: qrgb.h:63
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
Definition: qimage.cpp:1886

◆ qInitImageConversions()

void qInitImageConversions ( )

Definition at line 3909 of file qimage.cpp.

3910 {
3911  const uint features = qDetectCPUFeatures();
3912  Q_UNUSED(features);
3913 
3914 #ifdef QT_HAVE_SSE2
3915  if (features & SSE2) {
3916  extern bool convert_ARGB_to_ARGB_PM_inplace_sse2(QImageData *data, Qt::ImageConversionFlags);
3917  inplace_converter_map[QImage::Format_ARGB32][QImage::Format_ARGB32_Premultiplied] = convert_ARGB_to_ARGB_PM_inplace_sse2;
3918  }
3919 #endif
3920 #ifdef QT_HAVE_SSSE3
3921  if (features & SSSE3) {
3922  extern void convert_RGB888_to_RGB32_ssse3(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
3923  converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_ssse3;
3924  converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_ssse3;
3926  }
3927 #endif
3928 #ifdef QT_HAVE_NEON
3929  if (features & NEON) {
3930  extern void convert_RGB888_to_RGB32_neon(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
3931  converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_neon;
3932  converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_neon;
3934  }
3935 #endif
3936 }
Definition: qsimd_p.h:217
static const char * data(const QByteArray &arr)
unsigned int uint
Definition: qglobal.h:996
uint qDetectCPUFeatures()
Definition: qsimd.cpp:382
Definition: qsimd_p.h:222
static InPlace_Image_Converter inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats]
Definition: qimage.cpp:3812
Definition: qsimd_p.h:220
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormats]
Definition: qimage.cpp:3513

◆ qt_depthForFormat()

int qt_depthForFormat ( QImage::Format  format)
inline

Definition at line 116 of file qimage_p.h.

Referenced by QImage::bitPlaneCount(), QImageData::create(), and QRasterPixmapData::fill().

117 {
118  int depth = 0;
119  switch(format) {
121  case QImage::NImageFormats:
122  Q_ASSERT(false);
123  case QImage::Format_Mono:
125  depth = 1;
126  break;
128  depth = 8;
129  break;
133  depth = 32;
134  break;
139  depth = 16;
140  break;
146  depth = 24;
147  break;
148  }
149  return depth;
150 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823