File: qgsimagecache.sip.in

package info (click to toggle)
qgis 3.40.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,183,800 kB
  • sloc: cpp: 1,595,841; python: 372,637; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 154
file content (182 lines) | stat: -rw-r--r-- 7,302 bytes parent folder | download | duplicates (12)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgsimagecache.h                                             *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/







class QgsImageCache : QgsAbstractContentCacheBase
{
%Docstring(signature="appended")
A cache for images derived from raster files.

:py:class:`QgsImageCache` stores pre-rendered resampled versions of
raster image files, allowing efficient reuse without incurring the cost
of resampling on every render.

:py:class:`QgsImageCache` is not usually directly created, but rather
accessed through :py:func:`QgsApplication.imageCache()`.

.. versionadded:: 3.6
%End

%TypeHeaderCode
#include "qgsimagecache.h"
%End
  public:

    QgsImageCache( QObject *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsImageCache, with the specified ``parent`` object.
%End

    ~QgsImageCache();

    long maximumSize() const;
%Docstring
Returns the maximum size of the cache, in bytes.

.. versionadded:: 3.26
%End

    QImage pathAsImage( const QString &path, const QSize size, const bool keepAspectRatio, const double opacity, bool &fitsInCache /Out/, bool blocking = false, double targetDpi = 96, int frameNumber = -1 );
%Docstring
Returns the specified ``path`` rendered as an image. If possible, a
pre-existing cached version of the image will be used. If not, the image
is fetched and resampled to the desired size, and then the result cached
for subsequent lookups.

:param path: may be a local file, remote (HTTP) url, or a base 64
             encoded string (with a "base64:" prefix).
:param size: dictates the target size of the image. An invalid size
             indicates the original raster image size (with no
             resampling). A size in which the width or height is set to
             zero will have the zeroed value automatically computed when
             keepAspectRatio is ``True``.
:param keepAspectRatio: if ``True`` then the original raster aspect
                        ratio will be maintained during any resampling
                        operations.
:param opacity: dictates the opacity of the image (between 0 and 1).
:param blocking: if ``True``, forces to wait for loading before
                 returning image. The content is loaded in the same
                 thread to ensure provided the image. WARNING: the
                 ``blocking`` parameter must NEVER be ``True`` from GUI
                 based applications (like the main QGIS application) or
                 crashes will result. Only for use in external scripts
                 or QGIS server.
:param targetDpi: (since QGIS 3.22) can be used to specify an explicit
                  DPI to render the image at. This is used for some
                  image formats (e.g. PDF) to ensure that content is
                  rendered at the desired DPI. This argument is only
                  used when an invalid ``size`` argument is specified.
                  If a valid ``size`` is specified then the image will
                  always be rendered at this size, regardless of the
                  ``targetDpi``.
:param frameNumber: (since QGIS 3.26) specifies a frame number for image
                    formats which support animations. This should be set
                    to -1 if not required.

:return: - rendered image
         - fitsInCache: ``True`` if the resultant raster was of a
           sufficiently small size to store in the cache
%End

    QSize originalSize( const QString &path, bool blocking = false ) const;
%Docstring
Returns the original size (in pixels) of the image at the specified
``path``.

``path`` may be a local file, remote (HTTP) url, or a base 64 encoded
string (with a "base64:" prefix).

If ``path`` is a remote file, then an invalid size may be returned while
the image is in the process of being fetched.

The ``blocking`` boolean forces to wait for loading before returning the
original size. The content is loaded in the same thread to ensure
provided the original size. WARNING: the ``blocking`` parameter must
NEVER be ``True`` from GUI based applications (like the main QGIS
application) or crashes will result. Only for use in external scripts or
QGIS server.

If the image could not be read then an invalid QSize is returned.
%End

    int totalFrameCount( const QString &path, bool blocking = false );
%Docstring
Returns the total frame count of the image at the specified ``path``.

``path`` may be a local file, remote (HTTP) url, or a base 64 encoded
string (with a "base64:" prefix).

If ``path`` is a remote file, then -1 may be returned while the image is
in the process of being fetched.

The ``blocking`` boolean forces to wait for loading before returning the
frame count. The content is loaded in the same thread to ensure provided
the original size. WARNING: the ``blocking`` parameter must NEVER be
``True`` from GUI based applications (like the main QGIS application) or
crashes will result. Only for use in external scripts or QGIS server.

If the image could not be read or is not an animated format then -1 is
returned

.. versionadded:: 3.26
%End

    int nextFrameDelay( const QString &path, int currentFrame = 0, bool blocking = false );
%Docstring
For image formats that support animation, this function returns the
number of milliseconds to wait until displaying the next frame in the
animation. If the image format doesn't support animation, 0 is returned.

``path`` may be a local file, remote (HTTP) url, or a base 64 encoded
string (with a "base64:" prefix).

If ``path`` is a remote file, then -1 may be returned while the image is
in the process of being fetched.

The ``blocking`` boolean forces to wait for loading before returning the
frame delay. The content is loaded in the same thread to ensure provided
the original size. WARNING: the ``blocking`` parameter must NEVER be
``True`` from GUI based applications (like the main QGIS application) or
crashes will result. Only for use in external scripts or QGIS server.

If the image could not be read or is not an animated format then -1 is
returned.

.. versionadded:: 3.26
%End

    void prepareAnimation( const QString &path );
%Docstring
Prepares for optimized retrieval of frames for the animation at the
given ``path``.

.. versionadded:: 3.26
%End

  signals:

    void remoteImageFetched( const QString &url );
%Docstring
Emitted when the cache has finished retrieving an image file from a
remote ``url``.
%End

};

/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgsimagecache.h                                             *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/