Skip to main content

Drawbot implements a simple drawing API to generate 2D vector graphics

Project description

Run tests

drawbot-skia

A Python package implementing a subset of the DrawBot API using Skia as a backend.

Work in progress!

Roadmap

  1. Get basic shapes working ✅
  2. Get basic colors working ✅
  3. Get minimal BezierPath object working ✅
  4. Get transformations working ✅
  5. Get single-line, single style text() working ✅
  6. Get Variable Fonts working ✅
  7. Get HarfBuzz shaping working ✅
  8. Get OpenType features working ✅
  9. Get PNG, JPEG image export working ✅
  10. Get PDF export working ✅
  11. Get SVG export working
  12. Get MP4 export working
  13. Get Animated GIF export working
  14. Get multi-line, single style text() working
  15. Get FormattedString working
  16. Get multi-style text() working
  17. Get remaining BezierPath methods working
  18. Get many-things-I-forgot-to-mention working
  19. ...
  20. textBox() 🔴 (Major Obstacle)
  21. Fill further gaps in DrawBot API

The currently supported subset of Drawbot is tracked here.

Vision

This project is purely a Python package that implements (part of) the DrawBot drawing API. Using Skia (skia-python) ensures this can be done in a cross-platform way.

A DrawBot-like cross-platform application shell can be developed, but that would be a separate project. Looking forward to the drawbot-qt, drawbot-wx, drawbot-win or any drawbot-* projects of the future!

Compatibility caveats

Some parts of the DrawBot API will be hard or impractical to duplicate.

Skia has only low level support for text, so we'll have to do Unicode processing, line wrapping, hyphenation, and shaping ourselves. In other words, textBox() will be a tough one to crack.

Generally, 100% text compatibility with DrawBot should not be top priority, as matching CoreText behavior will be a huge challenge.

The ImageObject relies heavily on builtin macOS functionality, and it is huge. At best, we should support a small subset of it, but even that is low priority.

Strategy

So far no existing DrawBot code has been reused. Perhaps that small snippets will be copied, perhaps a part of the test suite will be adapted. Other than that I want this to be an independent project, and would like to use Skia’s powers to maximum effect, keeping efficiency and performance in mind. DrawBot's ties to macOS are so strong that it makes platform-neutral code reuse virtually impossible.

Potentially, some higher level code could be shared (for example, drawing code that uses lower level primitives), but that will have to been seen later.

Install

The quickest way to install the latest release is with pip:

pip install drawbot-skia

Note for Windows: skia-python is only supported for the 64-bit version of Python, so that goes for drawbot-skia as well, so make sure you use one of the x86-64 Python installers.

If you want to see the source code and possibly contribute: clone the repo, and do pip install -e . in the root directory.

Usage

To adapt a DrawBot script to drawbot-skia you can do a couple of things:

  • Add from drawbot_skia.drawbot import * at the top of your script
  • Or import drawbot_skia.drawbot as db if that's your preferred style

Or you can use the drawbot runner tool from the command line:

  • drawbot mydrawbotscript.py output.png

With the drawbot runner tool, you won't need any Drawbot import in the script, nor do you need a saveImage(...) to export results. It pretty much behaves as if you hit "Run" in the classic Drawbot application.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drawbot-skia-0.4.0.tar.gz (651.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drawbot_skia-0.4.0-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

Details for the file drawbot-skia-0.4.0.tar.gz.

File metadata

  • Download URL: drawbot-skia-0.4.0.tar.gz
  • Upload date:
  • Size: 651.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6

File hashes

Hashes for drawbot-skia-0.4.0.tar.gz
Algorithm Hash digest
SHA256 23651ce571d88a0e8032f0174e05a64979b25e9dbe9759795915fea4a68dd6ec
MD5 a0b821e72fad44946fcd9a1411fb0d7f
BLAKE2b-256 a40a7d3f406b06af5f5f74395048e71468fc48e0982168934e1a6d04bcf7c780

See more details on using hashes here.

File details

Details for the file drawbot_skia-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: drawbot_skia-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 25.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6

File hashes

Hashes for drawbot_skia-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 242d203aa4e63b902b9ecf339e39ebd5dd20eca75053de64f6805d84bdb7d4f4
MD5 528b6732e1d068238f77f1543db7caba
BLAKE2b-256 483e6d4efe987713765f4ce9f47bcd6884d1a494bc996e7fbf37c649439d589a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page