50 QgsSvgCacheEntry(
const QString &path,
double size,
double strokeWidth,
double widthScaleFactor,
const QColor &fill,
const QColor &stroke,
51 double fixedAspectRatio = 0 ) ;
54 QgsSvgCacheEntry(
const QgsSvgCacheEntry &rh ) =
delete;
56 QgsSvgCacheEntry &
operator=(
const QgsSvgCacheEntry &rh ) =
delete;
59 double strokeWidth = 0;
60 double widthScaleFactor = 1.0;
63 double fixedAspectRatio = 0;
71 QColor fill = Qt::black;
72 QColor stroke = Qt::black;
73 std::unique_ptr< QImage > image;
74 std::unique_ptr< QPicture > picture;
76 QByteArray svgContent;
83 bool isMissingImage =
false;
87 void dump()
const override;
133 QImage svgAsImage(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
134 double widthScaleFactor,
bool &fitsInCache,
double fixedAspectRatio = 0,
bool blocking =
false );
150 QPicture svgAsPicture(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
151 double widthScaleFactor,
bool forceVectorOutput =
false,
double fixedAspectRatio = 0,
bool blocking =
false );
168 QSizeF svgViewboxSize(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
169 double widthScaleFactor,
double fixedAspectRatio = 0,
bool blocking =
false );
176 void containsParams(
const QString &path,
bool &hasFillParam, QColor &defaultFillColor,
bool &hasStrokeParam, QColor &defaultStrokeColor,
bool &hasStrokeWidthParam,
177 double &defaultStrokeWidth,
bool blocking =
false )
const;
204 void containsParams(
const QString &path,
bool &hasFillParam,
bool &hasDefaultFillParam, QColor &defaultFillColor,
205 bool &hasFillOpacityParam,
bool &hasDefaultFillOpacity,
double &defaultFillOpacity,
206 bool &hasStrokeParam,
bool &hasDefaultStrokeColor, QColor &defaultStrokeColor,
207 bool &hasStrokeWidthParam,
bool &hasDefaultStrokeWidth,
double &defaultStrokeWidth,
208 bool &hasStrokeOpacityParam,
bool &hasDefaultStrokeOpacity,
double &defaultStrokeOpacity,
209 bool blocking =
false )
const SIP_PYNAME( containsParamsV3 );
224 QByteArray getImageData(
const QString &path,
bool blocking =
false )
const;
243 QByteArray svgContent(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
244 double widthScaleFactor,
double fixedAspectRatio = 0,
bool blocking =
false,
bool *isMissingImage =
nullptr );
246 QByteArray svgContent(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
247 double widthScaleFactor,
double fixedAspectRatio = 0,
bool blocking =
false );
256 Q_DECL_DEPRECATED
void statusChanged(
const QString &statusQString )
SIP_DEPRECATED;
262 void remoteSvgFetched(
const QString &url );
266 bool checkReply( QNetworkReply *reply,
const QString &path )
const override;
270 void replaceParamsAndCacheSvg( QgsSvgCacheEntry *entry,
bool blocking =
false );
271 void cacheImage( QgsSvgCacheEntry *entry );
272 void cachePicture( QgsSvgCacheEntry *entry,
bool forceVectorOutput =
false );
274 QgsSvgCacheEntry *cacheEntry(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
275 double widthScaleFactor,
double fixedAspectRatio = 0,
bool blocking =
false,
bool *isMissingImage =
nullptr );
278 void replaceElemParams( QDomElement &elem,
const QColor &fill,
const QColor &stroke,
double strokeWidth );
280 void containsElemParams(
const QDomElement &elem,
281 bool &hasFillParam,
bool &hasDefaultFill, QColor &defaultFill,
282 bool &hasFillOpacityParam,
bool &hasDefaultFillOpacity,
double &defaultFillOpacity,
283 bool &hasStrokeParam,
bool &hasDefaultStroke, QColor &defaultStroke,
284 bool &hasStrokeWidthParam,
bool &hasDefaultStrokeWidth,
double &defaultStrokeWidth,
285 bool &hasStrokeOpacityParam,
bool &hasDefaultStrokeOpacity,
double &defaultStrokeOpacity )
const SIP_PYNAME( containsParamsV3 );
288 double calcSizeScaleFactor( QgsSvgCacheEntry *entry,
const QDomElement &docElem, QSizeF &viewboxSize )
const;
294 QSize sizeForImage(
const QgsSvgCacheEntry &entry, QSizeF &viewBoxSize, QSizeF &scaledSize )
const;
299 QImage imageFromCachedPicture(
const QgsSvgCacheEntry &entry )
const;
302 QByteArray mMissingSvg;
304 QByteArray mFetchingSvg;
306 friend class TestQgsSvgCache;
309 #endif // QGSSVGCACHE_H