identiconpp/docs/index.html

133 lines
7.7 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: Main Page</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="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.2.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<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('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">identiconpp Documentation</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p><b>identiconpp</b> is a library to generate identicons. Written in C++.</p>
<p>You get the images as <code>Magick::Image</code>. This allows you to make all kinds of modifications.</p>
<h2>Features</h2>
<ul>
<li>[x] Symmetric identicons</li>
<li>[x] sigil identicons</li>
<li>[ ] Asymmetric identicons</li>
</ul>
<h2>Usage</h2>
<p>The HTML reference can be generated with build_doc.sh, if doxygen is installed. It is also available at <a href="https://doc.schlomp.space/identiconpp/classIdenticonpp.html">doc.schlomp.space/identiconpp/</a>.</p>
<p>You need to generate hashes yourself, any hexadecimal string will do. Make sure to use a safe hashing algorithm for sensitive data (<b>not MD5</b>). You can select as many columns and rows as you like, but make sure you have enough entropy. If something seems to be wrong, exceptions will be thrown.</p>
<h3>Example</h3>
<div class="fragment"><div class="line">{C++}</div><div class="line">// Compile with g++ $(Magick++-config --cppflags --ldflags) -lidenticonpp</div><div class="line">#include &lt;identiconpp.hpp&gt;</div><div class="line">#include &lt;Magick++/Image.h&gt;</div><div class="line"></div><div class="line">int main()</div><div class="line">{</div><div class="line"> Identiconpp identicon(5, 5, Identiconpp::algorithm::ltr_symmetric,</div><div class="line"> &quot;ffffff88&quot;, { &quot;800000ff&quot; });</div><div class="line"> Magick::Image img;</div><div class="line"> img = identicon.generate(&quot;55502f40dc8b7c769880b10874abc9d0&quot;, 200);</div><div class="line"> img.write(&quot;identicon.png&quot;);</div><div class="line">}</div></div><!-- fragment --><h2>Install</h2>
<h3>Gentoo</h3>
<p>Gentoo ebuilds are available via my <a href="https://schlomp.space/tastytea/overlay">repository</a>.</p>
<h3>Automatically generated packages</h3>
<p>Binary packages are generated automatically for each <a href="https://schlomp.space/tastytea/identiconpp/releases">release</a> in the formats:</p>
<ul>
<li>deb</li>
<li>rpm</li>
<li>tar.gz</li>
</ul>
<p>They are generated on Debian Stretch 64 bit and signed with my <a href="https://tastytea.de/tastytea_autosign.asc">automatic signing key</a>.</p>
<h3>From source</h3>
<h4>Dependencies</h4>
<ul>
<li>C++ compiler (tested: <a href="https://gcc.gnu.org/">gcc</a> 5/6/7/8, <a href="https://llvm.org/">clang</a> 5/6)</li>
<li><a href="https://cmake.org/">cmake</a> (at least 3.2)</li>
<li><a href="https://www.imagemagick.org/">imagemagick</a> (tested: 7.0 / 6.7)</li>
</ul>
<p>On a Debian system, install the packages: <code>build-essential cmake libmagick++-dev</code>.</p>
<h4>Compile</h4>
<div class="fragment"><div class="line">mkdir build</div><div class="line">cd build</div><div class="line">cmake ..</div><div class="line">make</div><div class="line">make install</div></div><!-- fragment --><h5>cmake options</h5>
<ul>
<li><code>-DCMAKE_BUILD_TYPE=Debug</code> for a debug build</li>
<li>One of:<ul>
<li><code>-DWITH_DEB=YES</code> to generate a deb-package</li>
<li><code>-DWITH_RPM=YES</code> to generate an rpm-package</li>
</ul>
</li>
</ul>
<p>To generate a binary package, execute <code>make package</code></p>
<h2>Contributing</h2>
<p>Contributions are always welcome. You can submit them as pull requests or via email to <code>tastytea</code>&lt;tt&gt;tastytea.de.</p>
<h2>Contact</h2>
<p>See <a href="https://tastytea.de/">https://tastytea.de/</a></p>
<h2>License &amp; Copyright</h2>
<div class="fragment"><div class="line">Copyright © 2018 tastytea &lt;tastytea@tastytea.de&gt;.</div><div class="line">License GPLv3: GNU GPL version 3 &lt;https://www.gnu.org/licenses/gpl-3.0.html&gt;.</div><div class="line">This program comes with ABSOLUTELY NO WARRANTY. This is free software,</div><div class="line">and you are welcome to redistribute it under certain conditions.</div></div><!-- fragment --><h2>Algorithms</h2>
<h3>ltr_symmetric</h3>
<ul>
<li>Create image with width=columns, height=rows.</li>
<li>Set background color.</li>
<li>Select half of the columns, or half of the columns + 1 if uneven.<ul>
<li><code>columns / 2 + columns % 2</code></li>
</ul>
</li>
<li>Pixels are drawn from left to right, top to bottom.</li>
<li>Use bits from digest to determine if a pixel is painted(1) or not(0).</li>
<li>Mirror the pixels vertically.</li>
<li>Use the following bits to pick the foreground color.</li>
<li>Scale image proportionally to requested width.</li>
</ul>
<div class="fragment"><div class="line"> 0111 0011 1101 1100 […] 1111 0111 0101 0111</div><div class="line">^ ^</div><div class="line">+----------------------------+--------------&gt;</div><div class="line"> | |</div><div class="line"> pixel matrix foreground color</div></div><!-- fragment --><p>Implemented in <a href="https://schlomp.space/tastytea/identiconpp/src/branch/master/src/ltr_symmetric.cpp">ltr_symmetric.cpp</a></p>
<h3>sigil</h3>
<ul>
<li>Create image with width=columns, height=rows.</li>
<li>Set background color.</li>
<li>Select half of the columns, or half of the columns + 1 if uneven.<ul>
<li><code>columns / 2 + columns % 2</code></li>
</ul>
</li>
<li>Pixels are drawn from top to bottom, left to right.</li>
<li>Use the first 8 bits to pick the foreground color.</li>
<li>Use the following bits to determine if a pixel is painted(1) or not(0).</li>
<li>Mirror the pixels vertically.</li>
<li>Scale image proportionally to requested width.</li>
</ul>
<div class="fragment"><div class="line"> 0111 0011 1101 1100</div><div class="line">^ ^</div><div class="line">+---------+---------&gt;</div><div class="line"> | |</div><div class="line">foreground color |</div><div class="line"> pixel matrix</div></div><!-- fragment --><p>Implemented in <a href="https://schlomp.space/tastytea/identiconpp/src/branch/master/src/sigil.cpp">sigil.cpp</a> </p>
</div></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>