Layers API for C, Terra and LuaJIT ffi use.
- self-allocating constructors.
- error checking and reporting, separating fatal from non-fatal errors.
- validation and clamping of enums, indices, counts, sizes, offsets, etc.
- state invalidation when changing input values.
- state checking when accessing computed values.
- using consecutive enum values for forward ABI compatibility.
- using enlarged number types for forward ABI compat. and clamping inf/-inf.
- renaming functions and types to C conventions for C use.
- binding methods and getters/setters via ffi.metatype for LuaJIT use.
- invalid input should never cause crashes.
- programming errors should trigger asserts.
- invalid input should not affect other non-child layers in the tree
except min_cw and min_ch which can affect the whole geometry.
- the order in which layer properties are set is not important in order to
avoid call-order dependencies, eg. you don't have to set `background_type`
to a gradient type before setting `background_color_stop_color`, and you
don't have to set `background_color_stop_count` either (the color stops
array is expanded automatically). There are exceeptions to this, eg.
setting `background_color_stop_count = 0` after adding some color stops
_will_ remove those colors stops.
- make a layer lib object. make top layers from that and then child layers
from top layers, constructing a tree. set properties on the layers.
- call draw() on the top layer. change any properties,
check if `pixels_valid` is false, and issue a repaint if it is.
- hit test layers.
- navigate, hit-test, select and edit text with cursors.
See the source code for more info.