Qt 4.8
qimage_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QIMAGE_P_H
43 #define QIMAGE_P_H
44 
45 //
46 // W A R N I N G
47 // -------------
48 //
49 // This file is not part of the Qt API. It exists purely as an
50 // implementation detail. This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55 
56 #include <QtCore/qglobal.h>
57 
58 #include <QVector>
59 
60 #ifndef QT_NO_IMAGE_TEXT
61 #include <QMap>
62 #endif
63 
65 
66 class QImageWriter;
67 
68 struct Q_GUI_EXPORT QImageData { // internal image data
69  QImageData();
70  ~QImageData();
71  static QImageData *create(const QSize &size, QImage::Format format, int numColors = 0);
72  static QImageData *create(uchar *data, int w, int h, int bpl, QImage::Format format, bool readOnly);
73 
75 
76  int width;
77  int height;
78  int depth;
79  int nbytes; // number of bytes data
82 #ifdef QT3_SUPPORT
83  uchar **jumptable;
84 #endif
87  int ser_no; // serial number
88  int detach_no;
89 
90  qreal dpmx; // dots per meter X (or 0)
91  qreal dpmy; // dots per meter Y (or 0)
92  QPoint offset; // offset in pixels
93 
98 
99  bool checkForAlphaPixels() const;
100 
101  // Convert the image in-place, minimizing memory reallocation
102  // Return false if the conversion cannot be done in-place.
103  bool convertInPlace(QImage::Format newFormat, Qt::ImageConversionFlags);
104 
105 #ifndef QT_NO_IMAGE_TEXT
107 #endif
108  bool doImageIO(const QImage *image, QImageWriter* io, int quality) const;
109 
111 };
112 
113 void qInitImageConversions();
115 
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 }
151 
153 
154 #endif
int width
Definition: qimage_p.h:76
Format
The following image formats are available in Qt.
Definition: qimage.h:91
qreal dpmy
Definition: qimage_p.h:91
double qreal
Definition: qglobal.h:1193
Q_GUI_EXPORT void qGamma_correct_back_to_linear_cs(QImage *image)
Definition: qimage.cpp:3938
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
The QAtomicInt class provides platform-independent atomic operations on integers. ...
Definition: qatomic.h:55
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
uint has_alpha_clut
Definition: qimage_p.h:96
static Expression::Ptr create(Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QVector< QRgb > colortable
Definition: qimage_p.h:80
unsigned char uchar
Definition: qglobal.h:994
int detach_no
Definition: qimage_p.h:88
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
int height
Definition: qimage_p.h:77
qreal dpmx
Definition: qimage_p.h:90
int ser_no
Definition: qimage_p.h:87
The QImageWriter class provides a format independent interface for writing images to files or other d...
Definition: qimagewriter.h:59
QPaintEngine * paintEngine
Definition: qimage_p.h:110
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
static const char * data(const QByteArray &arr)
unsigned int uint
Definition: qglobal.h:996
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
Definition: qpaintengine.h:90
int nbytes
Definition: qimage_p.h:79
int bytes_per_line
Definition: qimage_p.h:86
uint own_data
Definition: qimage_p.h:94
QImage::Format format
Definition: qimage_p.h:85
uint ro_data
Definition: qimage_p.h:95
QPoint offset
Definition: qimage_p.h:92
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
uchar * data
Definition: qimage_p.h:81
QAtomicInt ref
Definition: qimage_p.h:74
int qt_depthForFormat(QImage::Format format)
Definition: qimage_p.h:116
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
static bool checkForAlphaPixels(const QImage &img)
int depth
Definition: qimage_p.h:78
uint is_cached
Definition: qimage_p.h:97
QMap< QString, QString > text
Definition: qimage_p.h:106
void qInitImageConversions()
Definition: qimage.cpp:3909