Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qbmphandler_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QBMPHANDLER_P_H
5#define QBMPHANDLER_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/private/qtguiglobal_p.h>
19#include "QtGui/qimageiohandler.h"
20
21#ifndef QT_NO_IMAGEFORMAT_BMP
22
24
25struct BMP_FILEHDR { // BMP file header
26 char bfType[2]; // "BM"
27 qint32 bfSize; // size of file
30 qint32 bfOffBits; // pointer to the pixmap bits
31};
32
33struct BMP_INFOHDR { // BMP information header
34 qint32 biSize; // size of this struct
35 qint32 biWidth; // pixmap width
36 qint32 biHeight; // pixmap height
37 qint16 biPlanes; // should be 1
38 qint16 biBitCount; // number of bits per pixel
39 qint32 biCompression; // compression method
40 qint32 biSizeImage; // size of image
41 qint32 biXPelsPerMeter; // horizontal resolution
42 qint32 biYPelsPerMeter; // vertical resolution
43 qint32 biClrUsed; // number of colors used
44 qint32 biClrImportant; // number of important colors
45 // V4:
55 // V5:
60};
61
62// BMP-Handler, which is also able to read and write the DIB
63// (Device-Independent-Bitmap) format used internally in the Windows operating
64// system for OLE/clipboard operations. DIB is a subset of BMP (without file
65// header). The Windows platform plugin accesses the DIB-functionality.
66
68{
69public:
74
76 bool canRead() const override;
77 bool read(QImage *image) override;
78 bool write(const QImage &image) override;
79
80 static bool canRead(QIODevice *device);
81
82 QVariant option(ImageOption option) const override;
83 void setOption(ImageOption option, const QVariant &value) override;
84 bool supportsOption(ImageOption option) const override;
85
86private:
87 bool readHeader();
88 inline QByteArray formatName() const;
89
90 enum State {
91 Ready,
92 ReadHeader,
93 Error
94 };
95
96 const InternalFormat m_format;
97
98 State state;
99 BMP_FILEHDR fileHeader;
100 BMP_INFOHDR infoHeader;
101 qint64 startpos;
102};
103
105
106#endif // QT_NO_IMAGEFORMAT_BMP
107
108#endif // QBMPHANDLER_P_H
bool supportsOption(ImageOption option) const override
Returns true if the QImageIOHandler supports the option option; otherwise returns false.
QBmpHandler(InternalFormat fmt=BmpFormat)
bool canRead() const override
Returns true if an image can be read from the device (i.e., the image format is supported,...
bool write(const QImage &image) override
Writes the image image to the assigned device.
void setOption(ImageOption option, const QVariant &value) override
Sets the option option with the value value.
bool read(QImage *image) override
Read an image from the device, and stores it in image.
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore \reentrant
Definition qiodevice.h:34
The QImageIOHandler class defines the common image I/O interface for all image formats in Qt.
ImageOption
This enum describes the different options supported by QImageIOHandler.
QIODevice * device() const
Returns the device currently assigned to the QImageIOHandler.
\inmodule QtGui
Definition qimage.h:37
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
Definition image.cpp:4
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint GLenum option
unsigned int quint32
Definition qtypes.h:50
short qint16
Definition qtypes.h:47
int qint32
Definition qtypes.h:49
long long qint64
Definition qtypes.h:60
QVideoFrameFormat::PixelFormat fmt
qint16 bfReserved1
qint32 bfOffBits
qint16 bfReserved2
char bfType[2]
qint16 biPlanes
qint32 biSizeImage
qint32 biClrImportant
qint32 biCompression
qint32 biGammaGreen
qint32 biGammaRed
qint16 biBitCount
qint32 biCSType
qint32 biReserved
quint32 biGreenMask
qint32 biIntent
qint32 biClrUsed
qint32 biYPelsPerMeter
qint32 biXPelsPerMeter
qint32 biHeight
qint32 biGammaBlue
quint32 biAlphaMask
quint32 biRedMask
qint32 biProfileData
qint32 biProfileSize
quint32 biBlueMask
qint32 biEndpoints[9]