Explained algorithms
the build was successful Details

This commit is contained in:
tastytea 2018-12-26 23:51:32 +01:00
parent 07cd9be8bd
commit c96df63046
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 51 additions and 2 deletions

View File

@ -105,3 +105,52 @@ License GPLv3: GNU GPL version 3 <https://www.gnu.org/licenses/gpl-3.0.html>.
This program comes with ABSOLUTELY NO WARRANTY. This is free software, This program comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions. and you are welcome to redistribute it under certain conditions.
``` ```
## Algorithms
### ltr_symmetric
* Create image with width=columns, height=rows.
* Set background color.
* Select half of the columns, or half of the columns + 1 if uneven.
* `columns / 2 + columns % 2`
* Pixels are drawn from left to right, top to bottom.
* Use bits from digest to determine if a pixel is painted(1) or not(0).
* Mirror the pixels vertically.
* Use the following bits to pick the foreground color.
* Scale image proportionally to requested width.
```PLAIN
0111 0011 1101 1100 […] 1111 0111 0101 0111
^ ^
+----------------------------+-------------->
| |
pixel matrix foreground color
```
Implemented in [ltr_symmetric.cpp]
(https://schlomp.space/tastytea/identiconpp/src/branch/master/src/ltr_symmetric.cpp)
### sigil
* Create image with width=columns, height=rows.
* Set background color.
* Select half of the columns, or half of the columns + 1 if uneven.
* `columns / 2 + columns % 2`
* Pixels are drawn from top to bottom, left to right.
* Use the first 8 bits to pick the foreground color.
* Use the following bits to determine if a pixel is painted(1) or not(0).
* Mirror the pixels vertically.
* Scale image proportionally to requested width.
```PLAIN
0111 0011 1101 1100
^ ^
+---------+--------->
| |
foreground color |
pixel matrix
```
Implemented in [sigil.cpp]
(https://schlomp.space/tastytea/identiconpp/src/branch/master/src/sigil.cpp)

View File

@ -80,7 +80,7 @@ private:
/*! /*!
* @brief Generate simple identicon. * @brief Generate simple identicon.
* *
* Use bits 0 to (columns / 2 + columns % 2) * _rows, use the * Use bits 0 to (_columns / 2 + _columns % 2) * _rows, use the
* following bits to determine foreground color. Squares are drawn * following bits to determine foreground color. Squares are drawn
* from left to right, top to bottom. * from left to right, top to bottom.
* *
@ -97,7 +97,7 @@ private:
/*! /*!
* @brief Generate sigil identicon. * @brief Generate sigil identicon.
* *
* Use bits 9 to (columns / 2 + columns % 2) * _rows, use the first * Use bits 9 to (_columns / 2 + _columns % 2) * _rows, use the first
* 8 bits to determine foreground color. Squares are drawn from top * 8 bits to determine foreground color. Squares are drawn from top
* to bottom, left to right. * to bottom, left to right.
* *