18#ifndef QGSIMAGECACHE_H
19#define QGSIMAGECACHE_H
25#include <QElapsedTimer>
48 QgsImageSizeCacheEntry(
const QString &path );
54 void dump()
const override;
55 bool isEqual(
const QgsAbstractContentCacheEntry *other )
const override;
76 ~QgsImageSizeCache()
override;
77 long maximumSize()
const {
return mMaxCacheSize; }
78 QSize originalSize(
const QString &path,
bool blocking =
false );
101 QgsImageCacheEntry(
const QString &path, QSize size,
bool keepAspectRatio,
double opacity,
double targetDpi,
int frameNumber );
107 bool keepAspectRatio =
true;
110 double opacity = 1.0;
120 bool isMissingImage =
false;
127 double targetDpi = 96;
134 int frameNumber = -1;
141 int totalFrameCount = -1;
148 int nextFrameDelay = -1;
151 void dump()
const override;
152 bool isEqual(
const QgsAbstractContentCacheEntry *other )
const override;
227 const bool keepAspectRatio,
228 const double opacity,
230 bool blocking =
false,
231 double targetDpi = 96,
232 int frameNumber = -1,
251 QSize originalSize(
const QString &path,
bool blocking =
false )
const;
270 int totalFrameCount(
const QString &path,
bool blocking =
false );
290 int nextFrameDelay(
const QString &path,
int currentFrame = 0,
bool blocking =
false );
297 void prepareAnimation(
const QString &path );
307 QImage pathAsImagePrivate(
308 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
312 const QString &path, QSize size,
const bool keepAspectRatio,
const double opacity,
double targetDpi,
int frameNumber,
bool &isBroken,
int &
totalFrameCount,
int &nextFrameDelayMs,
bool blocking =
false
315 static QImage getFrameFromReader( QImageReader &reader,
int frameNumber );
317 QSize originalSizePrivate(
const QString &path,
bool blocking =
false )
const;
320 QByteArray mMissingSvg;
322 QByteArray mFetchingSvg;
324 QMap< QString, QString > mExtractedAnimationPaths;
325 std::unique_ptr< QTemporaryDir > mTemporaryDir;
326 QMap< QString, int > mTotalFrameCounts;
327 QMap< QString, QVector< int > > mImageDelays;
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.
QgsAbstractContentCache(QObject *parent=nullptr, const QString &typeString=QString(), long maxCacheSize=20000000, int fileModifiedCheckTimeout=30000)
A cache for images derived from raster files.
friend class TestQgsImageCache
friend class QgsImageSizeCache
static const QgsSettingsEntryInteger * settingsMaxImageCacheSize
QgsImageCache(QObject *parent=nullptr)
Constructor for QgsImageCache, with the specified parent object.
int totalFrameCount(const QString &path, bool blocking=false)
Returns the total frame count of the image at the specified path.
~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.
An integer settings entry.