Python binding design

skia-python is built upon pybind11. Python bindings are mostly plain conversion from Skia C++ API. Function names remain the same.

A few differences are:

  • All bindings reside in skia module.

  • Removes class name prefix Sk; e.g., SkCanvas is skia.Canvas.

  • Some method signatures adapt to Python style; e.g.,

    • skia.Surface.__init__() accepts additional args.

    • skia.Paint is implicitly convertible from dict.

    • Args taking void* ptr use buffer protocol.

    • Methods returning a raw memory address wrap in memoryview.

  • NumPy export method is added to Surface, Canvas, Image.

  • Buffer protocol support in Bitmap, Pixmap.


Development happens at Github. Feel free to post to issues or make PR.