digiKam
imageiface.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2004-02-14
7  * Description : image data interface for image tools
8  *
9  * Copyright (C) 2004-2005 by Renchi Raju <renchi dot raju at gmail dot com>
10  * Copyright (C) 2004-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_IMAGE_IFACE_H
26 #define DIGIKAM_IMAGE_IFACE_H
27 
28 // Qt includes
29 
30 #include <QString>
31 #include <QPixmap>
32 
33 // Local includes
34 
35 #include "dimg.h"
36 #include "dcolor.h"
37 #include "filteraction.h"
38 #include "photoinfocontainer.h"
39 #include "digikam_export.h"
40 
41 class QPaintDevice;
42 
43 namespace Digikam
44 {
45 
46 class DIGIKAM_EXPORT ImageIface
47 {
48 
49 public:
50 
52  {
54  ImageSelection
55  };
56 
57 public:
58 
62  explicit ImageIface(const QSize& size = QSize(0, 0));
63  ~ImageIface();
64 
69  void setPreviewType(PreviewType type = FullImage);
70 
75  DImg setPreviewSize(const QSize& size) const;
76 
80  QSize previewSize() const;
81  bool previewHasAlpha() const;
82  bool previewSixteenBit() const;
83  PreviewType previewType() const;
84 
89  DImg* previewReference();
90 
94  DImg preview() const;
95 
99  QRect selectionRect() const;
100 
104  DImg selection() const;
105 
109  void crop(const QRect& region);
110 
115  DColor colorInfoFromOriginal(const QPoint& point) const;
116  DColor colorInfoFromPreview(const QPoint& point) const;
117  DColor colorInfoFromTargetPreview(const QPoint& point) const;
118 
122  QSize originalSize() const;
123  bool originalHasAlpha() const;
124  bool originalSixteenBit() const;
125 
129  IccProfile originalIccProfile() const;
130  PhotoInfoContainer originalPhotoInfo() const;
131  MetaEngineData originalMetadata() const;
132  void setOriginalMetadata(const MetaEngineData& meta);
133 
138  DImg* original() const;
139 
143  void convertOriginalColorDepth(int depth);
144 
149  QPixmap convertToPixmap(const DImg& img) const;
150 
156  void paint(QPaintDevice* const device, const QRect& rect, QPainter* const painter = nullptr);
157 
161  void setOriginalIccProfile(const IccProfile& profile);
162 
166  void setPreviewIccProfile(const IccProfile& profile);
167 
175  void setSelection(const QString& caller, const FilterAction& action, const DImg& img);
176 
185  void setPreview(const DImg& img);
186 
194  void setOriginal(const QString& caller, const FilterAction& action, const DImg& img);
195 
196 private:
197 
198  // Disable
199  ImageIface(const ImageIface&) = delete;
200  ImageIface& operator=(const ImageIface&) = delete;
201 
202 private:
203 
204  class Private;
205  Private* const d;
206 };
207 
208 } // namespace Digikam
209 
210 #endif // DIGIKAM_IMAGE_IFACE_H
Definition: dcolor.h:43
Definition: dimg.h:62
Definition: filteraction.h:43
Definition: iccprofile.h:43
Definition: imageiface.h:47
PreviewType
Definition: imageiface.h:52
@ FullImage
Preview will be rendered using full image.
Definition: imageiface.h:53
Definition: metaengine_data.h:41
Definition: photoinfocontainer.h:41
Definition: datefolderview.cpp:43