Xinf API Reference
Back | Index
class xinf.erno.ObjectModelRenderer<Primitive>
extends PenRenderer

DOCME: out of date!

The ObjectModelRenderer class implements some functionality for Renderers that use an object-model based engine (which is currently true for all available renderers).

It implements the object parts of the Renderer interface, keeps a global IntHash mapping Xinferno IDs to NativeObjects (here, these are called 'Primitive's. The type parameter is in fact required to be the same as NativeObject. FIXME: clean this up a little!

Deriving classes should ignore the startObject, endObject, startNative, endNative, showObject and setTransform functions of the Renderer interface (i.e., not implement them), and instead implement the createPrimitive, attachPrimitive, clearPrimitive and setPrimitiveTransform functions declared here. The default implementations of those do nothing. Deriving classes can access the private member current to get access to the NativeObject currently being (re-)defined.

function new( ) :Void
function createPrimitive( id:Int ) :Primitive
to be overridden by deriving classes, this function returns a newly allocated native object associated to the given ID.
function destroyPrimitive( p:Primitive ) :Void
to be overridden by deriving classes, free resources (notably memory) associated to the given Object.
function attachPrimitive( parent:Primitive, child:Primitive ) :Void
to be overridden by deriving classes, attach the child to the parent object, i.e., insert it, addChild, however you want to call it.
function clearPrimitive( p:Primitive ) :Void
to be overridden by deriving classes, clear the given object (remove all its children, clear an eventually existing graphics context).
function setPrimitiveTransform( p:Primitive, x:Float, y:Float, a:Float, b:Float, c:Float, d:Float ) :Void
to be overridden by deriving classes, set the transformation of the given object to the given Matrix.
function setPrimitiveTranslation( p:Primitive, x:Float, y:Float ) :Void
to be overridden by deriving classes, set the translation of the given object to the given Position.
Back | Index