Skip to content

Conversation

@ledvinap
Copy link
Contributor

@ledvinap ledvinap commented Nov 1, 2022

(For discussion)

  • Refactor python bindings a bit, fixing various problems leading to SEGFAULT
  • class passed to SwapOnVSync is returned on second call unmodified
  • FrameCanvas is recycled when python object is freed

Add support for FrameCanvas::Serialize:

  • Python class with Buffer Protocol is returned
  • It can be easily used to write to file etc. (and no copy is necessary)
  • Now read-only, but read-write should be safe and it will allow zero-copy writing to framebuffer
    • another option is to export Deserialize, possibly with Buffer Protocol interface, but performance will be slightly smaller

Solves problem when installing package directly from git (pipenv install
-e )
- Except NULL for cdefs (slightly optimizes performance)
- Handle reading NULLs from Options (caused segfault)
- Improve handling of parameters for char* options
  - accepts string-like objects, returns bytes()
- Use cython magic for __options
- Handle None as NULL in SwapOnVSync (allows wait for sync usage)
- Use C++ Canvas object to handle common operations
- Use @Property decorator syntax
- prevent creation of uninitialized objects from Python code (__new__)
- prevent cython classes without corresponding C++ class (raise
   exception on all paths that can cause it)
- Trace displayed FrameCanvas in SwapOnVSync
  - class passed to SwapOnVSync is returned on second call
- Recycle FrameCanvas when python object is freed
- FrameCanvas class keeps RGBMatrix alive (RGBMatrix is not deleted
   before FrameCanvas)
Export Serialize using Python Buffer Protocol

Currently only read-only view is supported
```
green = Color(0, 255, 0)
rgbmatrix.Fill(*green())
generated using:
python3 -m cython -3 --cplus *.pyx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant