Add some docs

Document some of the high-level structure of ottie.
This commit is contained in:
Matthias Clasen
2020-12-27 12:02:17 -05:00
parent 85fbeb1031
commit 2c073e684c
8 changed files with 91 additions and 0 deletions

View File

@@ -29,6 +29,16 @@
#include <glib/gi18n-lib.h>
#include <gsk/gsk.h>
/*
* An OttieComposition is an OttieLayer that contains
* an array of other layers. It is created by calling
* ottie_composition_parse_layers() with a JsonReader
* object while parsing a Lottie animation.
*
* For ease of manipulation, OttieComposition implements
* the GListModel interface.
*/
#define GDK_ARRAY_ELEMENT_TYPE OttieLayer *
#define GDK_ARRAY_FREE_FUNC g_object_unref
#define GDK_ARRAY_TYPE_NAME OttieLayerList

View File

@@ -28,6 +28,20 @@
#include <glib/gi18n-lib.h>
#include <json-glib/json-glib.h>
/**
* SECTION:ottiecreation
* @Title: Creation
* @Short_description: Top-level object for Lottie animations
*
* OttieCreation is the top-level object which holds a Lottie
* animation. You can create an OttieCreation by loading a Lottie
* file with otte_creation_new_for_file() or ottie_creation_load_file(),
* or by parsing a Lottie animation from memory with ottie_creation_load_bytes().
*
* OttieCreation provides some general information about the loaded
* animation, such as a name, the frame rate, start and end frames
* and the dimensions.
*/
struct _OttieCreation
{
GObject parent;

View File

@@ -24,6 +24,18 @@
#include <glib/gi18n-lib.h>
#include <json-glib/json-glib.h>
/*
* OttieLayer is the parent class for all kinds of layers
* in Lottie animations.
*
* OttieComposition - a layer that contains other layers
* OttieShapeLayer - a layer containing shapes
* OttieNullLayer - a layer that does nothing
*
* Layers are organized in a tree (via composition layers),
* and rendering an animation is just rendering all its layers.
*/
G_DEFINE_TYPE (OttieLayer, ottie_layer, OTTIE_TYPE_OBJECT)
static void

View File

@@ -23,6 +23,15 @@
#include "ottieintl.h"
/*
* OttieObject is the base class for all objects that are
* created by parsing a Lottie animation. Every such object
* has a name and a match-name. The match-name is used for
* referencing the object in scripts.
*
* The two subclasses of OttieObject are OttieLayer and OttieShape.
*/
enum {
PROP_0,
PROP_MATCH_NAME,

View File

@@ -26,6 +26,19 @@
#include <math.h>
#include <glib/gi18n.h>
/**
* SECTION:ottiepaintable
* @Title: Paintable
* @Short_description: GdkPaintable implementation for Lottie
*
* OttiePaintable is an implementation of GdkPaintable that can
* draw Lottie animations. To create an OttiePaintable, you need
* a OttieCreation (i.e. a parsed Lottie animation).
*
* Beyond the standard GdkPaintable API, OttiePaintable lets you
* get and set the current timestamp, and query to overall duration
* of the animation.
*/
struct _OttiePaintable
{
GObject parent_instance;

View File

@@ -26,6 +26,14 @@
#include <glib/gi18n.h>
/**
* SECTION:ottieplayer
* @Title: Player
* @Short_description: Plays a Lottie animation
*
* OttiePlayer is an implementation of the GtkMediaStream interface
* for Lottie animations.
*/
struct _OttiePlayer
{
GObject parent_instance;

View File

@@ -23,6 +23,12 @@
#include "ottierenderobserverprivate.h"
/*
* OttieRender is the renderer object that is used for
* turning a Lottie animation plus a timestamp into a
* render node. It handles caching for expensive parts
* of the rendering, such as paths.
*/
void
ottie_render_init (OttieRender *self,
OttieRenderObserver *observer)

View File

@@ -23,6 +23,25 @@
#include <glib/gi18n-lib.h>
/*
* OttieShape is the base class of all shape objects in
* Lottie animations. Shapes are operations that are applied
* to the render tree, for example:
*
* - adding a rectangle to the list of paths
* - trimming or offsetting an existing path
* - rendering a path by stroking or filling it
*
* There are many subclasses of OttieShape:
*
* - OttieEllipseShape
* - OttieRectShape
* - OttiePathShape
* - OttieFillShape
* - OttieStrokeShape
* - OttieTrimShape
* - OttieGroupShape
*/
G_DEFINE_TYPE (OttieShape, ottie_shape, OTTIE_TYPE_OBJECT)
static void