Starting work on the documentation for the "imagefilterchain" object type. authored by Kevin Meaney's avatar Kevin Meaney
......@@ -120,13 +120,15 @@ Example of the close doaction subcommand that closes the referenced object:
### Base objects
There are three different types of base objects that have been implemented. These are "imageimporter", "bitmapgraphiccontext" and "imageexporter". More will be implemented in future updates. You are responsible for creating and disposing these objects in your scripts.
There are four different types of base objects that have been implemented. These are "imageimporter", "bitmapcontext", "imageexporter", and "imagefilterchain". More will be implemented in future updates. You are responsible for creating and disposing these objects in your scripts.
The usual way to refer to a base object is by its reference which is the value returned by the create subcommand. The reference is unique for the lifetime of the object, and as long as your not leaking base objects, it will be a long time before that object reference will be reused. An alternate way to refer to objects is via the object type and an index into the list of objects of that type. You can use the getproperty subcommand to find out the number of objects of a particular type. Using object type and index will not always return the same object because an object's index can change when other objects of the same type are deleted. The object reference does not change during the lifetime of an object.
The usual way to refer to a base object is by its reference which is the value returned by the create subcommand. The reference is unique for the lifetime of the object, and as long as your not leaking base objects, it will be a long time before that object reference will be reused. There are two alternative ways to refer to base objects, both methods use the base object type and one method uses a name which you can give a base object when you create it, or you can use an index into the list of objects of that type. You can use the getproperty subcommand to find out the number of objects of a particular type. Using object type and index will not always return the same object because an object's index can change when other objects of the same type are deleted. The object reference does not change during the lifetime of an object.
The image importer base object is used to import image files and is a source for images to the bitmap context and image exporter. The bitmap context base object manages a bitmap into which you draw shapes and images. The bitmap context is also a source for images to the image exporter. The image exporter takes images from image importers and bitmap contexts and writes those images to disk.
### The "drawelement" "doaction"
Objects with the object type "imageimporter", "imageexporter", and "bitmapcontext" are fairly simple to create only requiring a few options. The "imagefilterchain" object though is more complex to create as it needs all the necessary information for creating the CoreImage filter chain that the "imagefilterchain" object manages.
### The "-drawelement" "doaction"
The draw element do action is a smig subcommand that has it's own vocabulary which is quite extensive, describing what to draw, how to draw and where to draw.
......@@ -134,7 +136,17 @@ The draw element do action is an action that a graphic context object handles. T
Drawing into the bitmap context is an important part of the MILA. Simple shapes like rectangles and ovals can be drawn either filled or with only their outline. The same goes for complex shapes created from paths. The line and fill color can be specified, the line width and how lines join can be specified. Text can be drawn using various fonts and other text drawing attributes. Images from a image importer or another graphic context can be drawn. All drawing can be done using various blend modes and by using a number of geometical transformations. All this information is represented in a textual form, one of a json string, a json file or a plist file, and is represented by key value pairs. Every json string must contain a "elementtype" key. The "elemenetttype" key defines the type of element to be drawn, like for example a rectangle.
smig doaction -drawelement -object $BMCR -plistfile "/path/to/drawshapes.plst"
smig doaction -drawelement -object $BMCR -plistfile "/path/to/drawshapes.plist"
### The "-renderfilterchain" "doaction"
The render filter chain do action is a smig subcommand that can be sent to a base object with type "imagefilterchain". In its simple form the render action can be sent to a image filter chain object to render the filter chain in its current state.
smig doaction -renderfilterchain -object $IFCR
But the render filter chain action can take any one of three command line options: "-jsonstring", "-jsonfile", or "-plistfile". The "-jsonstring" option means that you provide a string on the command line after the option which defines how the filter chain is updated before rendering. You can also specify a source and destination rectangle for rendering the filter chain within the string all using the JSON format. The "-plistfile" and "-jsonfile" options both need to be followed by a path to a file which has the same purpose as the "-jsonstring" option. The file options is more likely to be used when the information needed to update the filter chain before rendering is large.
smig doaction -renderfilterchain -object $IFCR -jsonfile "/Path/To/RenderFilter.json"
### Error handling
......
......