Changed example, generated example images using example.
the build was successful
Details
the build was successful
Details
This commit is contained in:
parent
6c8e8f336d
commit
9d784d18b1
|
@ -12,6 +12,9 @@ modifications.
|
||||||
![](https://doc.schlomp.space/identiconpp/identicon4.png
|
![](https://doc.schlomp.space/identiconpp/identicon4.png
|
||||||
"6x4 identicon, ltr_symmetric, 10px padding")
|
"6x4 identicon, ltr_symmetric, 10px padding")
|
||||||
|
|
||||||
|
The example images above are generated using [example.cpp]
|
||||||
|
(https://schlomp.space/tastytea/identiconpp/src/branch/master/example.cpp).
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* [x] Symmetric identicons
|
* [x] Symmetric identicons
|
||||||
|
|
79
example.cpp
79
example.cpp
|
@ -5,13 +5,24 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <identiconpp.hpp>
|
||||||
#include <Magick++/Image.h>
|
#include <Magick++/Image.h>
|
||||||
#include "identiconpp.hpp"
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
string digest =
|
// sha256(test@example.com)
|
||||||
"973dfe463ec85785f5f95af5ba3906eedb2d931c24e69824a89ea65dba4e813b";
|
std::string digest = "973dfe463ec85785f5f95af5ba3906ee"
|
||||||
|
"db2d931c24e69824a89ea65dba4e813b";
|
||||||
|
const std::vector<std::string> colors =
|
||||||
|
{
|
||||||
|
"800000ff",
|
||||||
|
"008000ff",
|
||||||
|
"000080ff",
|
||||||
|
"808000ff",
|
||||||
|
"008080ff",
|
||||||
|
"800080ff"
|
||||||
|
};
|
||||||
Magick::Image img;
|
Magick::Image img;
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
|
@ -20,51 +31,31 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Identiconpp identicon(5, 5, Identiconpp::algorithm::ltr_symmetric,
|
Identiconpp identicon(4, 4, Identiconpp::algorithm::ltr_symmetric,
|
||||||
"ffffff80",
|
"ffffffff", colors, { 20, 20 });
|
||||||
{
|
img = identicon.generate(digest , 200);
|
||||||
"000000ff",
|
img.write("identicon1.png");
|
||||||
"ff0000ff",
|
|
||||||
"ffff00ff",
|
|
||||||
"00ff00ff",
|
|
||||||
"00ffffff",
|
|
||||||
"0000ffff"
|
|
||||||
}, { 10, 10 });
|
|
||||||
img = identicon.generate(digest, 500);
|
|
||||||
img.write("identicon_example_ltr_symmetric.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
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");
|
|
||||||
img.magick("GIF");
|
|
||||||
img.write("identicon_example_ltr_asymmetric.gif");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Identiconpp identicon(5, 5, Identiconpp::algorithm::sigil,
|
Identiconpp identicon(5, 5, Identiconpp::algorithm::sigil,
|
||||||
"ffffffff",
|
"00000080", colors);
|
||||||
{
|
img = identicon.generate(digest , 200);
|
||||||
"000000ff",
|
img.write("identicon2.png");
|
||||||
"ff0000ff",
|
}
|
||||||
"ffff00ff",
|
|
||||||
"00ff00ff",
|
{
|
||||||
"00ffffff",
|
Identiconpp identicon(5, 5, Identiconpp::algorithm::ltr_asymmetric,
|
||||||
"0000ffff"
|
"000000ff", colors);
|
||||||
});
|
img = identicon.generate(digest , 200);
|
||||||
img = identicon.generate(digest, 500);
|
img.write("identicon3.png");
|
||||||
img.write("identicon_example_sigil.png");
|
}
|
||||||
img.write("identicon_example_sigil.jpg");
|
|
||||||
|
{
|
||||||
|
Identiconpp identicon(6, 4, Identiconpp::algorithm::ltr_symmetric,
|
||||||
|
"000000c0", colors, { 10, 10 });
|
||||||
|
img = identicon.generate(digest , 200);
|
||||||
|
img.write("identicon4.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue