From 5a5d4311b10f7bd60b9b51bec6a6837835db747e Mon Sep 17 00:00:00 2001 From: tastytea Date: Fri, 28 Dec 2018 02:03:27 +0100 Subject: [PATCH] 2018-12-28 --- docs/annotated.html | 2 +- docs/classIdenticonpp-members.html | 2 +- docs/classIdenticonpp.html | 56 +++++++++++++++---- docs/classes.html | 2 +- docs/debug_8hpp_source.html | 2 +- .../dir_68267d1309a1af8e8297ef4c3efbcdba.html | 2 +- docs/files.html | 2 +- docs/functions.html | 2 +- docs/functions_enum.html | 2 +- docs/functions_func.html | 2 +- docs/identiconpp_8hpp_source.html | 11 ++-- docs/index.html | 27 +++++++-- 12 files changed, 85 insertions(+), 27 deletions(-) diff --git a/docs/annotated.html b/docs/annotated.html index 32d88c3..253417d 100644 --- a/docs/annotated.html +++ b/docs/annotated.html @@ -19,7 +19,7 @@
identiconpp -  0.3.1 +  0.3.4
diff --git a/docs/classIdenticonpp-members.html b/docs/classIdenticonpp-members.html index 69cc9e7..fc077fe 100644 --- a/docs/classIdenticonpp-members.html +++ b/docs/classIdenticonpp-members.html @@ -19,7 +19,7 @@
identiconpp -  0.3.1 +  0.3.4
diff --git a/docs/classIdenticonpp.html b/docs/classIdenticonpp.html index 604b9c7..6a24418 100644 --- a/docs/classIdenticonpp.html +++ b/docs/classIdenticonpp.html @@ -19,7 +19,7 @@
identiconpp -  0.3.1 +  0.3.4
@@ -55,16 +55,16 @@ $(function() { - - +

Public Types

enum  algorithm { ltr_symmetric, -ltr_asymmetric, -sigil +
enum  algorithm { algorithm::ltr_symmetric, +algorithm::ltr_asymmetric, +algorithm::sigil }
 List of identicon algorithms.
 List of identicon algorithms. More...
 
- + @@ -74,7 +74,40 @@ Public Member Functions

Detailed Description

Base class for identiconpp.

Use this class for all your identicons. Exceptions will be thrown on error.

-

Constructor & Destructor Documentation

+

Member Enumeration Documentation

+ +

◆ algorithm

+ +
+
+

Public Member Functions

 Identiconpp (const uint8_t columns, const uint8_t rows, algorithm type=algorithm::ltr_symmetric, const string &background="ffffffff", const vector< string > &foreground={ "000000ff" }, const array< const uint8_t, 2 > &padding={ 0, 0 })
 Identiconpp (const uint8_t columns, const uint8_t rows, algorithm type=algorithm::ltr_symmetric, const string &background="ffffffff", const vector< string > &foreground={ "000000ff" }, const array< const uint8_t, 2 > &padding={ 0, 0 })
 Initialises an instance of Identiconpp. More...
 
Magick::Image generate (const string &digest, const uint16_t width=100)
+ + + + +
+ + + + +
enum Identiconpp::algorithm
+
+strong
+
+ +

List of identicon algorithms.

+ + + + +
Enumerator
ltr_symmetric 

Generates symmetric (vertically mirrored) identicons.

+
ltr_asymmetric 

Generates asymmetric identicons.

+
sigil 

Generates the same results as sigil and pydenticon.

+
+
42  {
44  ltr_symmetric,
46  ltr_asymmetric,
52  sigil
53  };
+
+ +

Constructor & Destructor Documentation

◆ Identiconpp()

@@ -100,7 +133,7 @@ Public Member Functions algorithm  - type = algorithm::ltr_symmetric, + type = algorithm::ltr_symmetric, @@ -146,7 +179,7 @@ Public Member Functions -
28 : _rows(rows)
29 , _columns(columns)
30 , _type(type)
31 , _background(background)
32 , _foreground(foreground)
33 , _padding(padding)
34 {
35  check_color(background);
36 
37  for (const string &color : foreground)
38  {
39  check_color(color);
40  }
41 }
+
29 : _rows(rows)
30 , _columns(columns)
31 , _type(type)
32 , _background(background)
33 , _foreground(foreground)
34 , _padding(padding)
35 {
36  check_color(background);
37 
38  for (const string &color : foreground)
39  {
40  check_color(color);
41  }
42 }

Member Function Documentation

@@ -185,7 +218,10 @@ Public Member Functions
Returns
The image as Magick::Image
-
44 {
45  ttdebug << "Using digest: " << digest << '\n';
46  check_entropy(digest, _type);
47  const uint16_t imgwidth = width - _padding[0] * 2;
48  const uint16_t imgheight = imgwidth / _columns * _rows;
49  ttdebug << "width: " << std::to_string(imgwidth + _padding[0] * 2)
50  << ", height: " << std::to_string(imgheight + _padding[1] * 2)
51  << "\n";
52  Magick::Image img;
53 
54  switch (_type)
55  {
56  case algorithm::ltr_symmetric:
57  {
58  img = generate_ltr_symmetric(digest);
59  break;
60  }
61  case algorithm::ltr_asymmetric:
62  {
63  img = generate_ltr_asymmetric(digest);
64  break;
65  }
66  case algorithm::sigil:
67  {
68  img = generate_sigil(digest);
69  break;
70  }
71  }
72 
73  img.backgroundColor(Magick::Color('#' + _background));
74  img.scale(Magick::Geometry(imgwidth, imgheight));
75  img.borderColor(Magick::Color('#' + _background));
76  img.border(Magick::Geometry(_padding[0], _padding[1]));
77  return img;
78 }
+
45 {
46  ttdebug << "Using digest: " << digest << '\n';
47  check_entropy(digest, _type);
48  const std::int16_t imgwidth = width - _padding[0] * 2;
49  const std::int16_t imgheight =
50  std::round(static_cast<float>(imgwidth) / _columns * _rows);
51  ttdebug << "width: " << std::to_string(imgwidth)
52  << "+" << std::to_string(_padding[0] * 2)
53  << ", height: " << std::to_string(imgheight)
54  << "+" << std::to_string(_padding[1] * 2)
55  << "\n";
56  if (imgwidth <= 0 || imgheight <= 0)
57  {
58  throw std::invalid_argument("Width or height is zero or less.");
59  }
60  Magick::Image img;
61 
62  switch (_type)
63  {
65  {
66  img = generate_ltr_symmetric(digest);
67  break;
68  }
70  {
71  img = generate_ltr_asymmetric(digest);
72  break;
73  }
74  case algorithm::sigil:
75  {
76  img = generate_sigil(digest);
77  break;
78  }
79  }
80 
81  img.backgroundColor(Magick::Color('#' + _background));
82  img.scale(Magick::Geometry(imgwidth, imgheight));
83  img.borderColor(Magick::Color('#' + _background));
84  img.border(Magick::Geometry(_padding[0], _padding[1]));
85  return img;
86 }
Generates symmetric (vertically mirrored) identicons.
+ +
Generates asymmetric identicons.
+

The documentation for this class was generated from the following files:
0111 0011 1101 1100 […] 1111 0111 0101 0111
^ ^
+----------------------------+-------------->
| |
pixel matrix foreground color

Implemented in ltr_asymmetric.cpp