Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qmacheifhandler.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 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#include "qmacheifhandler.h"
5#include "qiiofhelpers_p.h"
6#include <QVariant>
7
9
11 : d(new QIIOFHelper(this))
12{
13}
14
16{
17}
18
20{
21 bool bCanRead = false;
22 char buf[12];
23 if (iod && iod->peek(buf, 12) == 12) {
24 bCanRead = (!qstrncmp(buf + 4, "ftyp", 4) &&
25 (!qstrncmp(buf + 8, "heic", 4) ||
26 !qstrncmp(buf + 8, "heix", 4) ||
27 !qstrncmp(buf + 8, "mif1", 4)));
28 }
29 return bCanRead;
30}
31
33{
34 if (canRead(device())) {
35 setFormat("heic");
36 return true;
37 }
38 return false;
39}
40
42{
43 return d->readImage(image);
44}
45
47{
48 return d->writeImage(image, QStringLiteral("public.heic"));
49}
50
52{
53 return d->imageProperty(option);
54}
55
57{
59}
60
62{
63 return option == Quality
64 || option == Size
66}
67
bool writeImage(const QImage &in, const QString &uti)
QVariant imageProperty(QImageIOHandler::ImageOption option)
void setOption(QImageIOHandler::ImageOption option, const QVariant &value)
bool readImage(QImage *out)
\inmodule QtCore \reentrant
Definition qiodevice.h:34
qint64 peek(char *data, qint64 maxlen)
ImageOption
This enum describes the different options supported by QImageIOHandler.
QIODevice * device() const
Returns the device currently assigned to the QImageIOHandler.
void setFormat(const QByteArray &format)
Sets the format of the QImageIOHandler to format.
\inmodule QtGui
Definition qimage.h:37
bool read(QImage *image) override
Read an image from the device, and stores it in image.
QVariant option(ImageOption option) const override
Returns the value assigned to option as a QVariant.
bool canRead() const override
Returns true if an image can be read from the device (i.e., the image format is supported,...
~QMacHeifHandler() override
bool supportsOption(ImageOption option) const override
Returns true if the QImageIOHandler supports the option option; otherwise returns false.
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.
\inmodule QtCore
Definition qvariant.h:64
#define this
Definition dialogs.cpp:9
Combined button and popup list for selecting options.
Definition image.cpp:4
int qstrncmp(const char *str1, const char *str2, size_t len)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLenum option
#define QStringLiteral(str)