26 #ifndef DIGIKAM_DIMG_H
27 #define DIGIKAM_DIMG_H
31 #include <QExplicitlySharedDataPointer>
55 class ExposureSettingsContainer;
59 class DImgLoaderObserver;
99 COLORMODELUNKNOWN = 0,
115 static FORMAT fileFormat(
const QString& filePath);
117 static QString formatToMimeType(FORMAT frm);
152 explicit DImg(
const QImage& image);
161 DImg(uint width, uint height,
bool sixteenBit,
bool alpha =
false, uchar*
const data =
nullptr,
bool copyData =
true);
192 void putImageData(uint width, uint height,
bool sixteenBit,
bool alpha, uchar*
const data,
bool copyData =
true);
201 void putImageData(uchar*
const data,
bool copyData =
true);
211 void resetMetaData();
217 uchar* stripImageData();
222 bool load(
const QString& filePath,
223 bool loadMetadata,
bool loadICCData,
bool loadUniqueHash,
bool loadHistory,
230 bool save(
const QString& filePath, FORMAT frm,
DImgLoaderObserver*
const observer =
nullptr);
231 bool save(
const QString& filePath,
const QString& format,
DImgLoaderObserver*
const observer =
nullptr);
240 void imageSavedAs(
const QString& savePath);
247 bool loadItemInfo(
const QString& filePath,
bool loadMetadata =
true,
248 bool loadICCData =
true,
bool loadUniqueHash =
true,
249 bool loadImageHistory =
true);
255 uchar* copyBits()
const;
257 uchar* scanLine(uint i)
const;
258 bool hasAlpha()
const;
260 quint64 numBytes()
const;
261 quint64 numPixels()
const;
266 int bytesDepth()
const;
271 int bitsDepth()
const;
277 QString originalFilePath()
const;
284 QString lastSavedFilePath()
const;
295 int originalBitDepth()
const;
300 QSize originalSize()
const;
306 QSize originalRatioSize()
const;
317 FORMAT detectedFormat()
const;
325 QString format()
const;
334 QString savedFormat()
const;
348 DColor getPixelColor(uint x, uint y)
const;
349 void setPixelColor(uint x, uint y,
const DColor& color);
350 void prepareSubPixelAccess();
351 DColor getSubPixelColor(
float x,
float y)
const;
352 DColor getSubPixelColorFast(
float x,
float y)
const;
360 bool hasTransparentPixels()
const;
368 bool isReadOnly()
const;
376 void setIccProfile(
const IccProfile& profile);
378 void setAttribute(
const QString& key,
const QVariant&
value);
379 QVariant attribute(
const QString& key)
const;
380 bool hasAttribute(
const QString& key)
const;
381 void removeAttribute(
const QString& key);
383 void setEmbeddedText(
const QString& key,
const QString& text);
389 bool hasImageHistory()
const;
401 void setHistoryBranchAfter(
const DImageHistory& historyBeforeBranch,
bool isBranch =
true);
402 void setHistoryBranchForLastSteps(
int numberOfLastHistorySteps,
bool isBranch =
true);
403 void setHistoryBranch(
bool isBranch =
true);
424 RemoveOldMetadataPreviews = 1 << 0,
428 CreateNewMetadataPreview = 1 << 1,
433 ResetExifOrientationTag = 1 << 2,
438 CreateNewImageHistoryUUID = 1 << 3,
440 PrepareMetadataFlagsAll = RemoveOldMetadataPreviews |
441 CreateNewMetadataPreview |
442 ResetExifOrientationTag |
443 CreateNewImageHistoryUUID
445 Q_DECLARE_FLAGS(PrepareMetadataFlags, PrepareMetadataFlag)
447 void prepareMetadataToSave(
const QString& intendedDestPath,
448 const QString& destMimeType,
449 const QString& originalFileName = QString(),
450 PrepareMetadataFlags flags = PrepareMetadataFlagsAll);
456 void prepareMetadataToSave(
const QString& intendedDestPath,
457 const QString& destMimeType,
458 bool resetExifOrientationTag);
479 void insertAsReferredImage(
int afterHistoryStep,
const HistoryImageId& otherImagesId);
486 void addCurrentUniqueImageId(
const QString& uuid);
492 int exifOrientation(
const QString& filePath);
511 QVariant fileOriginData()
const;
512 void setFileOriginData(
const QVariant& data);
513 QVariant lastSavedFileOriginData()
const;
514 void switchOriginToLastSaved();
524 DImg copyImageData()
const;
532 DImg copyMetaData()
const;
537 DImg copy(
const QRect& rect)
const;
538 DImg copy(
const QRectF& relativeRect)
const;
539 DImg copy(
int x,
int y,
int w,
int h)
const;
550 void bitBltImage(
const DImg*
const src,
int dx,
int dy);
551 void bitBltImage(
const DImg*
const src,
int sx,
int sy,
int dx,
int dy);
552 void bitBltImage(
const DImg*
const src,
int sx,
int sy,
int w,
int h,
int dx,
int dy);
553 void bitBltImage(
const uchar*
const src,
int sx,
int sy,
int w,
int h,
int dx,
int dy,
554 uint swidth, uint sheight,
int sdepth);
562 int sx,
int sy,
int w,
int h,
int dx,
int dy,
572 int x,
int y,
int w,
int h,
575 void bitBlendImageOnColor(
const DColor& color,
int x,
int y,
int w,
int h);
576 void bitBlendImageOnColor(
const DColor& color);
581 QImage copyQImage()
const;
582 QImage copyQImage(
const QRect& rect)
const;
583 QImage copyQImage(
const QRectF& relativeRect)
const;
584 QImage copyQImage(
int x,
int y,
int w,
int h)
const;
589 void crop(
const QRect& rect);
590 void crop(
int x,
int y,
int w,
int h);
595 void resize(
int w,
int h);
604 void removeAlphaChannel(
const DColor& destColor);
605 void removeAlphaChannel();
611 DImg smoothScale(
int width,
int height, Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio)
const;
612 DImg smoothScale(
const QSize& destSize, Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio)
const;
623 DImg smoothScaleClipped(
int width,
int height,
int clipx,
int clipy,
int clipwidth,
int clipheight)
const;
624 DImg smoothScaleClipped(
const QSize& destSize,
const QRect& clip)
const;
630 DImg smoothScaleSection(
int sx,
int sy,
int sw,
int sh,
int dw,
int dh)
const;
631 DImg smoothScaleSection(
const QRect& sourceRect,
const QSize& destSize)
const;
633 void rotate(ANGLE angle);
634 void flip(FLIP direction);
642 bool rotateAndFlip(
int orientation);
647 bool reverseRotateAndFlip(
int orientation);
656 bool wasExifRotated();
657 bool exifRotate(
const QString& filePath);
662 bool reverseExifRotate(
const QString& filePath);
667 int orientation()
const;
673 bool transform(
int transformAction);
675 QPixmap convertToPixmap()
const;
676 QPixmap convertToPixmap(
IccTransform& monitorICCtrans)
const;
689 void convertDepth(
int depth);
694 void convertToSixteenBit();
695 void convertToEightBit();
696 void convertToDepthOfImage(
const DImg*
const otherImage);
702 void fill(
const DColor& color);
722 QByteArray getUniqueHash();
723 static QByteArray getUniqueHash(
const QString& filePath);
738 QByteArray getUniqueHashV2();
739 static QByteArray getUniqueHashV2(
const QString& filePath);
749 QByteArray createImageUniqueId();
754 static QString colorModelToString(COLORMODEL colorModel);
759 static bool isAnimatedImage(
const QString& filePath);
763 DImg(
const DImg& image, uint w, uint h);
765 void copyMetaData(
const QExplicitlySharedDataPointer<Private>& src);
766 void copyImageData(
const QExplicitlySharedDataPointer<Private>& src);
767 void setImageData(
bool null, uint width, uint height,
bool sixteenBit,
bool alpha);
768 void setImageDimension(uint width, uint height);
769 size_t allocateData()
const;
771 bool clipped(
int& x,
int& y,
int& w,
int& h, uint width, uint height)
const;
773 QDateTime creationDateFromFilesystem(
const QFileInfo& fileInfo)
const;
775 static QByteArray createUniqueHash(
const QString& filePath,
const QByteArray& ba);
776 static QByteArray createUniqueHashV2(
const QString& filePath);
778 void bitBlt(
const uchar*
const src, uchar*
const dest,
779 int sx,
int sy,
int w,
int h,
int dx,
int dy,
780 uint swidth, uint sheight, uint dwidth, uint dheight,
781 bool sixteenBit,
int sdepth,
int ddepth);
782 void bitBlend(
DColorComposer*
const composer, uchar*
const src, uchar*
const dest,
783 int sx,
int sy,
int w,
int h,
int dx,
int dy,
784 uint swidth, uint sheight, uint dwidth, uint dheight,
785 bool sixteenBit,
int sdepth,
int ddepth,
788 uchar* data,
int x,
int y,
int w,
int h,
789 uint width, uint height,
bool sixteenBit,
int depth,
791 bool normalizeRegionArguments(
int& sx,
int& sy,
int& w,
int& h,
int& dx,
int& dy,
792 uint swidth, uint sheight, uint dwidth, uint dheight)
const;
796 QExplicitlySharedDataPointer<Private> m_priv;
803 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::DImg::PrepareMetadataFlags)
Definition: dcolorcomposer.h:36
MultiplicationFlags
Definition: dcolorcomposer.h:87
@ NoMultiplication
Definition: dcolorcomposer.h:88
Definition: dimagehistory.h:49
Definition: dimgloaderobserver.h:41
Definition: dimgloader.h:51
COLORMODEL
Definition: dimg.h:98
@ YCBCR
Definition: dimg.h:104
@ CMYK
Definition: dimg.h:105
@ INDEXED
Definition: dimg.h:103
@ MONOCHROME
Definition: dimg.h:102
@ CIELAB
Definition: dimg.h:106
@ GRAYSCALE
Definition: dimg.h:101
@ RGB
Definition: dimg.h:100
ANGLE
Definition: dimg.h:84
@ ROT180
Definition: dimg.h:86
@ ROT270
Definition: dimg.h:87
QString embeddedText(const QString &key) const
PrepareMetadataFlag
Definition: dimg.h:419
FORMAT
Definition: dimg.h:66
@ TIFF
Definition: dimg.h:74
@ PNG
Definition: dimg.h:73
@ JP2K
Definition: dimg.h:75
@ RAW
Definition: dimg.h:79
@ JPEG
Definition: dimg.h:72
@ HEIF
Definition: dimg.h:77
@ PGF
Definition: dimg.h:76
FLIP
Definition: dimg.h:92
Definition: drawdecoding.h:48
Definition: exposurecontainer.h:39
Definition: filteraction.h:43
Definition: historyimageid.h:42
Type
Definition: historyimageid.h:46
@ Intermediate
Definition: historyimageid.h:58
Definition: iccprofile.h:43
qulonglong value
Definition: itemviewutilities.cpp:592
@ NONE
Definition: dngconverteractions.h:44
Definition: datefolderview.cpp:43
bool operator==(const SearchTextSettings &a, const SearchTextSettings &b)
Definition: searchtextbar.cpp:49