undertherain / pycontextfree

Pythonic generative art tool
http://pycontextfree.blackbird.pw/
Mozilla Public License 2.0
38 stars 3 forks source link

Can I use this to tile an image in a fractal pattern? #16

Open jminardi opened 5 years ago

jminardi commented 5 years ago

I want to start with a base image (my company's logo) and tile it following a fractal pattern (scale, rotate, translate, modify color).

Is that possible?

undertherain commented 5 years ago

Short answer: yes you can, but in sort of very undocumented and likely to be changed way. You need to get cairo context object from pycontextfree, currently it is in pycontextfree._state["ctx"] , and use it to draw an image with cairo API. You can wrap this in contextfree's check_limits etc decorators, they are pretty much agnostic about what is happening inside. I'll try to make some example a but later when I get minute.

jminardi commented 5 years ago

Awesome, that sounds really useful. I will be on the lookout for an example when you get the time.