PxCrypt v0.2.2
Encrypt data within an image
Loading...
Searching...
No Matches
meta_access.h
1#ifndef META_ACCESS_H
2#define META_ACCESS_H
3
4// Project Includes
5#include "medium_io/traverse/canvas_traverser_prime.h"
6
7namespace PxCryptPrivate
8{
9
10class MetaRef
11{
12 friend class MetaAccess;
13//-Alias------------------------------------------------------------------------------------------------------
14private:
15 using ChannelRef = quint8*;
16 using DisectedPixelRef = std::array<ChannelRef, 3>;
17
18//-Instance Variables------------------------------------------------------------------------------------------------------
19private:
20 DisectedPixelRef mPixelRef;
21
22//-Constructor---------------------------------------------------------------------------------------------------------
23private:
24 MetaRef(const DisectedPixelRef& pixelRef);
25
26//-Operators----------------------------------------------------------------------------------------------
27public:
28 quint8 operator*() const;
29 void operator=(quint8 value);
30};
31
32class MetaAccess
33{
34//-Class Variables------------------------------------------------------------------------------------------------------
35private:
36 static const int META_PIXEL_COUNT = 2; // BPC + EncType
37
38//-Instance Variables------------------------------------------------------------------------------------------------------
39private:
40 CanvasTraverserPrime mTraverser;
41 QRgb* mPixels;
42 MetaRef mBpcRef;
43 quint8 mBpcCache;
44 MetaRef mEncRef;
45 quint8 mEncCache;
46
47//-Constructor---------------------------------------------------------------------------------------------------------
48public:
49 MetaAccess(QImage& image, const QByteArray& psk);
50
51//-Class Functions----------------------------------------------------------------------------------------------
52private:
53 static quint8& channelRef(QRgb& pixel, Channel ch);
54
55public:
56 static int metaPixelCount();
57
58//-Instance Functions----------------------------------------------------------------------------------------------
59private:
60 QRgb& currentPixelRef();
61 quint8& currentChannelRef();
62 quint8& ncr(); // Get next channel reference
63
64public:
65 void setBpc(quint8 bpc);
66 void setEnc(quint8 enc);
67 quint8 bpc() const;
68 quint8 enc() const;
69
70 CanvasTraverserPrime& surrenderTraverser();
71};
72
73
74
75}
76
77#endif // META_ACCESS_H