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 04:36:58 +01:00
|
|
|
Identiconpp identicon(13, 10, Identiconpp::identicon_type::simple,
|
|
|
|
"ffffff88",
|
|
|
|
{
|
|
|
|
"000000ff",
|
|
|
|
"ff0000ff",
|
|
|
|
"ffff00ff",
|
|
|
|
"00ff00ff",
|
|
|
|
"00ffffff",
|
|
|
|
"0000ffff"
|
|
|
|
});
|
2018-12-26 06:30:05 +01:00
|
|
|
img = identicon.generate(digest, 500);
|
|
|
|
img.write("identicon_example_simple.png");
|
2018-12-26 04:36:58 +01:00
|
|
|
}
|
2018-12-26 06:30:05 +01:00
|
|
|
|
2018-12-26 22:16:11 +01:00
|
|
|
{
|
|
|
|
Identiconpp identicon(5, 5, Identiconpp::identicon_type::libravatar,
|
|
|
|
"ffffffff",
|
|
|
|
{
|
|
|
|
"000000ff",
|
|
|
|
"ff0000ff",
|
|
|
|
"ffff00ff",
|
|
|
|
"00ff00ff",
|
|
|
|
"00ffffff",
|
|
|
|
"0000ffff"
|
|
|
|
});
|
|
|
|
img = identicon.generate("5a105e8b9d40e1329780d62ea2265d8a", 500);
|
|
|
|
img.write("identicon_example_libravatar.png");
|
|
|
|
}
|
2018-12-26 06:30:05 +01:00
|
|
|
|
2018-12-25 18:33:19 +01:00
|
|
|
return 0;
|
|
|
|
}
|