-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathColorSwatch.h
56 lines (45 loc) · 1.57 KB
/
ColorSwatch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include <QString>
#include <QImage>
#include <iostream>
class ImagePlugin;
class ColorSwatch
{
public:
ColorSwatch(ImagePlugin* imgPlg);
virtual ~ColorSwatch();
public:
typedef QVector<double> GraphData1D;
typedef QPair<GraphData1D,GraphData1D> GraphData2D;
enum class DATA {REF, R, G, B, A};
public:
/// return true or otherwise false and may throw an exception
/// some predefined parameters/options are loaded here
bool loadSettings(QString iniFile);
/// return true or otherwise false and may throw an exception
/// it not only load the image mask filename but also try to
/// apply (overlay) it/on the raw image to get filled mask
bool loadImages();
/// when mask image loaded, try to extract patches samples (pixel origin, pixels content, channels averages)
/// from defined (or autodetected background) and fill colorSwatchPatch data structure
/// (averages are only used to get the right patches order but since it is computed by Qt, we don't fill it into colorSwatchPatch)
bool fillPatchesPixelsFromMask();
///
GraphData2D getGraphData(DATA datalist);
public:
QString rawFilePathName() const;
bool haveImage() const;
bool haveMask() const;
QImage getMaskImg() const;
QImage getQImage() const;
QString printPatchesInfo() const;
QString printMaskInfo() const;
public:
friend std::ostream& operator<<(std::ostream& stream, const ColorSwatch &colorSwatch);
protected:
// save/write image mask converted to ARGB32 to help see what happened
void writeImage2QImage(); // for debug purpose only
private:
class Private;
Private* d;
};