|
| 1 | +# Virtual artist abstractionist |
| 2 | + |
| 3 | +This is a console C++ program that generates random abstract paintings in PNG format that I created in 2014. |
| 4 | +Here is the [main article with lots of generated pictures](http://www.aivanf.com/eng/note/virtual-artist). |
| 5 | + |
| 6 | +### Project files |
| 7 | + |
| 8 | +- `mathem.h` – some helpful functions. |
| 9 | + |
| 10 | +- `lodepng.h` / `lodepng.cpp` – PNG library created by [Lode Vandevenne](http://lodev.org/lodepng/). |
| 11 | + |
| 12 | +- `islepng.h` – **isle** namespace and **Picture** class for images manipulations. |
| 13 | + |
| 14 | +- `mem.h` / `mem.cpp` – **mem** namespace, classes **Value**, **Number**, **Variable**, **Expression**, **Pool**, |
| 15 | +and functions for deep expressions creation. |
| 16 | + |
| 17 | + Namespace **mem** is used for creation of random expression. |
| 18 | +Class **Value** is an abstract parent for the **Number**, **Variable**, and **Expression** classes. |
| 19 | +Class **Number** represents a constant number, **Variable** is a number which value may be changed from outside. |
| 20 | +**Expression** is linked with two **Value**s and has an operation type. |
| 21 | +Static class **Pool** is used for memory cleaning. |
| 22 | + |
| 23 | + The function `Value* SetDeepValueVars(int, Value*, Value*)` recursively creates random expressions |
| 24 | + with given values at the bottom level. |
| 25 | + |
| 26 | +- `main.cpp` – entry point, input handling, and generation controlling. |
| 27 | + |
| 28 | +### The algorithm of image creation |
| 29 | + |
| 30 | +1. Initially, the program creates two expressions **P** and **Q** |
| 31 | +with different depth and **X** and **Y** as variables. |
| 32 | + |
| 33 | +2. Then, it creates expressions **H** and **V** using **P** and **Q** as variables. |
| 34 | + |
| 35 | +3. Then, it iterates through image pixels and calculates values of **H** and **V**, |
| 36 | +and uses it for translation from [HSV](https://en.wikipedia.org/wiki/HSL_and_HSV) to [RGB](https://en.wikipedia.org/wiki/RGB_color_model) color model. The obtained values are used for pixels RGB colors. |
| 37 | + |
| 38 | +### License |
| 39 | + |
| 40 | +Copyright AivanF. (c) 2014-2018 |
| 41 | + |
| 42 | +This code is provided 'as-is', without any express or implied |
| 43 | +warranty. You may not hold the author liable. |
| 44 | + |
| 45 | +Permission is granted to anyone to use this software for any purpose, |
| 46 | +including commercial applications, and to alter it and redistribute it |
| 47 | +freely, subject to the following restrictions: |
| 48 | + |
| 49 | +1. The origin of this code must not be misrepresented. You must not |
| 50 | +claim that you wrote the original software. When use the code, you must give appropriate credit, |
| 51 | +provide a link to this license, and indicate if changes were made. |
| 52 | + |
| 53 | +2. Altered source versions must be plainly marked as such, and must not be |
| 54 | +misrepresented as being the original software. |
| 55 | + |
| 56 | +3. This notice may not be removed or altered from any source distribution. |
| 57 | + |
0 commit comments