2018-12-25 18:33:19 +01:00
|
|
|
/* This file is part of identiconpp.
|
|
|
|
* Public Domain / CC-0
|
2018-12-26 06:42:00 +01:00
|
|
|
*
|
|
|
|
* Compile with g++ $(Magick++-config --cppflags --ldflags) -lidenticonpp
|
2018-12-25 18:33:19 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string>
|
2018-12-26 06:30:05 +01:00
|
|
|
#include <Magick++/Image.h>
|
2018-12-26 06:42:00 +01:00
|
|
|
#include "identiconpp.hpp"
|
2018-12-25 18:33:19 +01:00
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2018-12-26 06:30:05 +01:00
|
|
|
string digest =
|
|
|
|
"973dfe463ec85785f5f95af5ba3906eedb2d931c24e69824a89ea65dba4e813b";
|
|
|
|
Magick::Image img;
|
|
|
|
|
2018-12-25 18:33:19 +01:00
|
|
|
if (argc > 1)
|
|
|
|
{
|
2018-12-26 06:30:05 +01:00
|
|
|
digest = argv[1];
|
2018-12-25 18:33:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2018-12-26 23:06:51 +01:00
|
|
|
Identiconpp identicon(5, 5, Identiconpp::algorithm::ltr_symmetric,
|
2018-12-27 05:21:40 +01:00
|
|
|
"ffffff80",
|
2018-12-26 04:36:58 +01:00
|
|
|
{
|
|
|
|
"000000ff",
|
|
|
|
"ff0000ff",
|
|
|
|
"ffff00ff",
|
|
|
|
"00ff00ff",
|
|
|
|
"00ffffff",
|
|
|
|
"0000ffff"
|
2018-12-27 06:13:49 +01:00
|
|
|
}, { 10, 10 });
|
2018-12-26 06:30:05 +01:00
|
|
|
img = identicon.generate(digest, 500);
|
2018-12-26 23:06:51 +01:00
|
|
|
img.write("identicon_example_ltr_symmetric.png");
|
2018-12-26 04:36:58 +01:00
|
|
|
}
|
2018-12-26 06:30:05 +01:00
|
|
|
|
2018-12-27 05:21:40 +01:00
|
|
|
{
|
|
|
|
Identiconpp identicon(5, 5, Identiconpp::algorithm::ltr_asymmetric,
|
|
|
|
"00000080",
|
|
|
|
{
|
|
|
|
"ffffffc0",
|
|
|
|
"ff0000c0",
|
|
|
|
"ffff00c0",
|
|
|
|
"00ff00c0",
|
|
|
|
"00ffffc0",
|
|
|
|
"0000ffc0"
|
|
|
|
});
|
|
|
|
img = identicon.generate(digest, 500);
|
|
|
|
img.write("identicon_example_ltr_asymmetric.png");
|
2018-12-27 06:49:37 +01:00
|
|
|
img.magick("GIF");
|
|
|
|
img.write("identicon_example_ltr_asymmetric.gif");
|
2018-12-27 05:21:40 +01:00
|
|
|
}
|
|
|
|
|
2018-12-26 22:16:11 +01:00
|
|
|
{
|
2018-12-26 23:06:51 +01:00
|
|
|
Identiconpp identicon(5, 5, Identiconpp::algorithm::sigil,
|
2018-12-26 22:16:11 +01:00
|
|
|
"ffffffff",
|
|
|
|
{
|
|
|
|
"000000ff",
|
|
|
|
"ff0000ff",
|
|
|
|
"ffff00ff",
|
|
|
|
"00ff00ff",
|
|
|
|
"00ffffff",
|
|
|
|
"0000ffff"
|
|
|
|
});
|
2018-12-26 23:06:51 +01:00
|
|
|
img = identicon.generate(digest, 500);
|
|
|
|
img.write("identicon_example_sigil.png");
|
2018-12-27 06:49:37 +01:00
|
|
|
img.write("identicon_example_sigil.jpg");
|
2018-12-26 22:16:11 +01:00
|
|
|
}
|
2018-12-26 06:30:05 +01:00
|
|
|
|
2018-12-25 18:33:19 +01:00
|
|
|
return 0;
|
|
|
|
}
|