18#ifndef QGSIMAGECACHE_H
19#define QGSIMAGECACHE_H
25#include <QElapsedTimer>
56 QgsImageCacheEntry(
const QString &path, QSize size,
bool keepAspectRatio,
double opacity,
double targetDpi,
int frameNumber ) ;
62 bool keepAspectRatio =
true;
75 bool isMissingImage =
false;
82 double targetDpi = 96;
96 int totalFrameCount = -1;
103 int nextFrameDelay = -1;
106 void dump()
const override;
179 QImage pathAsImage(
const QString &path,
const QSize size,
const bool keepAspectRatio,
const double opacity,
bool &fitsInCache
SIP_OUT,
bool blocking =
false,
double targetDpi = 96,
int frameNumber = -1,
bool *isMissing
SIP_PYARGREMOVE =
nullptr );
196 QSize originalSize(
const QString &path,
bool blocking =
false )
const;
215 int totalFrameCount(
const QString &path,
bool blocking =
false );
235 int nextFrameDelay(
const QString &path,
int currentFrame = 0,
bool blocking =
false );
242 void prepareAnimation(
const QString &path );
253 QImage pathAsImagePrivate(
const QString &path,
const QSize size,
const bool keepAspectRatio,
const double opacity,
bool &fitsInCache,
bool blocking,
double targetDpi,
int frameNumber,
bool *isMissing,
int &totalFrameCount,
int &nextFrameDelayMs );
255 QImage renderImage(
const QString &path, QSize size,
const bool keepAspectRatio,
const double opacity,
double targetDpi,
int frameNumber,
bool &isBroken,
int &totalFrameCount,
int &nextFrameDelayMs,
bool blocking =
false )
const;
257 static QImage getFrameFromReader( QImageReader &reader,
int frameNumber );
260 QByteArray mMissingSvg;
262 QByteArray mFetchingSvg;
264 QMap< QString, QString > mExtractedAnimationPaths;
265 std::unique_ptr< QTemporaryDir > mTemporaryDir;
266 QMap< QString, int > mTotalFrameCounts;
267 QMap< QString, QVector< int > > mImageDelays;
269 friend class TestQgsImageCache;
A QObject derived base class for QgsAbstractContentCache.
Base class for entries in a QgsAbstractContentCache.
virtual int dataSize() const =0
Returns the memory usage in bytes for the entry.
virtual void dump() const =0
Dumps debugging strings containing the item's properties.
virtual bool isEqual(const QgsAbstractContentCacheEntry *other) const =0
Tests whether this entry matches another entry.
Abstract base class for file content caches, such as SVG or raster image caches.
A cache for images derived from raster files.
~QgsImageCache() override
void remoteImageFetched(const QString &url)
Emitted when the cache has finished retrieving an image file from a remote url.
long maximumSize() const
Returns the maximum size of the cache, in bytes.