![]() |
digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
|
Public Types | |
enum | StorageMethod { NoThumbnailStorage , FreeDesktopStandard , ThumbnailDatabase } |
Public Member Functions | |
ThumbnailCreator (int thumbnailSize, StorageMethod method) | |
Create a thumbnail creator object, and set the thumbnail size. | |
ThumbnailCreator (StorageMethod method) | |
Create a thumbnail creator object. | |
void | deleteThumbnailsFromDisk (const QString &filePath) const |
Deletes all available thumbnails from the on-disk thumbnail cache. | |
QString | errorString () const |
Returns the last error that occurred. | |
QImage | load (const ThumbnailIdentifier &identifier, bool onlyStorage=false) const |
Create a thumbnail for the specified file. | |
QImage | loadDetail (const ThumbnailIdentifier &identifier, const QRect &detailRect, bool onlyStorage=false) const |
Creates a thumbnail for the specified detail of the file. | |
void | pregenerate (const ThumbnailIdentifier &identifier) const |
Ensures that the thumbnail is pregenerated in the database, but does not load it from there. | |
void | pregenerateDetail (const ThumbnailIdentifier &identifier, const QRect &detailRect) const |
void | setExifRotate (bool rotate) |
Set the Exif rotation property. | |
void | setLoadingProperties (DImgLoaderObserver *const observer, const DRawDecoding &settings) |
If you plan to load thumbnail from the context of the threadimageio framework, you can specify the relevant parameters. | |
void | setOnlyLargeThumbnails (bool onlyLarge) |
If you enable this property, the thumbnail creator will create only large thumbnails on disk (256x256 as described in FreeDesktop paper). | |
void | setRemoveAlphaChannel (bool removeAlpha) |
If you enable this property, the returned QImage objects will not have an alpha channel. | |
void | setThumbnailInfoProvider (ThumbnailInfoProvider *const provider) |
Set a ThumbnailInfoProvider to provide custom ThumbnailInfos. | |
void | setThumbnailSize (int thumbnailSize) |
Sets the thumbnail size. | |
void | store (const QString &path, const QImage &image) const |
Store the given image as thumbnail of the given path. | |
void | storeDetailThumbnail (const QString &path, const QRect &detailRect, const QImage &image) const |
int | storedSize () const |
Return the stored image size, the size of the image that is stored on disk (according to Storage Method). | |
int | thumbnailSize () const |
Return the thumbnail size, the maximum size of the QImage returned by load. | |
Static Public Member Functions | |
static ThumbnailInfo | fileThumbnailInfo (const QString &path) |
Creates a default ThumbnailInfo for the given path using QFileInfo only. | |
static QString | identifierForDetail (const ThumbnailInfo &info, const QRect &rect) |
Returns the customIdentifier for the detail thumbnail. | |
|
explicit |
You must call setThumbnailSize before load.
void Digikam::ThumbnailCreator::deleteThumbnailsFromDisk | ( | const QString & | filePath | ) | const |
A subsequent call to load() will recreate the thumbnail.
QString Digikam::ThumbnailCreator::errorString | ( | ) | const |
It is valid if load returned a null QImage object.
QImage Digikam::ThumbnailCreator::loadDetail | ( | const ThumbnailIdentifier & | identifier, |
const QRect & | detailRect, | ||
bool | onlyStorage = false |
||
) | const |
A suitable custom identifier (for cache key etc.) is inserted as image.text("customIdentifier").
void Digikam::ThumbnailCreator::setExifRotate | ( | bool | rotate | ) |
If exifRotate is true, the thumbnail will be rotated according to the Exif information. Default value is true.
void Digikam::ThumbnailCreator::setLoadingProperties | ( | DImgLoaderObserver *const | observer, |
const DRawDecoding & | settings | ||
) |
void Digikam::ThumbnailCreator::setOnlyLargeThumbnails | ( | bool | onlyLarge | ) |
Normally, for requested sizes below 128, thumbnails of 128x128 will be cached on disk. Default value is false.
void Digikam::ThumbnailCreator::setRemoveAlphaChannel | ( | bool | removeAlpha | ) |
Images with transparency will be blended over an opaque background.
void Digikam::ThumbnailCreator::setThumbnailSize | ( | int | thumbnailSize | ) |
This is the maximum size of the QImage returned by load.
void Digikam::ThumbnailCreator::store | ( | const QString & | path, |
const QImage & | image | ||
) | const |
Image should at least have storedSize().
int Digikam::ThumbnailCreator::storedSize | ( | ) | const |
This size is possibly larger than thumbnailSize. Possible values: 128 or 256.