Some helpers for DrawBot that I tend to use and reuse. I used to just copy/paste these things into my drawbot scripts, but it seems cleaner to just call them and use them like this:
from drawbotlab.color import RGBColor from drawbotlab.shape import roundedRect myBlue = RGBColor(b=1) myBlue.setFill() roundedRect(50, 50, 200, 100, r=20)
Requires an installation of the python drawBot library (from drawBot import *). The glyph module requires RoboFab and fontTools.
Drawbotlab doesn't have an installer or anything like that. To use it, simply place the folder, or a pth file pointing to the folder, in your Python site-packages.
- RGBColor and CMYKColor objects, for easy color definition and selection.
- Genericized
fillColor()andstrokeColor()functions, that accept color objects, RGB tuples, or CMYK tuples
- DrawBot pen for converting from robofab glyph
drawGlyph(), which acts like the function in the DrawBot RoboFont ExtensionufoText(), which acts like Drawbot's nativetext()but draws from a robofab fontufoTextSize(), which gets the dimensions of a UFO-based textblock
roundedRect(x, y, width, height, [radius, curvature]), which acts likerect()but less pointy!
norm(value, start, stop), which interpolates. Similar to the function in Processing.lerp(start, stop, amt), which gets an interpolated value. Similar to the function in Processing.