-
Notifications
You must be signed in to change notification settings - Fork 23
/
imageutils.h
62 lines (45 loc) · 1.3 KB
/
imageutils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright 2016 Cutehacks AS. All rights reserved.
// License can be found in the LICENSE file.
#ifndef IMAGEUTILS_H
#define IMAGEUTILS_H
#include <QObject>
#include <QtQml/QJSValue>
#include "multipartsource.h"
class QQmlEngine;
class QImageReader;
namespace com { namespace cutehacks { namespace duperagent {
class Image : public AbstractMultipartSource
{
Q_OBJECT
public:
Image(QQmlEngine *, const QString &);
~Image();
QJSValue self() const { return m_self; }
Q_INVOKABLE QJSValue size() const;
Q_INVOKABLE int fileSize() const;
Q_INVOKABLE QJSValue setScaledSize(int, int, const QJSValue& = QJSValue());
Q_INVOKABLE QJSValue setClipRect(int, int, int, int);
Q_INVOKABLE QJSValue setScaledClipRect(int, int, int, int);
Q_INVOKABLE QJSValue setAutoTransform(bool);
Q_INVOKABLE QString toJSON();
Q_INVOKABLE QJSValue read(const QJSValue& = QJSValue());
QByteArray data() const;
QString mimeType() const;
private:
QQmlEngine *m_engine;
QImageReader *m_reader;
QByteArray m_data;
QString m_mimeType;
QJSValue m_self;
};
class ImageUtils : public QObject
{
Q_OBJECT
public:
explicit ImageUtils(QQmlEngine *);
Q_INVOKABLE QJSValue createReader(const QString&);
private:
QQmlEngine *m_engine;
};
} } }
#endif // IMAGEUTILS_H