typemytype / drawbot

http://www.drawbot.com
Other
398 stars 62 forks source link

Advancing the BezierPath object and tracing. #65

Closed typoman closed 7 years ago

typoman commented 7 years ago

Recently we have made an experimental music video using drawbot. It was such an amazing experience and it showed us the possibilities of the drawbot. There were certain things that were missing which I added to my libraries such as offsetting the curves and adding points and putting noise on path. I even used drawbot to cut footage and render large sequences. For rendering large sequences I used drawbot as a module and ran it in the terminal which proved to be time saving but for expensive operations it produced a lot of hidden extra files (I don't know where!) which filled the disk space. The only solution was exiting terminal and opening it again after every rendering session. If it would be possible we will publish the results online soon. I have some questions/requests/suggestions:

  1. BezierPath object is great but is missing some functionalities. Such as offsetting curves, adding points with certain distances, accessing the individual points as point objects on a certain index. I have some way of doing these but I can't removeOverlaps. This is certainly very expensive task too. Maybe it could come from Robofont? Also rotating and scaling methods are working in an almost impractical way. Because there is no specific origin/pivot/anchor point for rotating and scaling. That's why I made my own way of rotating which assumed the default origin point is in the center of the bounding box unless it’s given in the args. So everything rotates or scale relative to the center of the path by default.
  2. Tracing images could be such an awesome feature. I was imagining blurring a typeface and tracing it again in a sequence according to beats of the music. It would look beautiful! There are plenty of operations that if they are done on a raster image and traced back, they will produce phenomenal results in an image sequence.
  3. I was thinking about adding the methods I've made to the BezierPath() class. Couple of them need external libraries. One of them is Simplex Noise from Eliot Eshelman. The Simplex Noise is 100 times slower in python compared to C++. If it would be possible to build a bridge to the C++ library it would be more practical. Also Numpy sometimes helps to apply filters such as gaussian blur on a list of numbers in a super sonic speed! One of the usages was like applying a blur on the amplitude of the music which could be a very large list. Maybe this one is more generic rather than specific to what you’re doing in the drawbot. But I was just thinking about how adding libraries would work in drawbot.
  4. I’ve made a footage object which loads an image sequence from disk and makes it easy to access certain frame numbers and shifting it back and forth. I used it to cut large amount of footages which was way more intuitive than doing it in video editing apps. It’s almost like I have a crude video editing object it drawbot. Do you think it would be useful?
typemytype commented 7 years ago
  1. A BezierPath already works like a pen object from the world of RoboFab. Effects could be easily applied with pens, like flatting or even expanding (see outliner for RoboFont). BooleanOperations is embedded into drawBot and should work.
  2. added see https://github.com/typemytype/drawbot/commit/c503302bcdf77f77687010f9a0a6c3d6928541f4
  3. see 1. :)
  4. This sounds usefull, You could send a pull request, so we (@justvanrossum and I) can have a look.

thanks!

typoman commented 7 years ago

Thank you, that is great. I was looking to see how the the Boolean Operations work but I couldn't find anything inside baseContext so I expected this could work:

b = BezierPath()
b.oval(10, 10, 200, 200)

d = BezierPath()
d.rect(80, 110, 160, 160)

e = b & d

fill(None)
stroke(0)
drawPath(e)

But it didn't! Sorry but what is the syntax for BooleanOperations?

typemytype commented 7 years ago

booleanOperation support added see https://github.com/typemytype/drawbot/commit/94433aeba6217d12e060aaf31d9dd8061080790d

your example should work...