TUIX v0.5Beta
Internal API Reference
The stable public API is engine, builders, registry, input, scenes, buffers, and objects. Internal modules are documented here only so debugging and advanced bridge work have a clear map.
Internal SurfaceDo not build normal applications on _lib, _structs, or _tuix_cy. Their layout follows the compiled native ABI and may change faster than wrapper APIs.
tuix.core._lib Methods
| Method | How to use it | Why it exists |
|---|---|---|
| _lib.get_func(name, restype=ctypes.c_int, argtypes=None) | Resolve a native callable from the Cython module or CDLL. | Internal bridge helper used by public wrappers to support fallback paths. |
| _lib.tuix_render_streaming(buf) | Render a Python buffer through the internal streaming bridge. | Supports internal renderer experiments and bridge tests. |
| _lib.tuix_create_native_buffer(py_buf) -> int | Create a native final-buffer handle from a Python buffer. | Allows internal patch/render paths to operate on native memory. |
| _lib.tuix_free_native_buffer(handle: int) | Free a native buffer handle created by tuix_create_native_buffer. | Prevents leaks in internal bridge workflows. |
| _lib.tuix_apply_patch_and_render(handle: int, patch: bytes) -> bytes | Apply compact patch bytes to a native buffer and render ANSI bytes. | Supports low-level diff/patch rendering experiments. |
| _lib.make_patch_bytes(updates) -> bytes | Serialize (index, sym, fg, bg) updates into compact 20-byte records. | Encodes patch data for tuix_apply_patch_and_render. |
tuix.core._structs
_structs contains ctypes mirrors of selected native structures such as TuixRegistry, TuixObject, pixels, colors, and input snapshots. Use public snapshot APIs for normal diagnostics instead of directly reading these structures.
tuix.core._tuix_cy
_tuix_cy is the compiled Cython extension. Public wrappers call into it when available and fall back to ctypes lookups where needed. Import wrapper modules instead of importing _tuix_cy in application code.
v0.5 Ownership Notes
- TuixBuffer.pixels_owned identifies whether the core owns the current pixel storage.
- Builder-returned temporary pixels can be copied into core-owned storage.
- Resize, scene clear, registry destroy, compaction, and builder cached-pixel cleanup paths were hardened in v0.5.
- Builder callbacks can run outside the global registry lock; use public APIs for registry and buffer mutations.