typesupply / drawbotista

A port of the DrawBot API to Pythonista.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

drawbotista

This is a port of a subset of the DrawBot API to Pythonista.

Installing

If anyone has better installation instructions, please let me know.

You need to put the "drawbotista.py" in "Python-Modules/site-packages-3" inside of Pythonista.

I've seen lots of references to installing modules with StaSH and pip. That works for fully released packages. However, at this point I'm not ready to make this an official release. There's a way to install modules from git via pip but I can't get it to work in Pythonista.

To Do:

Easy Stuff

  • linearGradient
  • radialGradient
  • shadow
  • drawing commands that go directly to the canvas
  • BezierPath.arc
  • BezierPath.arcTo
  • BezierPath.qCurveTo
  • clipPath

Text

  • text
  • text align
  • return overflow text in textBox
  • support BezierPath in textBox
  • textSize
  • textOverflow
  • textBoxBaselines
  • installedFonts
  • hyphenation
  • lineHeight
  • tracking
  • baselineShift
  • openTypeFeatures
  • tabs

Image

  • image
  • imageSize
  • imagePixelColor
  • imageResolution

Big Stuff

  • FormattedString
  • ImageObject
  • PDF export

API

The API is currently focused on compatibility with DrawBot's static 2D image drawing capabilities. PRs for more of the API are welcome!

Extra API:

A couple of drawbotista specific functions have been added:

displayImage(mode="screen")

Display the generated image on screen. The display modes are:

  • "fullscreen"
  • "sheet"
  • "popover"
  • "panel"
  • "sidebar"

imageData(format="PNG")

Returns image data. "PNG" is the only supported format.

Supported DrawBot API:

Refer to the DrawBot documentation for details on these. Not all functionality for some of these is supported.

Functions

  • size
  • width
  • height
  • save
  • restore
  • savedState
  • fill
  • stroke
  • rect
  • oval
  • polygon
  • line
  • strokeWidth
  • miterLimit
  • lineJoin
  • lineCap
  • font
  • fontSize
  • textBox
  • transform
  • translate
  • rotate
  • scale
  • skew
  • BezierPath

BezierPath

  • moveTo
  • lineTo
  • curveTo
  • closePath
  • endPath
  • rect
  • oval
  • line
  • polygon
  • pointInside
  • bounds
  • copy
  • appendPath
  • translate
  • rotate
  • scale
  • skew
  • transform

About

A port of the DrawBot API to Pythonista.

License:MIT License


Languages

Language:Python 100.0%