identiconpp/docs/identiconpp_8hpp_source.html

90 lines
19 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>identiconpp: src/identiconpp.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">identiconpp
&#160;<span id="projectnumber">0.6.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">identiconpp.hpp</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">/* This file is part of identiconpp.</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment"> * Copyright © 2018, 2019 tastytea &lt;tastytea@tastytea.de&gt;</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment"> * This program is free software: you can redistribute it and/or modify</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment"> * it under the terms of the GNU General Public License as published by</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment"> * the Free Software Foundation, version 3.</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment"> * This program is distributed in the hope that it will be useful,</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment"> * GNU General Public License for more details.</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="comment"> * You should have received a copy of the GNU General Public License</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment"> * along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;</div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="preprocessor">#ifndef IDENTICONPP_HPP</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="preprocessor">#define IDENTICONPP_HPP</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;</div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="preprocessor">#include &lt;cstdint&gt;</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="preprocessor">#include &lt;array&gt;</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="preprocessor">#include &lt;Magick++/Image.h&gt;</span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;<span class="keyword">using</span> std::uint8_t;</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;<span class="keyword">using</span> std::uint16_t;</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;<span class="keyword">using</span> std::string;</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;<span class="keyword">using</span> std::vector;</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;<span class="keyword">using</span> std::array;</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;</div><div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="classIdenticonpp.html"> 42</a></span>&#160;<span class="keyword">class </span><a class="code" href="classIdenticonpp.html">Identiconpp</a></div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160;{</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; <span class="keyword">friend</span> <span class="keyword">class </span>Testiconpp;</div><div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="classIdenticonpp.html#a229201bc23b0fabbcca60f2fe0188fa9"> 49</a></span>&#160; <span class="keyword">enum class</span> <a class="code" href="classIdenticonpp.html#a229201bc23b0fabbcca60f2fe0188fa9">algorithm</a></div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; {</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; <a class="code" href="classIdenticonpp.html#a229201bc23b0fabbcca60f2fe0188fa9a3803de5c180cbcb6285620787a2fd570">ltr_symmetric</a>,</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; <a class="code" href="classIdenticonpp.html#a229201bc23b0fabbcca60f2fe0188fa9acb50e01673547636f601739748b664b0">ltr_asymmetric</a>,</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; <a class="code" href="classIdenticonpp.html#a229201bc23b0fabbcca60f2fe0188fa9a3862d335e66bc7111aadbff6ad079bf5">sigil</a></div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; };</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160;</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; <span class="keyword">explicit</span> <a class="code" href="classIdenticonpp.html#a55a4890677c963f24b89bd2aef906f1b">Identiconpp</a>(<span class="keyword">const</span> uint8_t columns, <span class="keyword">const</span> uint8_t rows,</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; <a class="code" href="classIdenticonpp.html#a229201bc23b0fabbcca60f2fe0188fa9">algorithm</a> type = <a class="code" href="classIdenticonpp.html#a229201bc23b0fabbcca60f2fe0188fa9a3803de5c180cbcb6285620787a2fd570">algorithm::ltr_symmetric</a>,</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160; <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;background = <span class="stringliteral">&quot;ffffffff&quot;</span>,</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; <span class="keyword">const</span> vector&lt;string&gt; &amp;foreground = { <span class="stringliteral">&quot;000000ff&quot;</span> },</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; <span class="keyword">const</span> array&lt;uint8_t, 2&gt; &amp;padding = { 0, 0 });</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160;</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; Magick::Image <a class="code" href="classIdenticonpp.html#a82f624d713e2d32d5fdb26b9112b821a">generate</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;digest, <span class="keyword">const</span> uint16_t width = 100);</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160;</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; <span class="keyword">const</span> <span class="keywordtype">string</span> <a class="code" href="classIdenticonpp.html#ac4c9752b03d6e0a7c7950aee0637a82b">generate_base64</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;magick, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;digest,</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; <span class="keyword">const</span> uint16_t width = 100);</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160;</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; <span class="keyword">const</span> uint8_t _rows;</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; <span class="keyword">const</span> uint8_t _columns;</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; <span class="keyword">const</span> <a class="code" href="classIdenticonpp.html#a229201bc23b0fabbcca60f2fe0188fa9">algorithm</a> _type;</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; <span class="keyword">const</span> <span class="keywordtype">string</span> _background;</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; <span class="keyword">const</span> vector&lt;string&gt; _foreground;</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; <span class="keyword">const</span> array&lt;uint8_t, 2&gt; _padding;</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160;</div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160; Magick::Image generate_ltr_symmetric(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;digest);</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160;</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; Magick::Image generate_ltr_asymmetric(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;digest);</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160;</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160; Magick::Image generate_sigil(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;digest);</div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160;</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; <span class="keywordtype">void</span> check_entropy(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;digest, <a class="code" href="classIdenticonpp.html#a229201bc23b0fabbcca60f2fe0188fa9">algorithm</a> type);</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160;</div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; <span class="keywordtype">bool</span> get_bit(<span class="keyword">const</span> uint16_t bit, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;digest);</div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160;</div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160; Magick::Color get_color(<span class="keyword">const</span> uint16_t firstbit, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;digest);</div><div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160;</div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; <span class="keyword">static</span> <span class="keywordtype">bool</span> not_hex(<span class="keyword">const</span> <span class="keywordtype">char</span> c);</div><div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160;</div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160; <span class="keywordtype">void</span> check_color(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;color);</div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160;};</div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160;</div><div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160;<span class="preprocessor">#endif // IDENTICONPP_HPP</span></div><div class="ttc" id="classIdenticonpp_html_a229201bc23b0fabbcca60f2fe0188fa9"><div class="ttname"><a href="classIdenticonpp.html#a229201bc23b0fabbcca60f2fe0188fa9">Identiconpp::algorithm</a></div><div class="ttdeci">algorithm</div><div class="ttdoc">List of identicon algorithms. </div><div class="ttdef"><b>Definition:</b> identiconpp.hpp:49</div></div>
<div class="ttc" id="classIdenticonpp_html_a82f624d713e2d32d5fdb26b9112b821a"><div class="ttname"><a href="classIdenticonpp.html#a82f624d713e2d32d5fdb26b9112b821a">Identiconpp::generate</a></div><div class="ttdeci">Magick::Image generate(const string &amp;digest, const uint16_t width=100)</div><div class="ttdoc">Generates identicon from digest. </div><div class="ttdef"><b>Definition:</b> identiconpp.cpp:53</div></div>
<div class="ttc" id="classIdenticonpp_html"><div class="ttname"><a href="classIdenticonpp.html">Identiconpp</a></div><div class="ttdoc">Base class for identiconpp. </div><div class="ttdef"><b>Definition:</b> identiconpp.hpp:42</div></div>
<div class="ttc" id="classIdenticonpp_html_a229201bc23b0fabbcca60f2fe0188fa9a3803de5c180cbcb6285620787a2fd570"><div class="ttname"><a href="classIdenticonpp.html#a229201bc23b0fabbcca60f2fe0188fa9a3803de5c180cbcb6285620787a2fd570">Identiconpp::algorithm::ltr_symmetric</a></div><div class="ttdoc">Generates symmetric (vertically mirrored) identicons. </div></div>
<div class="ttc" id="classIdenticonpp_html_a229201bc23b0fabbcca60f2fe0188fa9a3862d335e66bc7111aadbff6ad079bf5"><div class="ttname"><a href="classIdenticonpp.html#a229201bc23b0fabbcca60f2fe0188fa9a3862d335e66bc7111aadbff6ad079bf5">Identiconpp::algorithm::sigil</a></div></div>
<div class="ttc" id="classIdenticonpp_html_a55a4890677c963f24b89bd2aef906f1b"><div class="ttname"><a href="classIdenticonpp.html#a55a4890677c963f24b89bd2aef906f1b">Identiconpp::Identiconpp</a></div><div class="ttdeci">Identiconpp(const uint8_t columns, const uint8_t rows, algorithm type=algorithm::ltr_symmetric, const string &amp;background=&quot;ffffffff&quot;, const vector&lt; string &gt; &amp;foreground={ &quot;000000ff&quot; }, const array&lt; uint8_t, 2 &gt; &amp;padding={ 0, 0 })</div><div class="ttdoc">Initialises an instance of Identiconpp. </div><div class="ttdef"><b>Definition:</b> identiconpp.cpp:25</div></div>
<div class="ttc" id="classIdenticonpp_html_a229201bc23b0fabbcca60f2fe0188fa9acb50e01673547636f601739748b664b0"><div class="ttname"><a href="classIdenticonpp.html#a229201bc23b0fabbcca60f2fe0188fa9acb50e01673547636f601739748b664b0">Identiconpp::algorithm::ltr_asymmetric</a></div><div class="ttdoc">Generates asymmetric identicons. </div></div>
<div class="ttc" id="classIdenticonpp_html_ac4c9752b03d6e0a7c7950aee0637a82b"><div class="ttname"><a href="classIdenticonpp.html#ac4c9752b03d6e0a7c7950aee0637a82b">Identiconpp::generate_base64</a></div><div class="ttdeci">const string generate_base64(const string &amp;magick, const string &amp;digest, const uint16_t width=100)</div><div class="ttdoc">Generates identicon from digest. </div><div class="ttdef"><b>Definition:</b> identiconpp.cpp:99</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>