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 );
177 void containsParams(
const QString &path,
bool &hasFillParam, QColor &defaultFillColor,
bool &hasStrokeParam, QColor &defaultStrokeColor,
bool &hasStrokeWidthParam,
178 double &defaultStrokeWidth,
bool blocking =
false )
const;
205 void containsParams(
const QString &path,
bool &hasFillParam,
bool &hasDefaultFillParam, QColor &defaultFillColor,
206 bool &hasFillOpacityParam,
bool &hasDefaultFillOpacity,
double &defaultFillOpacity,
207 bool &hasStrokeParam,
bool &hasDefaultStrokeColor, QColor &defaultStrokeColor,
208 bool &hasStrokeWidthParam,
bool &hasDefaultStrokeWidth,
double &defaultStrokeWidth,
209 bool &hasStrokeOpacityParam,
bool &hasDefaultStrokeOpacity,
double &defaultStrokeOpacity,
210 bool blocking =
false )
const SIP_PYNAME( containsParamsV3 );
225 QByteArray getImageData(
const QString &path,
bool blocking =
false )
const;
244 QByteArray svgContent(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
245 double widthScaleFactor,
double fixedAspectRatio = 0,
bool blocking =
false,
bool *isMissingImage =
nullptr );
247 QByteArray svgContent(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
248 double widthScaleFactor,
double fixedAspectRatio = 0,
bool blocking =
false );
267 bool checkReply( QNetworkReply *reply,
const QString &path )
const override;
271 void replaceParamsAndCacheSvg( QgsSvgCacheEntry *entry,
bool blocking =
false );
272 void cacheImage( QgsSvgCacheEntry *entry );
273 void cachePicture( QgsSvgCacheEntry *entry,
bool forceVectorOutput =
false );
275 QgsSvgCacheEntry *cacheEntry(
const QString &path,
double size,
const QColor &fill,
const QColor &stroke,
double strokeWidth,
276 double widthScaleFactor,
double fixedAspectRatio = 0,
bool blocking =
false,
bool *isMissingImage =
nullptr );
279 void replaceElemParams( QDomElement &elem,
const QColor &fill,
const QColor &stroke,
double strokeWidth );
281 void containsElemParams(
const QDomElement &elem,
282 bool &hasFillParam,
bool &hasDefaultFill, QColor &defaultFill,
283 bool &hasFillOpacityParam,
bool &hasDefaultFillOpacity,
double &defaultFillOpacity,
284 bool &hasStrokeParam,
bool &hasDefaultStroke, QColor &defaultStroke,
285 bool &hasStrokeWidthParam,
bool &hasDefaultStrokeWidth,
double &defaultStrokeWidth,
286 bool &hasStrokeOpacityParam,
bool &hasDefaultStrokeOpacity,
double &defaultStrokeOpacity )
const SIP_PYNAME( containsParamsV3 );
289 double calcSizeScaleFactor( QgsSvgCacheEntry *entry,
const QDomElement &docElem, QSizeF &viewboxSize )
const;
295 QSize sizeForImage(
const QgsSvgCacheEntry &entry, QSizeF &viewBoxSize, QSizeF &scaledSize )
const;
300 QImage imageFromCachedPicture(
const QgsSvgCacheEntry &entry )
const;
303 QByteArray mMissingSvg;
305 QByteArray mFetchingSvg;
307 friend class TestQgsSvgCache;
310 #endif // QGSSVGCACHE_H