Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
// Qt-Security score:critical reason:data-parser
4
5
#
include
"qmacheifhandler.h"
6
#
include
<
QVariant
>
7
8
QT_BEGIN_NAMESPACE
9
10
QMacHeifHandler::QMacHeifHandler()
11
: d(
new
QIIOFHelper(
this
))
12
{
13
}
14
15
QMacHeifHandler
::~
QMacHeifHandler
()
16
{
17
}
18
19
bool
QMacHeifHandler
::
canRead
(QIODevice *iod)
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,
"msf1"
, 4) ||
28
!qstrncmp(buf + 8,
"mif1"
, 4)));
29
}
30
return
bCanRead;
31
}
32
33
bool
QMacHeifHandler
::
canRead
()
const
34
{
35
if
(canRead(device())) {
36
setFormat(
"heic"
);
37
return
true
;
38
}
39
return
false
;
40
}
41
42
bool
QMacHeifHandler
::
read
(QImage *image)
43
{
44
return
d->readImage(image);
45
}
46
47
bool
QMacHeifHandler
::
write
(
const
QImage &image)
48
{
49
return
d->writeImage(image, QStringLiteral(
"public.heic"
));
50
}
51
52
QVariant
QMacHeifHandler
::
option
(ImageOption option)
const
53
{
54
return
d->imageProperty(option);
55
}
56
57
void
QMacHeifHandler
::
setOption
(ImageOption option,
const
QVariant &value)
58
{
59
d->setOption(option, value);
60
}
61
62
bool
QMacHeifHandler
::
supportsOption
(ImageOption option)
const
63
{
64
return
option == Quality
65
|| option == Size
66
|| option == ImageTransformation;
67
}
68
69
QT_END_NAMESPACE
QMacHeifHandler
Definition
qmacheifhandler.h:23
QMacHeifHandler::read
bool read(QImage *image) override
Read an image from the device, and stores it in image.
Definition
qmacheifhandler.cpp:42
QMacHeifHandler::canRead
static bool canRead(QIODevice *iod)
Definition
qmacheifhandler.cpp:19
QMacHeifHandler::option
QVariant option(ImageOption option) const override
Returns the value assigned to option as a QVariant.
Definition
qmacheifhandler.cpp:52
QMacHeifHandler::canRead
bool canRead() const override
Returns true if an image can be read from the device (i.e., the image format is supported,...
Definition
qmacheifhandler.cpp:33
QMacHeifHandler::~QMacHeifHandler
~QMacHeifHandler() override
Definition
qmacheifhandler.cpp:15
QMacHeifHandler::supportsOption
bool supportsOption(ImageOption option) const override
Returns true if the QImageIOHandler supports the option option; otherwise returns false.
Definition
qmacheifhandler.cpp:62
QMacHeifHandler::write
bool write(const QImage &image) override
Writes the image image to the assigned device.
Definition
qmacheifhandler.cpp:47
QMacHeifHandler::setOption
void setOption(ImageOption option, const QVariant &value) override
Sets the option option with the value value.
Definition
qmacheifhandler.cpp:57
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtimageformats
src
plugins
imageformats
macheif
qmacheifhandler.cpp
Generated on
for Qt by
1.18.0