25 #ifndef DIGIKAM_DIMG_LOADER_H
26 #define DIGIKAM_DIMG_LOADER_H
47 class DImgLoaderObserver;
67 LoadImageHistory = 32,
75 LoadAll = LoadItemInfo | LoadMetadata | LoadICCData | LoadImageData | LoadUniqueHash | LoadImageHistory
77 Q_DECLARE_FLAGS(LoadFlags, LoadFlag)
81 void setLoadFlags(LoadFlags flags);
88 virtual bool hasLoadedData()
const;
93 static unsigned char* new_failureTolerant(
size_t unsecureSize);
94 static unsigned char* new_failureTolerant(quint64 w, quint64 h, uint typesPerPixel);
95 static unsigned short* new_short_failureTolerant(
size_t unsecureSize);
96 static unsigned short* new_short_failureTolerant(quint64 w, quint64 h, uint typesPerPixel);
103 static qint64 checkAllocation(qint64 fullSize);
112 unsigned char*& imageData();
113 unsigned int& imageWidth();
114 unsigned int& imageHeight();
116 bool imageHasAlpha()
const;
117 bool imageSixteenBit()
const;
119 quint64 imageNumBytes()
const;
120 int imageBitsDepth()
const;
121 int imageBytesDepth()
const;
123 void imageSetIccProfile(
const IccProfile& profile);
124 QVariant imageGetAttribute(
const QString& key)
const;
125 void imageSetAttribute(
const QString& key,
126 const QVariant&
value);
128 QMap<QString, QString>& imageEmbeddedText()
const;
129 QString imageGetEmbbededText(
const QString& key)
const;
130 void imageSetEmbbededText(
const QString& key,
131 const QString& text);
133 void loadingFailed();
134 bool checkExifWorkingColorSpace()
const;
135 void purgeExifWorkingColorSpace();
136 void storeColorProfileInMetadata();
138 virtual bool readMetadata(
const QString& filePath);
139 virtual bool saveMetadata(
const QString& filePath);
140 virtual int granularity(
DImgLoaderObserver*
const observer,
int total,
float progressSlice = 1.0F);
163 template <
typename Type>
166 quint64 requested = w * h * (quint64)typesPerPixel;
168 if (requested >= std::numeric_limits<size_t>::max())
170 qCCritical(DIGIKAM_DIMG_LOG) <<
"Requested memory of" << requested * quint64(
sizeof(
Type))
171 <<
"is larger than size_t supported by platform.";
175 return new_failureTolerant<Type>(requested);
178 template <
typename Type>
202 Type*
const reserved =
new (std::nothrow)
Type[size];
206 qCCritical(DIGIKAM_DIMG_LOG) <<
"Failed to allocate chunk of memory of size" << size;
212 Q_DECLARE_OPERATORS_FOR_FLAGS(DImgLoader::LoadFlags)
Definition: dimgloaderobserver.h:41
Definition: dimgloader.h:51
virtual bool hasAlpha() const =0
DImg * m_image
Definition: dimgloader.h:144
static unsigned char * new_failureTolerant(size_t unsecureSize)
Definition: dimgloader.cpp:282
LoadFlag
Definition: dimgloader.h:58
virtual bool isReadOnly() const =0
LoadFlags m_loadFlags
Definition: dimgloader.h:145
virtual bool save(const QString &filePath, DImgLoaderObserver *const observer)=0
static qint64 checkAllocation(qint64 fullSize)
Definition: dimgloader.cpp:168
virtual bool load(const QString &filePath, DImgLoaderObserver *const observer)=0
virtual bool sixteenBit() const =0
static Type * new_failureTolerant(size_t unsecureSize)
static Type * new_failureTolerant(quint64 w, quint64 h, uint typesPerPixel)
Definition: iccprofile.h:43
qulonglong value
Definition: itemviewutilities.cpp:592
Definition: datefolderview.cpp:43
Type
Definition: gpsitemcontainer.h:45