Public Member Functions |
| ~QgsSvgCache () |
const QImage & | svgAsImage (const QString &file, double size, const QColor &fill, const QColor &outline, double outlineWidth, double widthScaleFactor, double rasterScaleFactor, bool &fitsInCache) |
| Get SVG as QImage.
|
const QPicture & | svgAsPicture (const QString &file, double size, const QColor &fill, const QColor &outline, double outlineWidth, double widthScaleFactor, double rasterScaleFactor, bool forceVectorOutput=false) |
| Get SVG as QPicture&.
|
void | containsParams (const QString &path, bool &hasFillParam, QColor &defaultFillColor, bool &hasOutlineParam, QColor &defaultOutlineColor, bool &hasOutlineWidthParam, double &defaultOutlineWidth) const |
| Tests if an svg file contains parameters for fill, outline color, outline width.
|
QByteArray | getImageData (const QString &path) const |
| Get image data.
|
Protected Member Functions |
| QgsSvgCache (QObject *parent=0) |
| protected constructor
|
QgsSvgCacheEntry * | insertSVG (const QString &file, double size, const QColor &fill, const QColor &outline, double outlineWidth, double widthScaleFactor, double rasterScaleFactor) |
| Creates new cache entry and returns pointer to it.
|
void | replaceParamsAndCacheSvg (QgsSvgCacheEntry *entry) |
void | cacheImage (QgsSvgCacheEntry *entry) |
void | cachePicture (QgsSvgCacheEntry *entry, bool forceVectorOutput=false) |
QgsSvgCacheEntry * | cacheEntry (const QString &file, double size, const QColor &fill, const QColor &outline, double outlineWidth, double widthScaleFactor, double rasterScaleFactor) |
| Returns entry from cache or creates a new entry if it does not exist already.
|
void | trimToMaximumSize () |
| Removes the least used items until the maximum size is under the limit.
|
void | takeEntryFromList (QgsSvgCacheEntry *entry) |
A cache for images / pictures derived from svg files.
This class supports parameter replacement in svg files according to the svg params specification (http://www.w3.org/TR/2009/WD-SVGParamPrimer-20090616/). Supported are the parameters 'fill-color', 'pen-color', 'outline-width', 'stroke-width'. E.g. <circle fill="param(fill-color red)" stroke="param(pen-color black)" stroke-width="param(outline-width 1)"
void QgsSvgCache::containsParams |
( |
const QString & |
path, |
|
|
bool & |
hasFillParam, |
|
|
QColor & |
defaultFillColor, |
|
|
bool & |
hasOutlineParam, |
|
|
QColor & |
defaultOutlineColor, |
|
|
bool & |
hasOutlineWidthParam, |
|
|
double & |
defaultOutlineWidth |
|
) |
| const |
Tests if an svg file contains parameters for fill, outline color, outline width.
If yes, possible default values are returned. If there are several default values in the svg file, only the first one is considered