digiKam
DigikamRAWDImgPlugin::DImgRAWLoader Class Reference
+ Inheritance diagram for DigikamRAWDImgPlugin::DImgRAWLoader:

Public Types

enum  LoadFlag {
  LoadItemInfo = 1 , LoadMetadata = 2 , LoadICCData = 4 , LoadImageData = 8 ,
  LoadUniqueHash = 16 , LoadImageHistory = 32 , LoadPreview = 64 , LoadAll = LoadItemInfo | LoadMetadata | LoadICCData | LoadImageData | LoadUniqueHash | LoadImageHistory
}
 

Public Member Functions

void cancel ()
 
bool decodeHalfRAWImage (const QString &filePath, const DRawDecoderSettings &DRawDecoderSettings, QByteArray &imageData, int &width, int &height, int &rgbmax)
 
bool decodeRAWImage (const QString &filePath, const DRawDecoderSettings &DRawDecoderSettings, QByteArray &imageData, int &width, int &height, int &rgbmax)
 
 DImgRAWLoader (DImg *const image, const DRawDecoding &rawDecodingSettings=DRawDecoding())
 
bool extractRAWData (const QString &filePath, QByteArray &rawData, DRawInfo &identify, unsigned int shotSelect=0)
 
FilterAction filterAction () const
 
bool hasAlpha () const override
 
virtual bool hasLoadedData () const
 
bool isReadOnly () const override
 
bool load (const QString &filePath, DImgLoaderObserver *const observer=nullptr) override
 
template<typename Type >
Q_INLINE_TEMPLATE Type * new_failureTolerant (quint64 w, quint64 h, uint typesPerPixel)
 
template<typename Type >
Q_INLINE_TEMPLATE Type * new_failureTolerant (size_t size)
 
void postProcess (DImgLoaderObserver *const observer)
 
bool save (const QString &, DImgLoaderObserver *const) override
 
void setLoadFlags (LoadFlags flags)
 
bool sixteenBit () const override
 
 ~DImgRAWLoader () override
 

Static Public Member Functions

static qint64 checkAllocation (qint64 fullSize)
 
static bool isRawFile (const QUrl &url)
 
static int librawUseGomp ()
 
static QString librawVersion ()
 
static bool loadEmbeddedPreview (QByteArray &imgData, const QBuffer &inBuffer)
 
static bool loadEmbeddedPreview (QByteArray &imgData, const QString &path)
 
static bool loadEmbeddedPreview (QImage &image, const QString &path)
 
static bool loadFullImage (QImage &image, const QString &path, const DRawDecoderSettings &settings=DRawDecoderSettings())
 
static bool loadHalfPreview (QByteArray &imgData, const QBuffer &inBuffer)
 
static bool loadHalfPreview (QByteArray &imgData, const QString &path)
 
static bool loadHalfPreview (QImage &image, const QString &path)
 
static bool loadRawPreview (QByteArray &imgData, const QBuffer &inBuffer)
 
static bool loadRawPreview (QByteArray &imgData, const QString &path)
 
static bool loadRawPreview (QImage &image, const QString &path)
 
static unsigned char * new_failureTolerant (quint64 w, quint64 h, uint typesPerPixel)
 
template<typename Type >
static Type * new_failureTolerant (quint64 w, quint64 h, uint typesPerPixel)
 
static unsigned char * new_failureTolerant (size_t unsecureSize)
 
template<typename Type >
static Type * new_failureTolerant (size_t unsecureSize)
 
static unsigned short * new_short_failureTolerant (quint64 w, quint64 h, uint typesPerPixel)
 
static unsigned short * new_short_failureTolerant (size_t unsecureSize)
 
static bool rawFileIdentify (DRawInfo &identify, const QString &path)
 
static QString rawFiles ()
 
static QStringList rawFilesList ()
 
static int rawFilesVersion ()
 
static QStringList supportedCamera ()
 

Protected Member Functions

bool checkExifWorkingColorSpace () const
 
virtual int granularity (DImgLoaderObserver *const observer, int total, float progressSlice=1.0F)
 
int imageBitsDepth () const
 
int imageBytesDepth () const
 
unsigned char *& imageData ()
 
QMap< QString, QString > & imageEmbeddedText () const
 
QVariant imageGetAttribute (const QString &key) const
 
QString imageGetEmbbededText (const QString &key) const
 
bool imageHasAlpha () const
 
unsigned int & imageHeight ()
 
quint64 imageNumBytes () const
 
void imageSetAttribute (const QString &key, const QVariant &value)
 
void imageSetEmbbededText (const QString &key, const QString &text)
 
void imageSetIccProfile (const IccProfile &profile)
 
bool imageSixteenBit () const
 
unsigned int & imageWidth ()
 
void loadingFailed ()
 
void purgeExifWorkingColorSpace ()
 
virtual bool readMetadata (const QString &filePath)
 
virtual bool saveMetadata (const QString &filePath)
 
void storeColorProfileInMetadata ()
 

Protected Attributes

bool m_cancel
 
DRawDecoderSettings m_decoderSettings
 
DImg * m_image
 
LoadFlags m_loadFlags
 

Member Enumeration Documentation

◆ LoadFlag

This is the list of loading modes usable by DImg image plugins

Enumerator
LoadItemInfo 

Load image information without image data.

Image info as width and height

LoadMetadata 

Image metadata.

LoadICCData 

Image color profile.

LoadImageData 

Full image data.

LoadUniqueHash 

Image unique hash.

LoadImageHistory 

Image version history.

LoadPreview 

Special mode to load reduced image data.

Load embedded preview image instead full size image

LoadAll 

Helper to load all information, metadata and full image.

Constructor & Destructor Documentation

◆ DImgRAWLoader()

DigikamRAWDImgPlugin::DImgRAWLoader::DImgRAWLoader ( DImg *const  image,
const DRawDecoding rawDecodingSettings = DRawDecoding() 
)
explicit

◆ ~DImgRAWLoader()

DigikamRAWDImgPlugin::DImgRAWLoader::~DImgRAWLoader ( )
override

Member Function Documentation

◆ cancel()

void Digikam::DRawDecoder::cancel ( )
inherited

To cancel 'decodeHalfRAWImage' and 'decodeRAWImage' methods running in a separate thread.

References Digikam::DRawDecoder::m_cancel.

Referenced by Digikam::DRawDecoder::~DRawDecoder().

◆ checkAllocation()

qint64 Digikam::DImgLoader::checkAllocation ( qint64  fullSize)
staticinherited

Value returned : -1 : unsupported platform 0 : parse failure from supported platform 1 : parse done with success from supported platform

References Digikam::KMemoryInfo::AvailableMemory, Digikam::KMemoryInfo::bytes(), Digikam::KMemoryInfo::currentInfo(), and Digikam::KMemoryInfo::isValid().

Referenced by Digikam::DImgLoader::new_failureTolerant().

◆ checkExifWorkingColorSpace()

◆ decodeHalfRAWImage()

bool Digikam::DRawDecoder::decodeHalfRAWImage ( const QString &  filePath,
const DRawDecoderSettings DRawDecoderSettings,
QByteArray &  imageData,
int &  width,
int &  height,
int &  rgbmax 
)
inherited

Extract a small size of decode RAW data from 'filePath' picture file using 'DRawDecoderSettings' settings. This is a cancelable method which require a class instance to run because RAW pictures decoding can take a while.

This method return:

- A byte array container 'imageData' with picture data. Pixels order is RGB.
  Color depth can be 8 or 16. In 8 bits you can access to color component
  using (uchar*), in 16 bits using (ushort*).

- Size size of image in number of pixels ('width' and 'height').
- The max average of RGB components from decoded picture.
- 'false' is returned if decoding failed, else 'true'.

References Digikam::DRawDecoderSettings::halfSizeColorImage, Digikam::DRawDecoder::Private::loadFromLibraw(), and Digikam::DRawDecoder::m_decoderSettings.

◆ decodeRAWImage()

bool Digikam::DRawDecoder::decodeRAWImage ( const QString &  filePath,
const DRawDecoderSettings DRawDecoderSettings,
QByteArray &  imageData,
int &  width,
int &  height,
int &  rgbmax 
)
inherited

Extract a full size of RAW data from 'filePath' picture file using 'DRawDecoderSettings' settings. This is a cancelable method which require a class instance to run because RAW pictures decoding can take a while.

This method return:

- A byte array container 'imageData' with picture data. Pixels order is RGB.
  Color depth can be 8 or 16. In 8 bits you can access to color component
  using (uchar*), in 16 bits using (ushort*).

- Size size of image in number of pixels ('width' and 'height').
- The max average of RGB components from decoded picture.
- 'false' is returned if decoding failed, else 'true'.

References Digikam::DRawDecoder::Private::loadFromLibraw(), and Digikam::DRawDecoder::m_decoderSettings.

◆ extractRAWData()

bool Digikam::DRawDecoder::extractRAWData ( const QString &  filePath,
QByteArray &  rawData,
DRawInfo identify,
unsigned int  shotSelect = 0 
)
inherited

Extract Raw image data undemosaiced and without post processing from 'filePath' picture file. This is a cancelable method which require a class instance to run because RAW pictures loading can take a while.

This method return:

- A byte array container 'rawData' with raw data.
- All info about Raw image into 'identify' container.
- 'false' is returned if loading failed, else 'true'.

References Digikam::DRawDecoder::Private::fillIndentifyInfo(), Digikam::DRawInfo::isDecodable, Digikam::DRawDecoder::m_cancel, Digikam::DRawDecoder::rawFiles(), Digikam::s_exifParserCallbackForLibRaw(), Digikam::s_progressCallbackForLibRaw(), and Digikam::DRawDecoder::Private::setProgress().

◆ filterAction()

FilterAction DigikamRAWDImgPlugin::DImgRAWLoader::filterAction ( ) const

◆ granularity()

◆ hasAlpha()

bool DigikamRAWDImgPlugin::DImgRAWLoader::hasAlpha ( ) const
overridevirtual

Implements Digikam::DImgLoader.

◆ hasLoadedData()

bool Digikam::DImgLoader::hasLoadedData ( ) const
virtualinherited

◆ imageBitsDepth()

◆ imageBytesDepth()

◆ imageData()

◆ imageEmbeddedText()

QMap< QString, QString > & Digikam::DImgLoader::imageEmbeddedText ( ) const
protectedinherited

◆ imageGetAttribute()

◆ imageGetEmbbededText()

QString Digikam::DImgLoader::imageGetEmbbededText ( const QString &  key) const
protectedinherited

◆ imageHasAlpha()

◆ imageHeight()

◆ imageNumBytes()

quint64 Digikam::DImgLoader::imageNumBytes ( ) const
protectedinherited

◆ imageSetAttribute()

◆ imageSetEmbbededText()

void Digikam::DImgLoader::imageSetEmbbededText ( const QString &  key,
const QString &  text 
)
protectedinherited

◆ imageSetIccProfile()

◆ imageSixteenBit()

◆ imageWidth()

◆ isRawFile()

bool Digikam::DRawDecoder::isRawFile ( const QUrl &  url)
staticinherited

◆ isReadOnly()

bool DigikamRAWDImgPlugin::DImgRAWLoader::isReadOnly ( ) const
overridevirtual

Implements Digikam::DImgLoader.

◆ librawUseGomp()

int Digikam::DRawDecoder::librawUseGomp ( )
staticinherited

Return true or false if LibRaw use parallel demosaicing or not (libgomp support). Return -1 if undefined.

Referenced by Digikam::LibsInfoDlg::LibsInfoDlg().

◆ librawVersion()

QString Digikam::DRawDecoder::librawVersion ( )
staticinherited

Return LibRaw version string.

Referenced by Digikam::LibsInfoDlg::LibsInfoDlg(), and Digikam::DRawDecoderWidget::setup().

◆ load()

◆ loadEmbeddedPreview() [1/3]

bool Digikam::DRawDecoder::loadEmbeddedPreview ( QByteArray &  imgData,
const QBuffer &  inBuffer 
)
staticinherited

Get the embedded JPEG preview image from RAW image passed in QBuffer as a QByteArray which will include Exif Data. This is fast and non cancelable. This method does not require a class instance to run.

References Digikam::DRawDecoder::Private::loadEmbeddedPreview(), and Digikam::DRawDecoder::rawFiles().

◆ loadEmbeddedPreview() [2/3]

bool Digikam::DRawDecoder::loadEmbeddedPreview ( QByteArray &  imgData,
const QString &  path 
)
staticinherited

Get the embedded JPEG preview image from RAW picture as a QByteArray which will include Exif Data. This is fast and non cancelable. This method does not require a class instance to run.

References Digikam::DRawDecoder::Private::loadEmbeddedPreview(), and Digikam::DRawDecoder::rawFiles().

Referenced by Digikam::DRawDecoder::loadEmbeddedPreview(), and Digikam::DRawDecoder::loadRawPreview().

◆ loadEmbeddedPreview() [3/3]

bool Digikam::DRawDecoder::loadEmbeddedPreview ( QImage &  image,
const QString &  path 
)
staticinherited

Get the embedded JPEG preview image from RAW picture as a QImage. This is fast and non cancelable This method does not require a class instance to run.

References Digikam::DRawDecoder::loadEmbeddedPreview().

◆ loadFullImage()

bool Digikam::DRawDecoder::loadFullImage ( QImage &  image,
const QString &  path,
const DRawDecoderSettings settings = DRawDecoderSettings() 
)
staticinherited

Get the full decoded RAW picture. This is a more slower than loadHalfPreview() method and non cancelable. This method does not require a class instance to run.

References Digikam::DRawDecoder::rawFiles(), and Digikam::DRawDecoderSettings::sixteenBitsImage.

◆ loadHalfPreview() [1/3]

bool Digikam::DRawDecoder::loadHalfPreview ( QByteArray &  imgData,
const QBuffer &  inBuffer 
)
staticinherited

Get the half decoded RAW picture passed in QBuffer as JPEG data in QByteArray. This is slower than loadEmbeddedPreview() method and non cancelable. This method does not require a class instance to run.

References Digikam::DRawDecoder::Private::loadHalfPreview(), and Digikam::DRawDecoder::rawFiles().

◆ loadHalfPreview() [2/3]

bool Digikam::DRawDecoder::loadHalfPreview ( QByteArray &  imgData,
const QString &  path 
)
staticinherited

Get the half decoded RAW picture as JPEG data in QByteArray. This is slower than loadEmbeddedPreview() method and non cancelable. This method does not require a class instance to run.

References Digikam::DRawDecoder::Private::loadHalfPreview(), and Digikam::DRawDecoder::rawFiles().

◆ loadHalfPreview() [3/3]

bool Digikam::DRawDecoder::loadHalfPreview ( QImage &  image,
const QString &  path 
)
staticinherited

Get the half decoded RAW picture. This is slower than loadEmbeddedPreview() method and non cancelable. This method does not require a class instance to run.

References Digikam::DRawDecoder::Private::loadHalfPreview(), and Digikam::DRawDecoder::rawFiles().

Referenced by Digikam::DRawDecoder::loadRawPreview().

◆ loadingFailed()

◆ loadRawPreview() [1/3]

static bool Digikam::DRawDecoder::loadRawPreview ( QByteArray &  imgData,
const QBuffer &  inBuffer 
)
staticinherited

Get the preview of RAW picture passed in QBuffer as a QByteArray holding JPEG data. It tries loadEmbeddedPreview() first and if it fails, calls loadHalfPreview().

◆ loadRawPreview() [2/3]

static bool Digikam::DRawDecoder::loadRawPreview ( QByteArray &  imgData,
const QString &  path 
)
staticinherited

Get the preview of RAW picture as a QByteArray holding JPEG data. It tries loadEmbeddedPreview() first and if it fails, calls loadHalfPreview().

◆ loadRawPreview() [3/3]

bool Digikam::DRawDecoder::loadRawPreview ( QImage &  image,
const QString &  path 
)
staticinherited

Get the preview of RAW picture as a QImage. It tries loadEmbeddedPreview() first and if it fails, calls loadHalfPreview().

References Digikam::DRawDecoder::loadEmbeddedPreview(), and Digikam::DRawDecoder::loadHalfPreview().

Referenced by Digikam::UMSCamera::getThumbnail(), and Digikam::BatchTool::loadToDImg().

◆ new_failureTolerant() [1/6]

unsigned char * Digikam::DImgLoader::new_failureTolerant ( quint64  w,
quint64  h,
uint  typesPerPixel 
)
staticinherited

◆ new_failureTolerant() [2/6]

template<typename Type >
static Type* Digikam::DImgLoader::new_failureTolerant ( quint64  w,
quint64  h,
uint  typesPerPixel 
)
staticinherited

◆ new_failureTolerant() [3/6]

template<typename Type >
Q_INLINE_TEMPLATE Type* Digikam::DImgLoader::new_failureTolerant ( quint64  w,
quint64  h,
uint  typesPerPixel 
)
inherited

Allows safe multiplication of requested pixel number and bytes per pixel, avoiding particularly 32 bits overflow and exceeding the size_t type

◆ new_failureTolerant() [4/6]

template<typename Type >
Q_INLINE_TEMPLATE Type* Digikam::DImgLoader::new_failureTolerant ( size_t  size)
inherited

◆ new_failureTolerant() [5/6]

◆ new_failureTolerant() [6/6]

template<typename Type >
static Type* Digikam::DImgLoader::new_failureTolerant ( size_t  unsecureSize)
staticinherited

◆ new_short_failureTolerant() [1/2]

unsigned short * Digikam::DImgLoader::new_short_failureTolerant ( quint64  w,
quint64  h,
uint  typesPerPixel 
)
staticinherited

◆ new_short_failureTolerant() [2/2]

unsigned short * Digikam::DImgLoader::new_short_failureTolerant ( size_t  unsecureSize)
staticinherited

◆ postProcess()

◆ purgeExifWorkingColorSpace()

void Digikam::DImgLoader::purgeExifWorkingColorSpace ( )
protectedinherited

◆ rawFileIdentify()

bool Digikam::DRawDecoder::rawFileIdentify ( DRawInfo identify,
const QString &  path 
)
staticinherited

Get the camera settings which have taken RAW file. Look into rawinfo.h for more details. This is a fast and non cancelable method which do not require a class instance to run.

References Digikam::DRawDecoder::Private::fillIndentifyInfo(), Digikam::DRawInfo::isDecodable, and Digikam::DRawDecoder::rawFiles().

Referenced by Digikam::PreviewLoadingTask::execute(), Digikam::DRawDecoder::Private::loadFromLibraw(), Digikam::DMetadata::loadUsingRawEngine(), and DigikamGenericHtmlGalleryPlugin::GalleryElementFunctor::operator()().

◆ rawFiles()

◆ rawFilesList()

QStringList Digikam::DRawDecoder::rawFilesList ( )
staticinherited

Return the list of all RAW file type mime supported, as a QStringList, without wildcard and suffix dot.

References Digikam::DRawDecoder::rawFiles().

Referenced by Digikam::ApplicationSettings::getRawFileFilter().

◆ rawFilesVersion()

int Digikam::DRawDecoder::rawFilesVersion ( )
staticinherited

Returns a version number for the list of supported RAW file types. This version is incremented if the list of supported formats has changed between library releases.

References Digikam::s_rawFileExtensionsVersion().

◆ readMetadata()

◆ save()

bool DigikamRAWDImgPlugin::DImgRAWLoader::save ( const QString &  ,
DImgLoaderObserver * const   
)
overridevirtual

Implements Digikam::DImgLoader.

◆ saveMetadata()

◆ setLoadFlags()

void Digikam::DImgLoader::setLoadFlags ( LoadFlags  flags)
inherited

◆ sixteenBit()

bool DigikamRAWDImgPlugin::DImgRAWLoader::sixteenBit ( ) const
overridevirtual

◆ storeColorProfileInMetadata()

◆ supportedCamera()

QStringList Digikam::DRawDecoder::supportedCamera ( )
staticinherited

Provide a list of supported RAW Camera name.

Referenced by Digikam::RawCameraDlg::RawCameraDlg().

Member Data Documentation

◆ m_cancel

bool Digikam::DRawDecoder::m_cancel
protectedinherited

Used internally to cancel RAW decoding operation. Normally, you don't need to use it directly, excepted if you derivated this class. Usual way is to use cancel() method

Referenced by Digikam::DRawDecoder::cancel(), Digikam::DRawDecoder::checkToCancelWaitingData(), and Digikam::DRawDecoder::extractRAWData().

◆ m_decoderSettings

DRawDecoderSettings Digikam::DRawDecoder::m_decoderSettings
protectedinherited

The settings container used to perform RAW pictures decoding. See 'drawdecodingsetting.h' for details.

Referenced by Digikam::DRawDecoder::decodeHalfRAWImage(), Digikam::DRawDecoder::decodeRAWImage(), DImgRAWLoader(), load(), and sixteenBit().

◆ m_image

◆ m_loadFlags


The documentation for this class was generated from the following files: