IObjectState

References
public interface IObjectState : IStorable
A snapshot of the animatable state of a single object. States are opaque: only the object which made one knows what it contains, and an object being handed a state it does not recognise is expected to ignore it rather than throw.

A state is a value, not a live view of the object. Taking one and applying it later must put the object back the way it was, which is what lets an animation leave a document exactly as it found it.

States are stored with the animation which uses them, so every implementation needs an IoIdAttribute and a constructor taking a reader, exactly as any other storable type does. They are read back through the interface rather than through the concrete type, so the identifier is what decides which type gets built. The stored form is also what a resumable render is fingerprinted against, so it has to describe the state completely.

object.ToString() is not part of the contract. Where a state is shown to a user it draws itself; anything it returns from ToString is for logs and debuggers, and implementations are free to leave it alone.

Methods

Display

#
void Display(Context context, RectangleF bounds, Color background)
Draw this state so a user can see what it is.

A number might write itself out, a colour might fill a swatch, a camera might draw a little frustum. Whatever is drawn should read against the background it is given, and should stay inside the bounds it is given.

context (Context)Graphics context to draw with.
bounds (RectangleF)Area to draw within, in control coordinates.
background (Color)Colour behind this state, so what is drawn can be made to stand out against it.

Store

void Store(IWriter writer)
This method is called whenever the instance is required to serialize itself.
inherited fromIStorable
writer (IWriter)Writer object to serialize with.