1. Foreword

Welcome to djnn, the software development framework that will help you produce innovative user interfaces throughout efficient design and development processes.

djnn is an extensible environment, and we continuously develop extensions for supporting richer user interfaces. The current version includes the core system of djnn, the graphical module that implements the core of the SVG model, finite state machines for describing discrete behaviours, data-flow bricks for describing continuous behaviours, and initial support for input management.

The djnn libraries implement the I* model for interactive software components. They offer two programming interfaces, called public and semi-public: the first is aimed at creating interactive programs in C, and the other is aimed at building djnn APIs in new languages by creating a wrapper, and at creating new modules, rendering engines, or servers.

This document is made of two parts. The first part lists the functions offered by the djnn core library, whether public or semi-public. The second part lists the components offered by the various djnn modules, with their structure and their role.

The copyright holder on this book is Ecole Nationale de l’Aviation Civile (2013-2016). This book is part of the djnn libraries, and it is made available to you under the same terms as the said software. Please refer to the documents you received when obtaining the software.

API of the C libraries

1. Creating and destroying

1.1. djnCreateXXX

All the classes of components that can be created by programs provide a constructor function that follows the same pattern:

djnComponent* djnCreateXXX (djnComponent* parent, char* name, ...)

where parent is the component in which the new component will be created, and name is the name attributed to the new component in its parent.

  • If parent is not 0 and name is 0, a default name is attributed.

  • If parent is 0, and name is 0, the new component has no parent.

  • If parent is 0 and name is not 0, the new component is added to a default root parent and can be accessed as /<name> in component-finding functions.

1.2. djnDeleteComponent

void djnDeleteComponent (djnComponent* component)

Delete the component component.

2. Loading and parsing

2.1. Public functions

djnComponent* djnLoadFromXML (const char* URI)

Load the components stored in the XML file located at URI and return their root component.

djnComponent* djnLoadFromLibrary (const char* URI)

Load the dynamic library located at URI and return its root component.

3. Finding components

3.1. Public functions

djnComponent* djnFindComponent (djnComponent* component, const char* name)

Find the component referenced by the component component with the name name.

djnComponent* djnFindProperty (djnComponent* component, const char* name)

For now, see djnFindComponent.

djnComponent* djnFindRunnable (djnComponent* component, const char* name)

For now, see djnFindComponent.

djnComponent* djnFindComponentByURI (const char* uri)

Find the component at URI uri. The URI must be formated as "scheme:xxxx".

djnComponent* djnFindComponentByXPath (djnComponent* from, const char* xpath)

Find by its XPath an component referenced from the component from.

XPath support is limited to // queries, ie. if xpath = //Name it searches the component with name Name in all the descendants of from.

3.2. Extension functions

3.2.1. Name resolution

typedef djnComponent* (*djnResolveProc) (djnComponent* e, const char* string)

Type of functions used for asking a component to resolve an individual name or a path into one of its subcomponents.

djnComponent* djn_PathResolve (djnComponent* e, const char* path, djnResolveProc r)

Utility function that isolates the first segment in path (that is the text up to the first / if any), uses function r to ask component e to resolve the resulting name, then asks the obtained component to resolve the rest of the path. This function is used in the implementation of most container components, with only r differing.

djnComponent* djn_TrivialResolveNameProc (djnComponent* e, const char* name)

Name resolution function that always return e.

djnComponent* djn_SymbolResolveNameProc (djnComponent* e, const char* name)

Name resolution function that searches the symbol table of e.

djnComponent* djn_ComponentResolvePathProc (djnComponent* e, const char* path)

Path resolution function that looks up the first segment of the path in the symbol table of e then . Can be used as the path resolution function of plain vanilla composite components.

3.2.2. Creation of new name spaces

typedef djnComponent* (*djnComponentFindProc) (const char* string)

Type of functions used by URI managers for resolving absolute names into components.

void djn_AddURIManager (const char* scheme, djnComponentFindProc proc)

This function registers proc as the function used to resolve all URIs starting with scheme. When called, proc receives the URI stripped from its <scheme>: first segment.

4. Managing the tree

4.1. djnAddChild

void djnAddChild (djnComponent* parent, djnComponent* child, const char* name)

Add the component child to the children of the parent component, with the name name.

4.2. djnRemoveChild

void djnRemoveChild (djnComponent* parent, djnComponent* child)

Remove the component child from the children of the parent component

4.3. djnMergeChildren

void djnMergeChildren (djnComponent* component1, const char* prop_name1, djnComponent* component2, const char* prop_name2)

Merge the property prop_name1 of component component1, and the property prop_name2 of component component2

4.4. djnCreateAlias

djnComponent* djnCreateAlias (djnComponent* parent, const char* name, djnComponent *from)

Add a reference name to the component from from the component parent. The component from will be seen as a children of parent by other components (they will access to it through the path parent\name) without really being a children (no activation by the propagation mechanism).

5. Controlling execution

5.1. djnRunComponent

void djnRunComponent (djnComponent* component)

Run the component i.e. execute the action inherent to the component (display a rectangle, manage a window, emit a sound, etc.) and propagate the activation to all its children. This propagation is a traversal of the sub-tree composed of the descendents of the component, in depth and from left to right, triggering the activation of the descendents without a isModel argument, or with isModel = 0.

Note

isModel argument work as follows:

  • If isModel = 1, the component is activated only when

    • calling djnRunComponent on the component

    • the component is associated with a binding and the binding is triggered

    • the component is child of a switch and is in the active branch

    • the component is associated to the action of a fsm transition

  • If isModel = 0, the component is also activated with the tree traversal mechanism.

5.2. djnStopComponent

void djnStopComponent (djnComponent* component)

Stop the component i.e. stop the action inherent to the component (hide a rectangle, stop a dataflow, stop the ticking of a clock, etc.) and all its children.

5.3. djnNotify

void djnNotify (djnComponent* component, const char* spec)

Propagate the activation of the component specified by the (component, spec) couple.

Note

Specification couples work as follows:

  • if the component pointer is non-null, the text is an additional component specification relative to it; if the text is null, it is the component itself that is chosen.

  • if the component pointer is null, the text is an absolute reference to a component in the application tree.

Core components

1. Core module

1.1. Description

The core module contains the core of djnn: all that is necessary to create the basic components (control structures, lists, properties or group components), manage them (load them, find them, manage their hierarchical structure) and enventually run and stop these components.

1.2. Initialization

#include <djnn/core.h>

djnInitCore()

2. Boolean property

2.1. Description

Boolean properties are components that store boolean values and act as activation sources when their values are modified. They come with specific methods for reading and setting their values.

2.2. Constructor

djnComponent* djnCreateBoolProperty (djnComponent* component, const char* pname, int value)

Create a boolean property.component. The property is initialized to false if value is 0, true otherwise.

2.3. Children

None.

2.4. Standard actions

None.

2.5. Special methods

int djnGetBoolPropertyValue (djnComponent* component, const char* name)

Get the value of the boolean property identified by name in the component component.

void djnSetBoolPropertyValue (djnComponent* component, const char* name, int value)

Set the value of the boolean property identified by name in the component component. value must be 0 or 1.

3. Integer property

3.1. Description

Integer properties are components that store integer numbers and act as activation sources when their values are modified. They come with specific methods for reading and setting their values.

3.2. Constructor

djnComponent* djnCreateIntProperty (djnComponent* parent, const char* pname, int value)

Create an integer property.component. The property is initialized to value.

3.3. Children

None.

3.4. Standard actions

None.

3.5. Special methods

int djnGetIntPropertyValue (djnComponent* parent, const char* name)

Get the value of the integer property identified by name in parent.

void djnSetIntPropertyValue (djnComponent* parent, const char* name, int value)

Set the value of the integer property identified by name in parent.

4. Double property

4.1. Description

Double properties are components that store double precision floating numbers and act as activation sources when their values are modified. They come with language-dependent methods for reading and setting their values.

4.2. Constructor

djnComponent* djnCreateDoubleProperty (djnComponent* parent, const char* pname, double value)

Create a double property.component. The property is initialized to value.

4.3. Children

None.

4.4. Standard actions

None.

4.5. Special methods

double djnGetDoublePropertyValue (djnComponent* parent, const char* name)

Get the value of the double property identified by name in the component.

void djnSetDoublePropertyValue (djnComponent* parent, const char* name, double value)

Set the value of the double property identified by name in parent.

5. Text property

5.1. Description

Text properties are components that store text strings and act as activation sources when their values are modified. They come with specific methods for reading and setting their values.

5.2. Constructor

djnComponent* djnCreateTextProperty (djnComponent* parent, const char* pname, const char* value)

Create a text property.component. The property is initialized to value.

5.3. Children

None.

5.4. Standard actions

None.

5.5. Special methods

const char* djnGetTextPropertyValue (djnComponent* parent, const char* name)

Get the value of the text property identified by name in parent.

void djnSetTextPropertyValue (djnComponent* parent, const char* name, const char* value)

Set the value of the text property identified by name in parent.

6. Reference property

6.1. Description

Reference properties are components that store reference to other components and act as activation sources when their values are modified. They come with specific methods for reading and setting their values.

6.2. Constructor

djnComponent* djnCreateRefProperty (djnComponent* parent, const char* pname, djnComponent* value)

Create a reference property.component. The property is initialized to value.

6.3. Children

None.

6.4. Standard actions

None.

6.5. Special methods

djnComponent* djnGetRefPropertyValue (djnComponent* parent, const char* name)

Get the value of the reference property identified by name in parent.

void djnSetRefPropertyValue (djnComponent* parent, const char* name, djnComponent* value)

Set the value of the reference property identified by name in parent.

7. Binding

7.1. Description

The Binding component is a control structure. It is a coupling between two components: a source and an action. When the source component is activated, the activation is propagated by the binding to the action component. As long as the Binding component is running, it ensures the coupling.

7.2. Constructor

djnComponent* djnCreateBinding (djnComponent* parent, const char* name, djnComponent *source, const char* source_spec, djnComponent *action, const char* action_spec)

Create a Binding component. The source component is specified by the (source, source_spec) couple and the action component is specified by the (action, action_spec) couple.

Note

Specification couples work as follows:

  • if the component pointer is non-null, the text is an additional component specification relative to it; if the text is null, it is the component itself that is chosen.

  • if the component pointer is null, the text is an absolute reference to a component in the application tree.

7.3. Children

None.

7.4. Standard actions

  • RUN: when the binding is activated, a coupling between the source and action components is created. As long as the Binding component is running, this coupling is maintained.

  • STOP: when the binding is stopped, the coupling is destroyed.

8. Watcher

8.1. Description

The Watcher component is a control structure. It is a coupling between a property component and an action. When the property component is modified, this activation is propagated by the Watcher to the action component. As long as the Watcher component is running, it ensures the coupling.

The Watcher component is currently under development, in the future it will work with several properties to watch and it will handle synchronization.

8.2. Constructor

djnComponent* djnCreateWatcher (djnComponent* parent, const char* name, djnComponent* prop, djnComponent* action)

8.3. Children

None.

8.4. Standard actions

  • RUN: when the watcher component is activated, a coupling between the property and the action components is created. As long as the Watcher component is running, the coupling is maintained.

  • STOP: when the watcher component is stopped, the coupling is destroyed.

9. Connector

9.1. Description

The Connector component is a control structure. It is a synchronization between two components: an input and an output. When the input component is modified, it triggers an activation. This activation is propagated by the connector to the ouput component and its value is modified to match the new value of the input. As long as the Connector component is running, it ensures the synchronization.

The Connector component is usually used for dataflow programming.

9.2. Constructor

djnComponent* djnCreateConnector (djnComponent* parent, const char* name, djnComponent* input, const char* input_spec, djnComponent* output, const char* output_spec)

Create a connector component. The source component is specified by the (input, input_spec) couple and the target component is specified by the (output, output_spec) couple.

Note

Specification couples work as follows:

  • if the component pointer is non-null, the text is an additional component specification relative to it; if the text is null, it is the component itself that is chosen.

  • if the component pointer is null, the text is an absolute reference to a component in the application tree.

9.3. Children

None.

9.4. Standard actions

  • RUN: when the connector is activated, the compatibility of the property’s types is checked, a coupling between the input and output elements is created and the value of the input element is assigned to the output element, with conversion if necessary. As long as the Connector component is running, the synchronization between the input and the output element is maintained.

  • STOP: when the connector is stopped, the coupling is destroyed and the synchronization stops.

10. Component

10.1. Description

This class of components is dedicated to creating custom components by assembling existing components. Children components can be added and removed and are stored as an ordered list; the specification tags for inserting components before and after other components in a List can be used when adding children.

When the custom component is activated it propagates the activation to all its children. This propagation is a traversal of the sub-tree composed of the descendents of the component, in depth and from left to right, triggering the activation of the descendents without a isModel argument, or with isModel = 0.

Note

isModel argument work as follows:

  • If isModel = 1, the component is activated only when

    • calling djnRunComponent on the component

    • the component is associated with a binding and the binding is triggered

    • the component is child of a switch and is in the active branch

    • the component is associated to the action of a fsm transition

  • If isModel = 0, the component is also activated with the tree traversal mechanism.

When stopped, it stops all its children.

10.2. Constructor

djnComponent* djnCreateComponent (djnComponent* parent, const char* name)

Create a Custom Component. Sub-components can be added with djnAddChild and removed with djnRemoveChild.

10.3. Children

  • $added: reference to the last added component

  • $removed: reference to the last removed component

10.4. Standard actions

  • RUN: when the custom component is activated, the children of the component are run in an ordered fashion, from the first to the last (depending on the value of the isModel flag)

  • STOP: when the custom component is stopped, the children of the component are stopped in an ordered fashion, from the first to the last (same order as for running; this is subject to future change)

  • ADD: insert at the end of the list

  • REMOVE: remove a given child

11. Blank

11.1. Description

This class of components is dedicated at hosting a collection of children, without propagating the activation to them. They are useful for grouping components without creating any control relationship among them. For instance, to represent a hardware button as a djnn component, one can create a blank component named "button" containing two components named "pressed" and "released", that are activated when the hardware tells so and not when the "button" component is activated by the tree traversal for example.

11.2. Constructor

djnComponent* djnCreateBlank (djnComponent* parent, const char* name)

11.3. Children

None at creation time.

11.4. Standard actions

  • RUN: no action

  • STOP: no action

  • ADD: insert at the end of the list

  • REMOVE: remove a given child

12. List

12.1. Description

This class of components is dedicated to creating an ordered collection of unique children, and offers an easy access to the first, last and "nth" child (n ∈ [1 - count]).

Children components can be added and removed to the list; the specification tags for inserting components before and after other components in the list are:

  • <: at the beginning of the list

  • >: at the end of the list

  • <name: before the component name

  • >name: after the component name

  • <n: before the component at index n

  • >n: after the component at index n

12.2. Constructor

djnComponent* djnCreateList (djnComponent* parent, const char* name)

Create a list component.

Children can be added to the list with the djnAddChild function, the list component being the first parameter and the name of the child (prefixed or not with a specification tag) the second parameter. Children can be removed with the djnRemoveChild function.

The first, last and "nth" child of the list can be accessed through the djnFindComponent function with the second parameter set to < > or n.

12.3. Children

  • <: first item, if any

  • >: last item, if any

  • {n}, where {n} is a number: the nth item in the list, if any

  • $added: reference to the last added component

  • $removed: reference to the last removed component

12.4. Standard actions

  • RUN: when the list component is activated, the children of the list are run in an ordered fashion, from the first to the last (depending on the value of the isModel flag)

  • STOP: when the list component is stopped, the children of the component are stopped in an ordered fashion, from the first to the last (same order as for running; this is subject to future change)

  • ADD: adds a child at a given place

  • REMOVE: removes a given child

13. Set

13.1. Description

This class of components is dedicated to creating a unordered collection of children, and offers an easy access to the last added and last removed child.

For example, a set is used to store the touchpoints on a touch screen: each touch is unique, and their appearance and disappearance are important to retrieve.

13.2. Constructor

djnComponent* djnCreateSet (djnComponent* parent, const char* name)

Create a set component. Children can be added with djnAddChild and removed with djnRemovedChild.

13.3. Children

  • $added: reference to the last added component

  • $removed: reference to the last removed component

13.4. Standard actions

  • RUN: when the set component is activated, the children of the set are run

  • STOP: when the set component is stopped, the children of the set are stopped

  • ADD: insert a child at the end of the set

  • REMOVE: remove a given child

14. LibraryLoader

14.1. Description

This class of components is dedicated to loading dynamically djnn libraries. The djnn library can contain a simple component, a whole djnn tree, an application or even a djn module, as long as it respects the requisite bellow.

The library is a binary library: .dylib, .so or .dll depending on the OS (Mac, Linux or Windows) generated from a djnn C program. This program written in djnn C must contain a method djn_LoadFromThisLibrary that returns one component (the root of all other components implemented in the programm) when executed.

The library path is defined by the uri child. Depending on the value of the autonaming child, the uri is the path to the file (autonaming true) or the name of the file (autonaming false) that will be autocompleted with default library prefix and suffix depending on the OS.

When the LibraryLoader is activated, or when uri or autonaming values change, it loads the specified library and returns the loaded component, without activating it.

14.2. Constructor

djnComponent* djnCreateLibraryLoader (djnComponent* parent, const char* name, const char* uri, int isModel)

Note

isModel argument work as follows:

  • If isModel = 1, the component is activated only when

    • calling djnRunComponent on the component

    • the component is associated with a binding and the binding is triggered

    • the component is child of a switch and is in the active branch

    • the component is associated to the action of a fsm transition

  • If isModel = 0, the component is also activated with the tree traversal mechanism.

14.3. Children

  • uri: where to find the library

  • autonaming: if true, uri is autocompleted with default library prefix and suffix

  • output: the reference to loaded component. This component can be added as a child of other component or activated.

14.4. Standard actions

  • RUN: when the library loader is activated, two couplings to output are created: one from uri and the other one from autonaming; then the library path is resolved, the library is loaded and the output reference property is set with a reference to the loaded component. As long as the Libray Loader component is running, these couplings are maintained.

  • STOP: when the library loader is stopped, the couplings are destroyed.

15. XMLLoader

15.1. Description

This class of components is dedicated to loading djnn XML files. The XML file can contain a djnn application or a djnn component defined with djnn XML format or a graphic design defined with SVG format.

The XML file path is defined by the uri child.

When the XML Loader is activated or when the URI is modified, the XML Loader loads the djnn XML file and returns the root component of the corresponding djnn tree.

15.2. Constructor

djnComponent* djnCreateXMLLoader (djnComponent* parent, const char* name, const char* uri, int isModel)

Note

isModel argument work as follows:

  • If isModel = 1, the component is activated only when

    • calling djnRunComponent on the component

    • the component is associated with a binding and the binding is triggered

    • the component is child of a switch and is in the active branch

    • the component is associated to the action of a fsm transition

  • If isModel = 0, the component is also activated with the tree traversal mechanism.

15.3. Children

  • uri: the path of the xml file

  • output: the reference to the parsed component. It can be added as a child of other component or activated.

15.4. Standard actions

  • RUN: when the XML loader is activated, a coupling between uri and output is created; the XML path is resolved, the XML file is loaded and the output reference property is set with the loaded component. As long as the XML Loader component is running, this coupling is maintained.

  • STOP: when the XML loader is stopped, the coupling is destroyed.

16. Assignment

16.1. Description

The Assignment component is used to assign the value of a component to another component. The assignment is done each time the Assignment component is activated, with type conversion if necessary.

The Assignment component behavior is a one-shot assignment triggered by the activation of the Assignment component, contrary to the Connector component, which is a "continuous" assignment triggered by the activation of the source component.

16.2. Constructor

djnComponent* djnCreateAssignment (djnComponent* parent, const char* name, djnComponent *in, const char *ispec, djnComponent *out, const char *ospec, int isModel)

Create an assignment component. The source component is specified by the (in, ispec) couple and the target component is specified by the (out, ospec) couple.

Note

Specification couples work as follows:

  • if the component pointer is non-null, the text is an additional component specification relative to it; if the text is null, it is the component itself that is chosen.

  • if the component pointer is null, the text is an absolute reference to a component in the application tree.

Note

isModel argument work as follows:

  • If isModel = 1, the component is activated only when

    • calling djnRunComponent on the component

    • the component is associated with a binding and the binding is triggered

    • the component is child of a switch and is in the active branch

    • the component is associated to the action of a fsm transition

  • If isModel = 0, the component is also activated with the tree traversal mechanism.

16.3. Children

None.

16.4. Standard actions

  • RUN: when the assignment component is activated, the compability of the property types is checked and the value of the input element is assigned to the output element, with conversion if necessary.

17. Native Action

17.1. Description

The Native Action component corresponds to what is usually called a callback. It wraps lines of code written directly in the host language that will be executed each time the Native Action component is activated.

17.2. Constructor

djnComponent* djnCreateNativeAction (djnComponent* parent, const char* name, djnNativeCode *action, djnUserData data, int isModel)

Create a component that wraps the action callback function written in C.

Inside the callback function, the component passed as data argument can be accessed with the djnGetNativeUserData(djnComponent* e) function and the source component that triggered the activation of the native action can be retrieved through the djnFindComponent(djnComponent* e, "^") function.

Note

isModel argument work as follows:

  • If isModel = 1, the component is activated only when

    • calling djnRunComponent on the component

    • the component is associated with a binding and the binding is triggered

    • the component is child of a switch and is in the active branch

    • the component is associated to the action of a fsm transition

  • If isModel = 0, the component is also activated with the tree traversal mechanism.

17.3. Children

None.

17.4. Standard actions

  • RUN: when the Native Action component is activated, the associated callback function is executed.

18. Native Resource

18.1. Description

A NativeResource is defined by two callback functions; one is called when the component is run, the other when it is stopped.

The NativeResource component lies somewhere between the callback and the full-fledged native component. It is useful for managing simple resources accessible in the host language through a pair of activation/deactivation functions and for hooking extra processing to the execution of composite components.

18.2. Constructor

djnComponent* djnCreateNativeResource (djnComponent* parent, const char* name, djnNativeCode *run, djnNativeCode* stop, djnUserData data)

Create a new component with two C callback functions run and stop, called respectively when the component is runned and stopped.

Inside the callback function, the component passed as data argument can be accessed with the djnGetNativeUserData(djnComponent* e) function and the source component that triggered the activation of the native action can be retrieved through the djnFindComponent(djnComponent* e, "^") function.

18.3. Children

None.

18.4. Standard actions

  • RUN: call the start callback function

  • STOP: call the stop callback function

19. Native Thread

19.1. Description

A Native Thread component is similar to a Native Action component, the main difference being that the native code is executed in a thread of its own. A thread is created when the Native Thread component is started and destroyed when the component is stopped.

Native threads are currently designed for running purely native code, not djnn components. If djnn components are created in the code of a native thread, the program is likely to crash. If existing components are activated in the code of a native thread, the program may crash too.

19.2. Constructor

djnComponent* djnCreateNativeThread (djnComponent* parent, const char* name, djnNativeCode *action, djnUserData data, int isModel)

Create a native thread component. action is the function run on the new thread. This function is called with a djnComponent* pointer as its only argument.

The value passed in data can be accessed inside the function with djnGetNativeUserData(djnComponent* e).

Note

isModel argument work as follows:

  • If isModel = 1, the component is activated only when

    • calling djnRunComponent on the component

    • the component is associated with a binding and the binding is triggered

    • the component is child of a switch and is in the active branch

    • the component is associated to the action of a fsm transition

  • If isModel = 0, the component is also activated with the tree traversal mechanism.

19.3. Children

  • end: this subcomponent is activated in the main thread when the thread created by the native thread component terminates normally. It is not activated when the thread crashes or is interrupted.

19.4. Standard actions

  • RUN: when the Native Thread component is activated, a secondary thread is created and it executes the function that was passed when creating the component. Note that when activated, the component cannot be activated again to create additional secondary threads; it must stop (either by itself or forcibly) before a new activation is possible.

  • STOP: when the Native Thread component is stopped, the secondary thread is canceled.

20. System hook

20.1. Description

The System Hook implements what is often called a main loop or event loop. When run, it turns a sequential program into a reactive program by waiting for events from the operating system; the program is "hooked to the operating system", and conceptually becomes a persistent part of its execution tree until the system hook is stopped.

There is only one system hook per program. It is created when the core module is initialized.

The standard use of the system hook is to run it at the end of the initialization code of a program. Nevertheless, it can be run and stopped several times if need be. It must be run in every thread that you want to wait for system events.

20.2. Constructor

None.

20.3. Children

None.

20.4. Standard actions

  • RUN: start waiting for events triggered by the operating system and routing them to djnn components. The program enters a loop.

  • STOP: stop waiting for events triggered by the operating system; the program resumes its execution just after the line where it was activated.

Base components

1. Base module

1.1. Description

The base module has the same role as the base library of C. It is a collection of standard components that do not belong to the language itself but are used in almost all applications (timers, logical operators, mathematical operators, text manipulation etc.).

1.2. Initialization

#include <djnn/base.h>

djnInitBase()

2. Clock

2.1. Description

The clock component activates itself and its child tick repeatedly as long as it is running.

2.2. Constructor

djnComponent* djnCreateClock (djnComponent* parent, const char* name, unsigned int period)

Create a clock component that will activate every period milliseconds.

2.3. Children

  • tick: emit an activation repeatedly

  • period: value of the period in milliseconds

2.4. Standard actions

  • RUN: activates the component and create a timer that will activate the component and its child tick repeatedly

  • STOP: stops the timer

3. Exit

3.1. Description

The Exit component ends the application. When activated, it terminates the application with a given return value.

3.2. Constructor

djnComponent* djnCreateExit (djnComponent* parent, const char* name, int value, int isModel)

Create an exit application component with exit value value.

Note

isModel argument work as follows:

  • If isModel = 1, the component is activated only when

    • calling djnRunComponent on the component

    • the component is associated with a binding and the binding is triggered

    • the component is child of a switch and is in the active branch

    • the component is associated to the action of a fsm transition

  • If isModel = 0, the component is also activated with the tree traversal mechanism.

3.3. Children

None.

3.4. Standard actions

  • RUN: exit the application with the given return value

4. FSM

4.1. Description

The FSM is a control structure. A finite-state machine (FSM) component is an abstract machine that can be in only one of a finite number of states at a time.

The state child stores the name of the current state. A transition is a binding between the activation of a source component and the change of state from the current state to another one. The initial state of the FSM is the first added state.

Children can be added freely in each states of the FSM. They are activated only when the state is the current state.

The FSM component can be used in combination with a Switch component. See the Switch component for more information.

4.2. Constructor

djnComponent* djnCreateFSM(djnComponent* parent, const char* name)

Create a finite-state machine component. States can be added with the djnCreateFSMState function, and transitions can be defined with the djnCreateFSMTransition function.

4.3. Children

  • state: the current state of the FSM

4.4. Standard actions

  • RUN: the first added state becomes the current state and is activated

  • STOP: stops the FSM, leaves and stops the current state

5. FSM State

5.1. Description

A FSM State component is one of the possible states of a finite-state machine. FSM states are useful only when they are defined as direct children of a FSM component.

A FSM State can have a list of children, they are activated only when the state is the current state of the FSM.

5.2. Constructor

djnComponent* djnCreateFSMState(djnComponent* fsm, const char* name)

Create a state for the finite-state machine fsm with the name name. When the FSM fsm is in this state, its state property takes the value of name.

5.3. Children

None at creation time. Children can be added freely.

5.4. Standard actions

  • RUN: enables the transitions of the state and activates its children in same order as the children of the List component.

  • STOP: leaves the current state, disables its transition and stops it and all its children.

6. FSM Transition

6.1. Description

A FSM Transition component defines the transition between two given states of a FSM component, on the activation of a source. FSM Transitions are useful only when they are defined as direct children of a FSM component.

The FSM Transition component can also declare a component to be activated when the transition is fired.

6.2. Constructor

djnComponent* djnCreateFSMTransition(djnComponent* fsm, const char* name, djnComponent* from, djnComponent *to, djnComponent* source, const char* source_spec, djnComponent* action, const char* action_spec)

Create a transition from state from to state to. The transition will be fired every time the component specified by the (source, source_spec) couple is activated. When the transition is fired, the component specified by the (action, action_spec) couple will be activated.

Note

Specification couples work as follows:

  • if the component pointer is non-null, the text is an additional component specification relative to it; if the text is null, it is the component itself that is chosen.

  • if the component pointer is null, the text is an absolute reference to a component in the application tree.

6.3. Children

None.

6.4. Standard actions

None.

7. Switch

7.1. Description

A Switch component is controle structure whose only one child is active at any given time.

The Switch component can also be used in combination with a FSM component. A finite-state-machine (FSM) is a controle structure that can be in only one of a finite number of states at a time.

The Switch component can be used in combination with a FSM component by naming with the same names their children and creating a connector between their state children, in order to control the activation of parts of the tree depending on the state of the system.

The Switch component can also be used in combination with an Ascending Comparator component, naming its children true and false and connecting the result of the comparator with the state of the Switch.

7.2. Constructor

djnComponent* djnCreateSwitch (djnComponent* parent, const char* name, const char* initial)

Create a switch component. Initially the child branch named with initial value is activated. When the state child is changed, the switch activates the branch named after state value.

7.3. Children

  • state: the current state of the switch. It can be synchronized by a Connector with the current state of an FSM component or with the result of an Ascending Comparator for example.

7.4. Standard actions

  • RUN: activates the child specified as initial child in the constructor

  • STOP: stops all the children of the Switch.

  • ADD: adds a child to the Switch

  • REMOVE: removes a child from the Switch

8. OR

8.1. Description

The OR component is a binary logical operator. It has three boolean children: left operand, right operand and result. The result child is set to true if and only if one or more of the operands is true.

The component applies the logical rule when it is activated and each time one of the operand children is modified, and sets the result to the result child.

8.2. Constructor

djnComponent* djnCreateOr (djnComponent* p, const char* name, int left, int right)

Create an OR logical operation. left is the left operand, and right the right operand of the logical operator.

For left and right values, a 0 value stands for false and any other value stands for true.

8.3. Children

  • left: left operand of the binary operator

  • right: right operand of the binary operator

  • result: result of the operation updated when the binary operator is activated and each time one of the operands is modified.

8.4. Standard actions

  • RUN: resolves the result of the logical operator and creates a coupling between the change of one of the operands and the calculation of the result.

  • STOP: destroys the couplings on the operands.

9. AND

9.1. Description

The AND component is a binary logical operator. It has three boolean children: left operand, right operand and result. The result child is set to true if and only if all of the operands are true.

The component applies the logical rule when it is activated and each time one of the operand children is modified, and sets the result to the result child.

9.2. Constructor

djnComponent* djnCreateAnd (djnComponent* parent, const char* name, int left, int right)

Create an AND logical operation. left is the left operand, and right the right operand of the logical operator.

For left and right values, a 0 value stands for false and any other value stands for true.

9.3. Children

  • left: left operand of the binary operator

  • right: right operand of the binary operator

  • result: result of the operation updated when the binary operator is activated and each time one of the operands is modified.

9.4. Standard actions

  • RUN: resolves the result of the logical operator and creates a coupling between the change of one of the operands and the calculation of the result.

  • STOP: destroys the couplings on the operands.

10. XOR

10.1. Description

The XOR component is a binary logical operator. It has three boolean children: left operand, right operand and result. The result child is set to true only when both operands differ (one is true, the other is false).

The component applies the logical rule when it is activated and each time one of the operand children is modified, and sets the result to the result child.

10.2. Constructor

djnComponent* djnCreateXor (djnComponent* parent, const char* name, int left, int right)

Create an eXclusive OR operation. left is the left operand, and right the right operand of the logical operator.

For left and right values, a 0 value stands for false and any other value stands for true.

10.3. Children

  • left: left operand of the binary operator

  • right: right operand of the binary operator

  • result: result of the operation updated when the binary operator is activated and each time one of the operands is modified.

10.4. Standard actions

  • RUN: resolves the result of the logical operator and creates a coupling between the change of one of the operands and the calculation of the result.

  • STOP: destroys the couplings on the operands.

11. NOT

11.1. Description

The NOT component is a unary logical operator. It has two children: an input and an output. The output child is set to true when the input is false and vice versa.

The component applies the logical rule when it is activated and each time the input property is modified, and sets the result to the output child.

11.2. Constructor

djnComponent* djnCreateNot (djnComponent* p, const char* name, int input)

Create a NOT logical operation.

For input value, a 0 value stands for false and any other value stands for true.

11.3. Children

  • input: input value of the logical operation

  • output: result of the logical operation

11.4. Standard actions

  • RUN: resolves the result of the logical operator and creates a coupling between the change of input and the calculation of the result.

  • STOP: destroys the coupling on input.

12. NoOp

12.1. Description

The NoOp component is a logical operator with no operation.

12.2. Constructor

djnComponent* djnCreateNoop (djnComponent* p, const char* name)

Create a No Operation component.

12.3. Children

None.

12.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

13. Adder

13.1. Description

The Adder component is a binary mathematical operator. It has three numeric children: left operand, right operand and result.

It adds the values of the two operands when it is activated and each time one of the operands is modified, and sets the result to the result child.

13.2. Constructor

djnComponent* djnCreateAdder (djnComponent* parent, const char* name, double left, double right)

Create an add operation component. left is the left operand, and right the right operand of the mathematical operator.

13.3. Children

  • left: left operand of the binary operator

  • right: right operand of the binary operator

  • result: result of the operation updated when the binary operator is activated and each time one of the operands is modified.

13.4. Standard actions

  • RUN: resolves the result of the mathematical operator and creates a coupling between the change of one of the operands and the calculation of the result.

  • STOP: destroys the couplings on the operands.

14. Subtractor

14.1. Description

The Subtractor component is a binary mathematical operator. It has three numeric children: left operand, right operand and result.

It substracts the values of the two operands when it is activated and each time one of the operands is modified, and sets the result to the result child.

14.2. Constructor

djnComponent* djnCreateSubtractor (djnComponent* parent, const char* name, double left, double right)

Create a subtractor component. left is the left operand, and right the right operand of the mathematical operator.

14.3. Children

  • left: left operand of the binary operator

  • right: right operand of the binary operator

  • result: result of the operation updated when the binary operator is activated and each time one of the operands is modified.

14.4. Standard actions

  • RUN: resolves the result of the mathematical operator and creates a coupling between the change of one of the operands and the calculation of the result.

  • STOP: destroys the couplings on the operands.

15. Multiplier

15.1. Description

The Multiplier component is a binary mathematical operator. It has three numeric children: left operand, right operand and result.

It multiplies the values of the two operands when it is activated and each time one of the operands is modified, and sets the result to the result child.

15.2. Constructor

djnComponent* djnCreateMultiplier (djnComponent* parent, const char* name, double left, double right)

Create a multiplier component. left is the left operand, and right the right operand of the mathematical operator.

15.3. Children

  • left: left operand of the binary operator

  • right: right operand of the binary operator

  • result: result of the operation updated when the binary operator is activated and each time one of the operands is modified.

15.4. Standard actions

  • RUN: resolves the result of the mathematical operator and creates a coupling between the change of one of the operands and the calculation of the result.

  • STOP: destroys the couplings on the operands.

16. Divider

16.1. Description

The Divider component is a binary mathematical operator. It has three numeric children: left operand, right operand and result.

It divides the left operand by the right operand when it is activated and each time one of the operands is modified, and sets the result to the result child.

16.2. Constructor

djnComponent* djnCreateDivider (djnComponent* p, const char* name, double left, double right)

Create a divide operation component. left is the left operand, and right the right operand of the mathematical operator.

16.3. Children

  • left: left operand of the binary operator

  • right: right operand of the binary operator

  • result: result of the operation updated when the binary operator is activated and each time one of the operands is modified.

16.4. Standard actions

  • RUN: resolves the result of the mathematical operator and creates a coupling between the change of one of the operands and the calculation of the result.

  • STOP: destroys the couplings on the operands.

17. Sign inverter

17.1. Description

The Sign Inverter component is a unary mathematical operator. It has two numeric children: input and output.

It inverts the sign of the input value when it is activated and each time the input component is modified, and sets the result to the output child.

17.2. Constructor

djnComponent* djnCreateSignInverter (djnComponent* p, const char* name, double input)

Create an invert component.

When activated, it sets output with the result of "- input" each time input is changed.

17.3. Children

  • input: input value for the mathematical operation

  • output: result of the mathematical operation

17.4. Standard actions

  • RUN: resolves the result of the mathematical operator and creates a coupling between the change of the input and the calculation of the output.

  • STOP: destroys the coupling on the input child.

18. Increment

18.1. Description

An Incr component increments its state every time it is activated. The value of the increment is 1 by default, but it can be changed by setting the delta property. The initial state value is 0, but it can be changed too by setting the state property.

18.2. Constructor

djnComponent* djnCreateIncr (djnComponent* parent, const char* name, int isModel)

Create an increment component.

Note

isModel argument work as follows:

  • If isModel = 1, the component is activated only when

    • calling djnRunComponent on the component

    • the component is associated with a binding and the binding is triggered

    • the component is child of a switch and is in the active branch

    • the component is associated to the action of a fsm transition

  • If isModel = 0, the component is also activated with the tree traversal mechanism.

18.3. Children

  • state: the value that is incremented at each activation. Initially set to 0.

  • delta: the value that is added to state at each activation.

18.4. Standard actions

  • RUN: increments state value with the value of delta

19. Adder accumulator

19.1. Description

The Accumulator component has four numeric children: input, result, clamp_min and clamp_max. It accumulates the successive values of the input child each, bounded by clamp_min and clamp_max values, and set the result to the result child. If the minimum is greater than the maximum, the boundaries are not applied.

The component accumulates the value when it is activated and each time the input child is modified, and sets the result to the result child.

19.2. Constructor

djnComponent* djnCreateAdderAccumulator (djnComponent* parent, const char* name, double input, double clamp_min, double clamp_max)

Create an accumulator component.

19.3. Children

  • input: value to be added to the `result at each activation and each time it is modified

  • clamp_min: minimum bound value

  • clamp_max: maximum bound value

  • result: result of the operation

19.4. Standard actions

  • RUN: calculates the result value and creates a coupling between the change of the input child and the calculation of the result.

  • STOP: destroy the coupling

20. Normalizer

20.1. Description

The Normalizer component is a a mathematical operator. It has four numeric children: an input, a result, a minimum and a maximum. It rescales the input value into the range [0,1] by applying the formula "(input - min) / (max - min)".

The component applies the mathematical rule when it is activated and each time the input, minimum or maximum children are modified, and sets the result to the result child.

20.2. Constructor

djnComponent* djnCreateNormalizer (djnComponent* parent, const char* name, double min, double max, double input)

Create a normalizer component.

20.3. Children

  • input: value to be normalized

  • min: minimum

  • max: maximum

  • result: result of the operation

20.4. Standard actions

  • RUN: calculates the result value and creates coupling on the input, min and max modifications with the calculation of the result.

21. Random generator

21.1. Description

A random generator is a component that, each time it is activated, writes a random integer to its out property.

21.2. Constructor

djnComponent* djnCreateRandomGenerator (djnComponent* parent, const char* name, int model)

Create a random generator.

21.3. Children

  • out: random integer number generated when the component is activated

21.4. Standard actions

  • RUN: activates the component, ensuring that a new random number is generated.

22. Formula

22.1. Description

The Formula component is a mathematical simple formula solver component. The creation of the formula creates also one property child per variable (ie. text element not recognized as an operator) in the equation and one child for the output. The Formula component calculates the result of the given operation and sets the value to the output child.

The calculation is done when the Formula component is activated or whenever one of the input variables is modified.

For example, for the equation x = a + 3 * b the Formula component will have three children named x, a and b. x will be set with the result of the computation each time a or b are modified.

Formulas like x = 2 * x where the input and the output are defined by the same variable are not allowed, as they are introducing loops.

For the moment, recognized mathematical operators are: + - * / =, recognized comparators are: ==`!=` <= < >= > and recognized logical operators are: && || ? and :

22.2. Constructor

djnComponent* djnCreateFormula (djnComponent* parent, const char* name, const char* string)

Create a Formula component. string must be formatted as "left part = right part". left part contains the name of the result variable and right part is a combination of names of variables and operators.

22.3. Children

The input and output children of this component are created dynamically with the variable names given in the formula.

22.4. Standard actions

  • RUN: the children of the formula are run

  • STOP: the children of the formula are stopped

  • ADD: adds a child to the component

  • REMOVE: removes a given child

23. Equality comparator

23.1. Description

The Equality Comparator component is a binary mathematical operator. It has two numeric children: left operand and right operand and a boolean child: result. It compares the values of the operands and sets the result to the result child.

The component applies the logical rule when it is activated and each time one of the operand children is modified, and sets the result to the result child.

23.2. Constructor

djnComponent* djnCreateEqualityComparator (djnComponent* parent, const char* name, double left, double right)

Create an equality comparator component. left is the left operand and right the right operand of the comparator.

23.3. Children

  • left: left operand of the binary operator

  • right: right operand of the binary operator

  • result: result of the operation updated when the binary operator is activated and each time one of the operands is modified.

23.4. Standard actions

  • RUN: resolves the result of the comparison and creates a coupling between the changes of one of the operands and the calculation of the result.

  • STOP: destroys the couplings on the operands.

24. Ascending comparator

24.1. Description

The Ascending Comparator component is a binary operator. It has two numeric children: left operand and right operand and a boolean child: result. It compares (like "⇐") the values of the two operands and sets the result to the result child.

The component applies the logical rule when it is activated and each time one of the operand children is modified, and sets the result to the result child.

24.2. Constructor

djnComponent* djnCreateAscendingComparator (djnComponent* parent, const char* name, double left, double right)

Create an ascending comparator component. left is the left operand, and right the right operand of the logical operator.

24.3. Children

  • left: left operand of the binary operator

  • right: right operand of the binary operator

  • result: result of the operation updated when the binary operator is activated and each time one of the operands is modified.

24.4. Standard actions

  • RUN: resolves the result of the operator and creates a coupling between the change of one of the operands and the calculation of the result.

  • STOP: destroys the couplings on the operands.

25. Strict ascending comparator

25.1. Description

The Strict Ascending Comparator component is a binary operator. It has two numeric children: left operand and right operand and a boolean child: result. It compares (like "<") the values of the two operands and sets the result to the result child.

The component applies the logical rule when it is activated and each time one of the operand children is modified, and sets the result to the result child.

25.2. Constructor

djnComponent* djnCreateStrictAscendingComparator (djnComponent* parent, const char* name, double left, double right)

Create a strict ascending comparator component. left is the left operand, and right the right operand of the logical operator.

25.3. Children

  • left: left operand of the binary operator

  • right: right operand of the binary operator

  • result: result of the operation updated when the binary operator is activated and each time one of the operands is modified.

25.4. Standard actions

  • RUN: resolves the result of the logical operator and creates a coupling between the change of one of the operands and the calculation of the result.

  • STOP: destroys the couplings on the operands.

26. Text catenator

26.1. Description

The Text Catenator component concatenates two text properties in one. It has three text children: head, tail and output. It concatenates the values of hand and tail and set the output child with the result.

The component applies the concatenation when it is activated and each time one of the input children (head or tail) is modified, and sets the result to the output child.

26.2. Constructor

djnComponent* djnCreateTextCatenator (djnComponent* parent, const char* name)

Create a component that concatenates head with tail.

26.3. Children

  • head: head of the text

  • tail: tail of the text

  • output: result of the concatenation

26.4. Standard actions

  • RUN: concatenates head and tail values and set output child with the result, creates couplings between head or tail modifications and the concatenation.

  • STOP: destroys the couplings

27. Text comparator

27.1. Description

The Text Comparator component is a binary operator. It has two textual children: left operand and right operand and a boolean child: result. It compares (like the "==" operator) the values of the operands and sets the result to the result child.

The component applies the logical rule when it is activated and each time one of the operand children is modified, and sets the result to the result child.

27.2. Constructor

djnComponent* djnCreateTextComparator (djnComponent* parent, const char* name, const char *left, const char *right)

Create a component that compares left and right. left is the left operand, and right the right operand of the comparator.

27.3. Children

  • left: left operand of the binary operator

  • right: right operand of the binary operator

  • result: result of the operation updated when the binary operator is activated and each time one of the operands is modified.

27.4. Standard actions

  • RUN: resolves the result of the comparison and creates a coupling between the changes of one of the operands and the calculation of the result.

  • STOP: destroys the couplings on the operands.

28. Text printer

28.1. Description

The Text Printer component prints text on the standard output. Each printed text is followed by a new-line character.

The text is printed each time the input child of the Text Printer is modified.

28.2. Constructor

djnComponent* djnCreateTextPrinter (djnComponent* parent, const char* name)

28.3. Children

  • input: text to be printed

28.4. Standard actions

  • RUN: creates a coupling between the modification of the input child and the printing of its value

  • STOP: destroys the coupling

29. Log printer

29.1. Description

Log printers are components that labelize a simple text property into the console. Usually used for debugging or for printing specific information. It can be used for example to print a specific text like the name of a component, followed by the actual value of the component.

29.2. Constructor

djnComponent* djnCreateLogPrinter (djnComponent* parent, const char* name, const char* label)

Create a LogPrinter component, and initialize its label property.

29.3. Children

  • label: text printed before input

  • input: text to be printed

29.4. Standard actions

  • RUN: creates a coupling between the modification of the input or label children and the printing of the concatenation of both

  • STOP: destroys the coupling

30. Regexp filter

30.1. Description

The Regexp Filter has two text children: one input and one output. It applies a regular expression on the input value and sets the result of the pattern matching on the output child.

The matching is performed each time the input child is modified.

30.2. Constructor

djnComponent* djnCreateRegexpFilter(djnComponent* parent, const char* name, const char* expr)

Create a component that applies the expr regular expression to its input child.

30.3. Children

  • input: input text

  • output: result of the regexp on the input text

30.4. Standard actions

  • RUN: creates a coupling between the modification of the input child and the pattern matching.

  • STOP: destroys the coupling

31. Ivy access

31.1. Description

An IvyAccess component connects the program to an Ivy bus and can be used to send and/or subscribe to messages on the bus. Messages are sent by setting the out text property. Subscriptions are created by binding to children of the in child of the IvyAccess component.

31.2. Constructor

djnComponent* djnCreateIvyAccess (djnComponent* parent, const char* name, const char* bus, const char* appname, const char* ready)

Create an access for Ivy protocol on the bus defined by bus.

It allows to send message via the out text property and to receive messages via in/[regexp].

appname is the name communicated by this access.

ready is the message sent when the Ivy access is ready.

31.3. Children

  • out: text property whose value is sent on the bus whenever it is set.

  • in/*: children that materialize Ivy subscriptions. For instance, binding to in/hello (.*) ensures that the action of the binding is activated wheneven a message on the bus matches the hello (.*) regular expression. The text captures in the regular expression can be accessed by their number as children of the regular expression. For instance, when hello world is detected on the bus, in/hello (.*)/1 will contain world.

  • arriving: names of the agents that connect to this agent on the Ivy bus. Whenever an agent is discovered, whether because it was already there or because it just connected, this text property is set to the name of this agent.

  • leaving: names of the agents that disconnect from the Ivy bus. Whenever an agent leaves, either voluntarily or because the connection failed, this text property is set to the name of this agent.

31.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

GUI components

1. GUI module

1.1. Description

The GUI module contains the basic components for creating graphical user interfaces: graphical shapes (rectangle, ellipse, polygon, etc.), style properties (fill, stroke, gradient etc.), and geometrical transformations.

It also provides a hit detection mechanism that allows to subscribe to pointing devices events through the graphical shapes.

1.2. Initialization

#include <djnn/gui.h>

djnInitGUI()

2. Frame

2.1. Description

to be written

2.2. Constructor

djnComponent* djnCreateGUIFrame (djnComponent* parent, const char* name, const char* title, int x, int y, int width, int heigh)

Create a frame component, when activated it displays a window with the window title title.

2.3. Children

  • title: the window title, by default "djnn window"

  • x: abscissa of the window

  • y: ordinate of the window

  • width: width of the window

  • height: height of the window

  • press: mouse pressed event. The press componment has 2 children: x and y

  • release: mouse released event

  • move: mouse moved event. The move component has 2 children: x and y

  • close: window closed event

2.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

3. Group

3.1. Description

to be written

3.2. Constructor

djnComponent* djnCreateGUIGroup (djnComponent* parent, const char* name)

Create a group component with an empty list of components. Shapes can be added to the group with djnAddChild function and removed with djnRemoveChild function.

3.3. Children

  • $added: reference to the last added component

  • $removed: reference to the last removed component

3.4. Standard actions

  • RUN: runs all its children, starting them in order

  • STOP: stops all its children. Currently in the same order as RUN, but this is subject to change

  • PAINT: paints all its children

  • ADD: <xxx inserts before child named xxx, >xxx inserts after child named xxx, < inserts at the beginning of the list, > inserts at the end of the list

  • REMOVE: removes the child

4. Rectangle

4.1. Description

to be written

4.2. Constructor

djnComponent* djnCreateGUIRectangle (djnComponent* parent, const char* name, double x, double y, double width, double height, double rx, double ry)

Create a rectangle component and display it in the last frame created before it in the tree.

4.3. Children

  • x: abscissa of the rectangle

  • y: ordinate of the rectangle

  • width: width of the rectangle

  • height: height of the rectangle

  • rx: horizontal size of the round corners

  • ry: vertical size of the round corners

  • press: mouse pressed event. The press component has 2 children: x and y

  • release: mouse released event

  • move: mouse moved event. The move component has 2 children: x and y

  • enter: mouse enter event

  • leave: mouse leave event

4.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

5. Ellipse

5.1. Description

to be written

5.2. Constructor

djnComponent* djnCreateGUIEllipse (djnComponent* parent, const char* name, double cx, double cy, double rx, double ry)

Create an ellipse component and display it in the last frame created before it in the tree.

5.3. Children

  • cx: abscissa of the center of the ellipse

  • cy: ordinate of the center of the ellipse

  • rx: horizontal radius of the ellipse

  • ry: vertical radius of the ellipse

  • press: mouse pressed event. The press component has 2 children: x and y

  • release: mouse released event

  • move: mouse moved event. The move component has 2 children: x and y

  • enter: mouse enter event

  • leave: mouse leave event

5.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

6. Circle

6.1. Description

to be written

6.2. Constructor

djnComponent* djnCreateGUICircle (djnComponent* parent, const char* name, double cx, double cy, double r)

Create a circle component and display it in the last frame created before it in the tree.

6.3. Children

  • cx: abscissa of the center of the circle

  • cy: ordinate of the center of the circle

  • r: radius of the circle

  • press: mouse pressed event. The press component has 2 children: x and y

  • release: mouse released event

  • move: mouse moved event. The move component has 2 children: x and y

  • enter: mouse enter event

  • leave: mouse leave event

6.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

7. Line

7.1. Description

to be written

7.2. Constructor

djnComponent* djnCreateGUILine (djnComponent* parent, const char* name, double x1, double y1, double x2, double y2)

Create a line component and display it in the last frame created before it in the tree.

7.3. Children

  • x1: abscissa of the first point of the line

  • y1: ordinate of the first point of the line

  • x2: abscissa of the second point of the line

  • y2: ordinate of the second point of the line

  • press: mouse pressed event. The press component has 2 children: x and y

  • release: mouse released event

  • move: mouse moved event. The move component has 2 children: x and y

  • enter: mouse enter event

  • leave: mouse leave event

7.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

8. Text

8.1. Description

to be written

8.2. Constructor

djnComponent* djnCreateGUIText (djnComponent* parent, const char* name, double x, double y, const char* text)

Create a text component and display it in the last frame created before it in the tree.

8.3. Children

  • x: abscissa of the text

  • y: ordinate of the text

  • dx: delta abscissa of the text.

  • dy: delta ordinate of the text.

  • dxUnit: unit of the delta abscissa of the text

  • dyUnit: unit of the delta ordinate of the text

  • width: width of the text

  • height: height of the text

  • text: value of the text.

  • encoding: encoding of the text.

  • press: mouse pressed event. The press component has 2 children: x and y

  • release: mouse released event

  • move: mouse moved event. The move component has 2 children: x and y

  • enter: mouse enter event

  • leave: mouse leave event

8.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

9. Relative text

9.1. Description

to be written

9.2. Constructor

djnComponent* djnCreateGUIRelativeText (djnComponent* parent, const char* name, double x, double y, double dx, double dy, int dxUnit, int dyUnit, const char *encoding, const char* text)

Create a relative text component and display it in the last frame created before it in the tree.

The value of dxUnit and dyUnit can be djnGUINoUnit, djnGUIEm, djnGUIEx, djnGUIPc, djnGUIPt, djnGUIPx, djnGUICm, djnGUIMm, djnGUIIn, djnGUIPercent.

The value of encoding can be "ISO-8859-1", "ASCII" or "Utf8".

9.3. Children

  • x: abscissa of the text

  • y: ordinate of the text

  • dx: relative abscissa of the text

  • dy: relative ordinate of the text

  • dxUnit: abscissa unit.

  • dyUnit: ordinate unit.

  • encoding: encoding of the text

  • text: value of the text

  • press: mouse pressed event. The press component has 2 children: x and y

  • release: mouse released event

  • move: mouse moved event. The move component has 2 children: x and y

  • enter: mouse enter event

  • leave: mouse leave event

9.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

10. Polyline

10.1. Description

to be written

10.2. Constructor

djnComponent* djnCreateGUIPolyline (djnComponent* parent, const char* name)

Create an open polyline component and display it in the last frame created before it in the tree.

A polyline consists in a list of points, a point is a component with two children x and y.

A point can be accessed through its index in the points list of the polyline: djnFindComponent(myPolyline, « points/1 ») for example.

10.3. Children

  • points: list of the points

  • press: mouse pressed event. The press component has 2 children: x and y

  • release: mouse released event

  • move: mouse moved event. The move component has 2 children: x and y

  • enter: mouse enter event

  • leave: mouse leave event

10.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

11. Polygon

11.1. Description

to be written

11.2. Constructor

djnComponent* djnCreateGUIPolygon (djnComponent* parent, const char* name)

Create a closed polygon component and display it in the last frame created before it in the tree.

A polygon consists in a list of points, a point is a component with two children x and y.

A point can be accessed through its index in the points list of the polygon: djnFindComponent(myPolygon, « points/1 ») for example.

11.3. Children

  • points: list of the points

  • press: mouse pressed event. The press component has 2 children: x and y

  • release: mouse released event

  • move: mouse moved event. The move component has 2 children: x and y

  • enter: mouse enter event

  • leave: mouse leave event

11.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

12. Point

12.1. Description

to be written

12.2. Constructor

djnComponent* djnCreateGUIPolyPoint (djnComponent* component, const char* name, double x, double y)

Create a point and add it at the end of the points list of component. component must be a polyline or a polygon component.

djnComponent* djnInsertGUIPolyPoint (djnComponent* component, const char* name, const char* spec, double x, double y)

Create a point and add it to the points list of component. component must be a polyline or a polygon component.

The spec argument specifies where to insert the new point in the list. Its value can be:

  • <n inserts before child named n,

  • >n inserts after child named n,

  • < inserts at the beginning of the list,

  • > inserts at the end of the list

12.3. Children

  • x: abscissa of the point

  • y: ordinate of the point

12.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

13. Path

13.1. Description

to be written

13.2. Constructor

djnComponent* djnCreateGUIPath (djnComponent* parent, const char* name)

Create a path component and display it in the last frame created before it in the tree.

An item of the path can be accessed through its index in the djnList items, djnFindComponent(myPath, « items/1 ») for example.

13.3. Children

  • items: list of the points

  • press: mouse pressed event. The press component has 2 children: x and y

  • release: mouse released event

  • move: mouse moved event. The move component has 2 children: x and y

  • enter: mouse enter event

  • leave: mouse leave event

13.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

14. Subpath

14.1. Description

to be written

14.2. Constructor

djnComponent* djnCreateGUIPathSubpath (djnComponent* component, const char* name, double x, double y)

Create a subpath and add it at the end of the items list of component. component must be a path component.

djnComponent* djnInsertGUIPathSubpath (djnComponent* component, const char* name, const char* spec, double x, double y)

Create a subpath and add it to the items list of component. component must be a path component.

The spec argument specifies where to insert the new subpath in the list. Its value can be:

  • <n inserts before child named n,

  • >n inserts after child named n,

  • < inserts at the beginning of the list,

  • > inserts at the end of the list

14.3. Children

  • x: abscissa of the new point

  • y: ordinate of the new point

14.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

15. Path line

15.1. Description

to be written

15.2. Constructor

djnComponent* djnCreateGUIPathLine (djnComponent* component, const char* name, double x, double y)

Create a line and add it at the end of the items list of component. component must be a path component.

djnComponent* djnInsertGUIPathLine (djnComponent* component, const char* name, const char* spec, double x, double y)

Create a line and add it to he items list of component. component must be a path component.

The spec argument specifies where to insert the new line in the list. Its value can be:

  • <n inserts before child named n,

  • >n inserts after child named n,

  • < inserts at the beginning of the list,

  • > inserts at the end of the list

15.3. Children

  • x: abscissa of the new point

  • y: ordinate of the new point

15.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

16. Path quadratic

16.1. Description

to be written

16.2. Constructor

djnComponent* djnCreateGUIPathQuadratic (djnComponent* component, const char* name, double x1, double y1, double x, double y)

Create a quadratic curve and add it at the end of the items list of component. component must be a path component.

djnComponent* djnInsertGUIPathQuadratic (djnComponent* component, const char* name, const char* spec, double x1, double y1, double x, double y)

Create a quadratic curve and add it to the items list of component. component must be a path component.

The spec argument specifies where to insert the new arc in the list. Its value can be:

  • <n inserts before child named n,

  • >n inserts after child named n,

  • < inserts at the beginning of the list,

  • > inserts at the end of the list

16.3. Children

  • x1: abscissa of the control point

  • y1: ordinate of the control point

  • x: abscissa of the new point

  • y: ordinate of the new point

16.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

17. Path cubic

17.1. Description

to be written

17.2. Constructor

djnComponent* djnCreateGUIPathCubic (djnComponent* component, const char* name, double x1, double y1, double x2, double y2, double x, double y)

Create a cubic curve and add it at the end of the list of the items list of component. component must be a path component.

djnComponent* djnInsertGUIPathCubic (djnComponent* component, const char* name, const char* spec, double x1, double y1, double x2, double y2, double x, double y)

Create a cubic curve and add it to the items list of component. component must be a path component.

The spec argument specifies where to insert the new curve in the list. Its value can be:

  • <n inserts before child named n,

  • >n inserts after child named n,

  • < inserts at the beginning of the list,

  • > inserts at the end of the list

17.3. Children

  • x1: abscissa of the control point at the beginning of the curve

  • y1: ordinate of the control point at the beginning of the curve

  • x2: abscissa of the control point at the end of the curve

  • y2: ordinate of the control point at the end of the curve

  • x: abscissa of the new point

  • y: ordinate of the new point

17.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

18. Path arc

18.1. Description

to be written

18.2. Constructor

djnComponent* djnCreateGUIPathArc (djnComponent* component, const char* name, double rx, double ry, double rotx, double fl, double swfl, double x, double y)

Create an elliptical arc and add it at the end of the items list of component. component must be a path component.

djnComponent* djnInsertGUIPathArc (djnComponent* component, const char* name, const char* spec, double rx, double ry, double rotx, double fl, double swfl, double x, double y)

Create an elliptical arc and add it the items list of component. component must be a path component.

The spec argument specifies where to insert the new arc in the list. Its value can be:

  • <n inserts before child named n,

  • >n inserts after child named n,

  • < inserts at the beginning of the list,

  • > inserts at the end of the list

18.3. Children

  • rx: horizontal radius of the ellipse

  • ry: vertical radius of the ellipse

  • rotx: orientation of the ellipse. It indicates how the ellipse as a whole is rotated relative to the current coordinate system

  • fl: large arc flag. If fl is 1, then one of the two larger arc sweeps (>180°) will be chosen; otherwise, if fl is 0, one of the smaller arc sweeps will be chosen.

  • swfl: sweep flag. If swfl is 1, then the arc will be drawn in a "positive-angle" direction. A value of 0 causes the arc to be drawn in a "negative-angle" direction.

  • x: abscissa of the new point

  • y: ordinate of the new point

See the SVG specification for more information and illustrations

18.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

19. Path closure

19.1. Description

to be written

19.2. Constructor

djnComponent* djnCreateGUIPathClosure (djnComponent* component, const char* name)

Create a path closure component and add it at the end of the items list of component. component must be a path component.

Path closure causes an automatic straight line to be drawn from the current point to the initial point of the current subpath.

djnComponent* djnInsertGUIPathClosure (djnComponent* component, const char* name, const char* spec)

Create a path closure component and add it to the items list of component. component must be a path component.

Path closure causes an automatic straight line to be drawn from the current point to the initial point of the current subpath.

The spec argument specifies where to insert the new closure in the list. Its value can be:

  • <n inserts before child named n,

  • >n inserts after child named n,

  • < inserts at the beginning of the list,

  • > inserts at the end of the list

19.3. Children

None.

19.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

20. Clip rectangle

20.1. Description

to be written

20.2. Constructor

djnComponent* djnCreateGUIRectangleClip (djnComponent* parent, const char* name, double x, double y, double width, double height)

Create a rectangle component used for clipping. When activated, the clipping applies to all its siblings defined after itself in the tree.

20.3. Children

  • x: abscissa of the rectangle

  • y: ordinate of the rectangle

  • width: width of the rectangle

  • height: height of the rectangle

  • press: mouse pressed event. The press component has 2 children: x and y

  • release: mouse released event

  • move: mouse moved event. The move component has 2 children: x and y

  • enter: mouse enter event

  • leave: mouse leave event

20.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

21. Clip path

21.1. Description

to be written

21.2. Constructor

djnComponent* djnCreateGUIPathClip (djnComponent* parent, const char* name)

Create a path used for clipping. When activated, the clipping applies to all its siblings defined after itself in the tree.

21.3. Children

  • items: list of the points

  • press: mouse pressed event. The press component has 2 children: x and y

  • release: mouse released event

  • move: mouse moved event. The move component has 2 children: x and y

  • enter: mouse enter event

  • leave: mouse leave event

21.4. Standard actions

  • RUN: ensures that the path-shaped clip is applied when rendering the graphical scene. The scene is rendered if necessary to reflect this.

  • STOP: ensures that the path-shaped clip is not applied anymore until it is activated again. The scene is rendered if necessary to reflect this.

22. Image

22.1. Description

to be written

22.2. Constructor

djnComponent* djnCreateGUIImage (djnComponent* parent, const char* name, const char *path, double x, double y, double width, double height)

Create an image component and display it in the last frame created before it in the tree.

22.3. Children

  • x: abscissa of the image

  • y: ordinate of the image

  • width: width of the image

  • height: height of the image

  • path: path of the image

  • press: mouse pressed event. The press component has 2 children: x and y

  • release: mouse released event

  • move: mouse moved event. The move component has 2 children: x and y

  • enter: mouse enter event

  • leave: mouse leave event

22.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

23. Outline color

23.1. Description

to be written

23.2. Constructor

djnComponent* djnCreateGUIOutlineColor (djnComponent* parent, const char* name, unsigned r, unsigned g, unsigned b)

Create an outline color component of color #rgb. The outline color is added to the context and applied to all graphical objects after it in the tree (until a new OutlineColor component is defined).

23.3. Children

  • r: red value

  • g: green value

  • b: blue value

23.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

24. No outline

24.1. Description

to be written

24.2. Constructor

djnComponent* djnCreateGUINoOutline (djnComponent* parent, const char* name)

Create a no outline component. The no outline is added to the context and applied to all graphical objects after it in the tree (until a new outlineColor component is defined).

24.3. Children

None.

24.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

25. Fill color

25.1. Description

to be written

25.2. Constructor

djnComponent* djnCreateGUIFillColor (djnComponent* parent, const char* name, unsigned r, unsigned g, unsigned b)

Create a fill color component of color #rgb. The fill color is added to the context and applied to all graphical objects after it in the tree (until a new fill color is defined).

25.3. Children

  • r: red value

  • g: green value

  • b: blue value

25.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

26. No fill

26.1. Description

to be written

26.2. Constructor

djnComponent* djnCreateGUINoFill (djnComponent* parent, const char* name)

Create a no fill component. The no fill is added to the context and applied to all graphical objects after it in the tree (until a new fillColor component is defined).

26.3. Children

None.

26.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

27. Texture

27.1. Description

to be written

27.2. Constructor

djnComponent* djnCreateGUITexture (djnComponent *parent const char* name, const char* path)

Create a texture component from the file located at path. The texture is added to the context and applied to all graphical objects after it in the tree (until a new fill or gradient component is defined).

27.3. Children

  • path: path of the texture file

27.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

28. Fill rule

28.1. Description

to be written

28.2. Constructor

djnComponent* djnCreateGUIFillRule (djnComponent *parent, const char* name, djnGUIFillRuleType rule)

Create a rule component that indicates the algorithm which is to be used to determine what parts of the canvas are included inside the shape for filling.

The fill rule is added to the context and applied to all fillColor components after it in the tree (until a new fill rule is defined).

rule can take the following values:

  • djnGUINonZero determines the "insideness" of a point on the canvas by drawing a ray from that point to infinity in any direction and then examining the places where a segment of the shape crosses the ray. Starting with a count of zero, add one each time a path segment crosses the ray from left to right and subtract one each time a path segment crosses the ray from right to left. After counting the crossings, if the result is zero then the point is outside the path. Otherwise, it is inside.

  • djnGUIEvenOdd determines the "insideness" of a point on the canvas by drawing a ray from that point to infinity in any direction and counting the number of path segments from the given shape that the ray crosses. If this number is odd, the point is inside; if even, the point is outside.

28.3. Children

  • rule: rule to be used

See W3C SVG specifications for more information and illustrations

28.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

29. Outline opacity

29.1. Description

to be written

29.2. Constructor

djnComponent* djnCreateGUIOutlineOpacity (djnComponent* parent, const char* name, double a)

Create an outline opacity component of opacity a. The outline opacity is added to the context and applied to all graphical objects after it in the tree (until a new OutlineOpacity component is defined).

29.3. Children

  • a: opacity value

29.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

30. Fill opacity

30.1. Description

to be written

30.2. Constructor

djnComponent* djnCreateGUIFillOpacity (djnComponent* parent, const char* name, double a)

Create a fill opacity component of opacity a. The fill opacity is added to the context and applied to all graphical objects after it in the tree (until a new fill opacity is defined).

30.3. Children

  • a: opacity value

30.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

31. Outline width

31.1. Description

to be written

31.2. Constructor

djnComponent* djnCreateGUIOutlineWidth (djnComponent* parent, const char* name, double w)

Create an outline width component of width w. The outline width is added to the context and applied to all graphical objects after it in the tree (until a new OutlineWidth component is defined).

31.3. Children

  • w: width of the stroke

31.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

32. Outline cap style

32.1. Description

to be written

32.2. Constructor

djnComponent* djnCreateGUIOutlineCapStyle (djnComponent* parent, const char* name, djnGUICapStyle cap)

Create a cap style component that specifies the shape to be used at the end of open subpaths when they are stroked.

The cap style is added to the context and applied to all outlines after it in the tree (until a new CapStyle component is defined).

cap value can be: djnGUIButt, djnGUIRound or djnGUISquare

32.3. Children

  • cap: cap style

See W3C SVG specifications for more information and illustrations

32.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

33. Outline join style

33.1. Description

to be written

33.2. Constructor

djnComponent* djnCreateGUIOutlineJoinStyle (djnComponent* parent, const char* name, djnGUIJoinStyle join)

Create a join style component that specifies the shape to be used at the corners of paths or basic shapes when they are stroked.

The join style is added to the context and applied to all outlines after it in the tree (until a new JoinStyle component is defined).

join value can be: djnGUIMiterJoin, djnGUIRoundJoin or djnGUIBevelJoin.

33.3. Children

  • join: join style

See W3C SVG specifications for more information and illustrations

33.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

34. Outline miter limit

34.1. Description

to be written

34.2. Constructor

djnComponent* djnCreateGUIOutlineMiterLimit (djnComponent* parent, const char* name, unsigned limit)

Create a miter limit component that specifies the limit on the ratio of the miter length to the outlineWidth.

When two line segments meet at a sharp angle and miter joins have been specified for OutlineJoinStyle, it is possible for the miter to extend far beyond the thickness of the line stroking the path. When the miter limit is exceeded, the join is converted from a miter to a bevel.

The miter limit is added to the context and applied to all outlines after it in the tree (until a new MiterLimit component is defined).

The value of limit must be a number greater than or equal to 1.

34.3. Children

  • limit: miter limit

See W3C SVG specifications for more information and illustrations

34.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

35. Dash array

35.1. Description

to be written

35.2. Constructor

djnComponent* djnCreateGUIDashArray (djnComponent* parent, const char* name)

Create an empty dash array component. The dash array is added to the context and applied to all outline components after it in the tree (until a new dash array is defined).

void djnCreateGUIDashSubPattern (djnComponent* component, unsigned dash, unsigned space)

Add a dashed subpattern to a dash array. component must be a djnGUIDashArray.

35.3. Children

None.

35.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

36. No dash array

36.1. Description

to be written

36.2. Constructor

djnComponent* djnCreateGUINoDashArray (djnComponent* parent, const char* name)

Create a no dash array component that indicates that no dashing is used. If stroked, the line is drawn solid.

The no dash array is added to the context and applied to all outline components after it in the tree (until a new dash array is defined).

36.3. Children

None.

36.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

37. Dash offset

37.1. Description

to be written

37.2. Constructor

djnComponent* djnCreateGUIDashOffset (djnComponent* parent, const char* name, unsigned offset)

Create a dash offset component of offset offset that specifies the distance into the dash pattern to start the dash.

The dash offset is added to the context and applied to all dash arrays component after it in the tree (until a new dash offset is defined).

37.3. Children

  • offset: offset value

37.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

38. Linear gradient

38.1. Description

to be written

38.2. Constructor

djnComponent* djnCreateGUILinearGradient (djnComponent* parent, const char* name, double x1, double y1, double x2, double y2, djnGUIFillSpread spreads, djnGUIFillCoords coords)

Create a linear gradient component. The linear gradient is added to the context and applied to all graphical objects after it in the tree (until a new linear gradient is defined).

x1, y1, x2 and y2 define a gradient vector for the linear gradient.

This gradient vector provides starting and ending points onto which the gradient stops are mapped. The values of x1, y1, x2 and y2 can be either numbers or percentages.

spreads indicates what happens if the gradient starts or ends inside the bounds of the target rectangle. Possible values are: djnGUIPad, which says to use the terminal colors of the gradient to fill the remainder of the target region, djnGUIReflect, which says to reflect the gradient pattern start-to-end, end-to-start, start-to-end, etc. continuously until the target rectangle is filled, and djnGUIRepeat, which says to repeat the gradient pattern start-to-end, start-to-end, start-to-end, etc. continuously until the target region is filled.

coords defines the coordinate system for attributes x1, y1, x2 and y2. Possible values are: djnGUIRenderingCoords, which corresponds to the current user coordinate system in place at the time when the gradient component is referenced, or djnGUILocalCoords, which is established using the bounding box of the component to which the gradient is applied.

38.3. Children

  • x1: abscissa for the first point of the gradient vector

  • y1: ordinate for the first point of the gradient vector

  • x2: abscissa for the second point of the gradient vector

  • y2: ordinate for the second point of the gradient vector

  • spreads: value of the spreads

  • coords: value of the coordinate system

  • stops: list of gradient stops

  • transforms: list of gradient transformations

See W3C SVG specifications for more information and illustrations

38.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

39. Radial gradient

39.1. Description

to be written

39.2. Constructor

djnComponent* djnCreateGUIRadialGradient (djnComponent* parent, const char* name, double cx, double cy, double r, double fx, double fy, djnGUIFillSpread spreads, djnGUIFillCoords coords)

Create a radial gradient component. The radial gradient is added to the context and applied to all graphical objects after it in the tree (until a new gradient or fill component is defined).

cx, cy and r define the largest (i.e., outermost) circle for the radial gradient. The gradient will be drawn such that the 100% gradient stop is mapped to the perimeter of this largest (i.e., outermost) circle.

fx and fy define the focal point for the radial gradient. The gradient will be drawn such that the 0% gradient stop is mapped to (fx, fy).

spreads indicates what happens if the gradient starts or ends inside the bounds of the target rectangle. Possible values are: djnGUIPad, which says to use the terminal colors of the gradient to fill the remainder of the target region, djnGUIReflect, which says to reflect the gradient pattern start-to-end, end-to-start, start-to-end, etc. continuously until the target rectangle is filled, and djnGUIRepeat, which says to repeat the gradient pattern start-to-end, start-to-end, start-to-end, etc. continuously until the target region is filled.

coords defines the coordinate system for attributes x1, y1, x2 and y2. Possible values are: djnGUIRenderingCoords, which corresponds to the current user coordinate system in place at the time when the gradient component is referenced, or djnGUILocalCoords, which is established using the bounding box of the component to which the gradient is applied.

39.3. Children

  • cx: abscissa for the center of the circle

  • cy: ordinate for the center of the circle

  • r: ratio of the circle

  • fx: abscissa for the focal point

  • fy: ordinate for the focal point

  • spreads: value of the spreads

  • coords: value of the coordinate system

  • stops: list of gradient stops

  • transforms: list of gradient transformations

See W3C SVG specifications for more information and illustrations

39.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

40. Gradient stop

40.1. Description

to be written

40.2. Constructor

djnComponent* djnCreateGUIGradientStop (djnComponent* component, unsigned r, unsigned g, unsigned b, double opacity, double offset)

Create a gradient stop that defines the ramp of colors to use on a gradient and add it to the stops list of component. component must be a linear gradient or a radial gradient.

The offset attribute is either a number (usually ranging from 0 to 1) or a percentage (usually ranging from 0% to 100%) which indicates where the gradient stop is placed.

For linear gradients, the offset attribute represents a location along the gradient vector. For radial gradients, it represents a percentage distance from (fx,fy) to the edge of the outermost/largest circle.

r, g, b and opacity indicate what color and opacity to use at that gradient stop.

40.3. Children

  • r: red value

  • g: green value

  • b: blue value

  • offset: offset indicating where the gradient stop is placed

  • opacity: opacity value

See W3C SVG specifications for more information and illustrations

40.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

41. Gradient translation

41.1. Description

to be written

41.2. Constructor

djnComponent* djnCreateGUIGradientTranslation (djnComponent *component, const char* name, double tx, double ty)

Create a translation component and add it to the transforms list of component.

component must be a linear or a radial gradient.

41.3. Children

  • tx: horizontal value

  • ty: vertical value

41.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

42. Gradient rotation

42.1. Description

to be written

42.2. Constructor

djnComponent* djnCreateGUIGradientRotation (djnComponent *component, const char* name, double a, double cx, double cy)

Create a rotation component and add it to the transforms list of component.

component must be a linear or a radial gradient.

42.3. Children

  • a: angle of the rotation

  • cx: abscissa of the center of the rotation

  • cy: ordinate of the center of the rotation

42.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

43. Gradient scaling

43.1. Description

to be written

43.2. Constructor

djnComponent* djnCreateGUIGradientScaling (djnComponent *component, const char* name, double sx, double sy, double cx, double cy)

Create a scale component and add it to the transforms list of component.

component must be a linear or a radial gradient.

43.3. Children

  • sx: horizontal ratio for the scale

  • sy: vertical ratio for the scale

  • cx: abscissa of the center of the scale

  • cy: ordinate of the center of the scale

43.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

44. Gradient skew X

44.1. Description

to be written

44.2. Constructor

djnComponent* djnCreateGUIGradientSkewX (djnComponent *component, const char* name, double a)

Create an horizontal skew component and add it to the transforms list of component.

component must be a linear or a radial gradient.

44.3. Children

  • a: angle of the skew

44.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

45. Gradient skew Y

45.1. Description

to be written

45.2. Constructor

djnComponent* djnCreateGUIGradientSkewY (djnComponent *component, const char* name, double a)

Create a vertical skew component and add it to the transforms list of component.

component must be a linear or a radial gradient.

45.3. Children

  • a: angle of the skew

45.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

46. Gradient homography

46.1. Description

to be written

46.2. Constructor

djnComponent* djnCreateGUIGradientHomography (djnComponent *component, const char* name,
                                          double m11, double m12, double m13,
                                          double m21, double m22, double m23,
                                          double m31, double m32, double m33)

Create an homography component and add it to the transforms list of component.

component must be a linear or a radial gradient.

46.3. Children

  • m11: matrix first line first column value

  • m12: matrix first line secund column value

  • m13: matrix first line third column value

  • m21: matrix second line first column value

  • m22: matrix second line secund column value

  • m23: matrix second line third column value

  • m31: matrix third line first column value

  • m32: matrix third line secund column value

  • m33: matrix third line third column value

46.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

47. Font size

47.1. Description

to be written

47.2. Constructor

djnComponent* djnCreateGUIFontSize (djnComponent *parent, const char *name, int unit, double size)

Create a font size component. The font size is added to the context and applied to all texts after it in the tree (until a new font size is defined).

unit can be: djnGUINoUnit, djnGUIEm, djnGUIEx, djnGUIPc, djnGUIPt, djnGUIPx, djnGUICm, djnGUIMm, djnGUIIn, djnGUIPercent

47.3. Children

  • size: size of the font

  • unit: unit for the size of the font

47.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

48. Font weight

48.1. Description

to be written

48.2. Constructor

djnComponent* djnCreateGUIFontWeight (djnComponent *parent, const char *name, int weight)

Create a font weight component with value from -1 to 100. The font weight is added to the context and applied to all texts after it in the tree (until a new font weight is defined).

  • if weight value is -1, it sets a "lighter" weight than the current context.

  • if weight value is 100, it sets a "bolder" weight than the current context.

48.3. Children

  • weight: weight of the font

48.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

49. Font style

49.1. Description

to be written

49.2. Constructor

djnComponent* djnCreateGUIFontStyle (djnComponent *parent, const char *name, djnGUISlope style)

Create a font style component. The font style is added to the context and applied to all texts after it in the tree (until a new font style is defined).

style can be: djnGUINormal, djnGUIItalic or djnGUIOblique

49.3. Children

  • style: style of the font

49.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

50. Font family

50.1. Description

to be written

50.2. Constructor

djnComponent* djnCreateGUIFontFamily (djnComponent *parent, const char *name, const char *family)

Create a font family component. The font family is added to the context and applied to all texts after it in the tree (until a new font family is defined).

50.3. Children

  • family: family of the font

50.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

51. Text anchor

51.1. Description

to be written

51.2. Constructor

djnComponent* djnCreateGUITextAnchor (djnComponent *parent, const char* name, djnGUIAnchor anchor)

Create a text anchor component, which is used to align (start-, middle- or end-alignment) a string of text relative to a given point.

anchor can be: djnGUIStart, djnGUIMiddle or djnGUIEnd

51.3. Children

  • anchor: anchor of the text

51.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

52. Translation

52.1. Description

to be written

52.2. Constructor

djnComponent* djnCreateGUITranslation (djnComponent *parent, const char *name, double tx, double ty)

Create a translation component. When a translation is added to a graphical context, its transformation matrix is left-multiplied by a translation matrix.

In a composite transformation/sequence of transformations, the order of individual transformation is important because composite transformations are built from right to left (i.e. when a new transformation is applied the current transformation matrix is left-multiplied by the matrix of the transformation).

52.3. Children

  • tx: horizontal value

  • ty: vertical value

52.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

53. Rotation

53.1. Description

to be written

53.2. Constructor

djnComponent* djnCreateGUIRotation (djnComponent *p, const char *n, double a, double cx, double cy)

Create a rotation component. When a rotation is added to a graphical context, its transformation matrix is left-multiplied by a rotation matrix.

In a composite transformation/sequence of transformations, the order of individual transformation is important because composite transformations are built from right to left (i.e. when a new transformation is applied the current transformation matrix is left-multiplied by the matrix of the transformation).

53.3. Children

  • a: angle of the rotation

  • cx: abscissa of the center of the rotation

  • cy: ordinate of the center of the rotation

53.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

54. Scaling

54.1. Description

to be written

54.2. Constructor

djnComponent* djnCreateGUIScaling (djnComponent *parent, const char *name, double sx, double sy, double cx, double cy)

Create a scale component. When a scale is added to a graphical context, its transformation matrix is left-multiplied by a scale matrix.

In a composite transformation/sequence of transformations, the order of individual transformation is important because composite transformations are built from right to left (i.e. when a new transformation is applied the current transformation matrix is left-multiplied by the matrix of the transformation).

54.3. Children

  • sx: horizontal ratio for the scale

  • sy: vertical ratio for the scale

  • cx: abscissa of the center of the scale

  • cy: ordinate of the center of the scale

54.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

55. Skew X

55.1. Description

to be written

55.2. Constructor

djnComponent* djnCreateGUISkewX (djnComponent *parent, const char* name, double a)

Create a skew transformation along the x-axis. When a X skew is added to a graphical context, its transformation matrix is left-multiplied by a X skew matrix.

In a composite transformation/sequence of transformations, the order of individual transformation is important because composite transformations are built from right to left (i.e. when a new transformation is applied the current transformation matrix is left-multiplied by the matrix of the transformation).

55.3. Children

  • a: angle of the skew

55.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

56. Skew Y

56.1. Description

to be written

56.2. Constructor

djnComponent* djnCreateGUISkewY (djnComponent *parent, const char* name, double a)

Create a skew transformation along the y-axis. When a Y skew is added to a graphical context, its transformation matrix is left-multiplied by a Y skew matrix.

In a composite transformation/sequence of transformations, the order of individual transformation is important because composite transformations are built from right to left (i.e. when a new transformation is applied the current transformation matrix is left-multiplied by the matrix of the transformation).

56.3. Children

  • a: angle of the skew

56.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

57. Homography

57.1. Description

to be written

57.2. Constructor

djnComponent* djnCreateGUIHomography (djnComponent *parent, const char *name,
                                double m11, double m12, double m13, double m14,
                                double m21, double m22, double m23, double m24,
                                double m31, double m32, double m33, double m34,
                                double m41, double m42, double m43, double m44)

Create an homography component. When an homography is added to a graphical context, its transformation matrix is left-multiplied by the matrix of the homography.

In a composite transformation/sequence of transformations, the order of individual transformation is important because composite transformations are built from right to left (i.e. when a new transformation is applied the current transformation matrix is left-multiplied by the matrix of the transformation).

57.3. Children

  • m11: matrix first line first column value

  • m12: matrix first line secund column value

  • m13: matrix first line third column value

  • m14: matrix first line fourth column value

  • m21: matrix second line first column value

  • m22: matrix second line secund column value

  • m23: matrix second line third column value

  • m24: matrix second line fourth column value

  • m31: matrix third line first column value

  • m32: matrix third line secund column value

  • m33: matrix third line third column value

  • m34: matrix third line fourth column value

  • m41: matrix fourth line first column value

  • m42: matrix fourth line secund column value

  • m43: matrix fourth line third column value

  • m44: matrix fourth line fourth column value

57.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

  • PAINT: paints the component

File components

1. Files module

1.1. Description

The files module allows to track the creation or modification of files in the file system.

1.2. Initialization

#include <djnn/files.h>

djnInitFiles()

2. Directory iterator

2.1. Description

When run, this component reads the list of files in a given directory and successively updates its filename property with the names of the files.

2.2. Constructor

djnComponent* djnCreateDirectoryIterator (djnComponent *parent, const char* name, djnComponent *dir, int extended)

Create an iterator for the dir directory.

The extended property is not yet used.

2.3. Children

  • filename: name of the latest file listed in the directory. The names are relative to the directory.

2.4. Standard actions

  • RUN: start the iteration

  • STOP: stop the iteration

3. File locator

3.1. Description

This component finds file components from file names.

3.2. Constructor

djnComponent* djnCreateFileLocator(djnComponent* parent, const char* name)

Create a file locator component.

3.3. Children

  • input: file name. Relative names are interpreted relative to the directory.

  • output: reference to the file component that was just created. See component File for more details.

3.4. Standard actions

  • RUN: start the file locator; every time its input property is set, it will attempt to find a file component.

  • STOP: stops the file locator; setting its input property will have no more effect.

4. Text file reader

4.1. Description

This component outputs the contents of djnn text files, line by line, through a text property.

4.2. Constructor

djnComponent* djnCreateTextFileReader (djnComponent* parent, const char* name)

Create a text file reader component.

4.3. Children

  • file: reference property, for use with references on text files only. Setting this property triggers the reading of the file.

  • output: text property containing the latest line read.

4.4. Standard actions

  • RUN: start the file reader; every time its file property is set, the file reader will read its contents.

  • STOP: stop the file reader; setting its file property will have no more effect.

Display components

1. Display module

1.1. Description

The display module provides components that represent the available physical displays on a computer.

1.1.1. Physical display configuration

The configuration of physical displays on the computer can be discovered: list of available displays, representation of the layout of displays, etc. This is represented by a hierarchy of components, in which the main principle is that each display device can be connected to a display area through a viewport.

Since operating systems differ in their use of displays, the configuration presented by the display module is OS-dependent. Below are figures of the component sets (eg. displayAreas) and component classes (eg. <Viewport>) on Linux and Mac OS.

Linux configuration:

                              XServers
                                 |
                        -----------------
                        |               |
                    <XServer>         <XServer>
                        |
                   displayAreas
                        |
              ----------------------
              |                    |
        <Display Area>        <Display Area>
               |
      ------------------------
      |                      |
  displays               viewports
     |                       |
  -----------            ----------
  |          |           |         |
<Display> <Display>   <Viewport> <Viewport>

Mac OS configuration :

           <Display Area>
                 |
     ------------------------
     |                      |
  displays               viewports
     |                       |
  -----------            ----------
  |          |           |         |
<Display> <Display>    <Viewport> <Viewport>

The sets reflect the list of available display areas, displays and viewports. Hot-plugging of displays, and sometimes their switching on/off, is reflected by additions and removal from these sets.

1.2. Initialization

#include <djnn/display.h>

djnInitDisplay()

Note: djnInitCore must be have been called previously.

1.3. Global variables

  • djnComponent* djnXServers

    Set of X Servers to which the programm is connected (Linux only). By default the set contains the connection to the standard X Server available on the computer. New X Servers are added to the set when discovered. See the X Server component for more details on the components of this set.

  • djnComponent* djnDisplayAreas

    Set of all display areas currently available. On Mac OS, there is exactly one component in this set. On Linux, it contains all the Display areas managed by all connected X Servers connected to the program and new Display areas are added when they are discovered. See the Display area component for more details on the components of this set.

  • djnComponent* djnDisplays

    Set of all display devices currently connected to the computer and known to the operating system. The addition or removal of a display can be tracked throught the $added and $removed children of the set (see the Set component). See the Display component for more details on the components of this set.

2. X Server

2.1. Description

Each X Server component represents a connection between the program and an X server (aka "X display", a legacy term that can create confusion). X servers are specific to Linux (or OpenBSD and similar Unix derivatives not supported by djnn). Traditionally there is one X server per computer. In appropriate network settings, it is possible to connect to X servers running on remote computers.

Each X server manages one or more display areas (see the Display area component), each associated to a graphic card and one or more display devices.

2.2. Constructor

djnComponent* djnFindXServer(char* dpy)

Try to find an X Server component corresponding to the description given in dpy. The description follows the standard syntax for X displays, eg. pc3:0.0.

If a connection to the specified X display is successfully opened, an X Server component is returned. Otherwise the return value is 0.

2.3. Children

  • displayAreas: set of display areas managed by the X server. See the Display Area component for more details.

3. Display area

3.1. Description

A display area is a virtual drawing surface managed by an operating system, and shared between applications running on the computer. Each display area can be associated to one or more display devices; each such association is represented by a viewport that controls what part of the display area is shown the display device and how.

On Mac OS, there is exactly one display area, called the virtual desktop. On Linux machines, there can be several display areas for each computer (that is several "screens" per "X display"). The mappings between parts of this virtual area and the display devices are rendered throught the viewport components.

Display areas are discovered by programs, not created. By default, the main display area of the computer is used for all graphics.

3.2. Constructor

None.

3.3. Children

  • width: width of the display area.

  • height: height of the display area.

  • displays: set of all displays associated to this display area. See the Display Device component for more details.

4. Viewport

4.1. Description

To be written

4.2. Children

To be written

5. Display

5.1. Description

A display component represents a device that produces visible images, such as a computer monitor or projector. Display components are generally connected through a viewport to a display area, so as to show a part of the display area (see the Display Area and Viewport components). Display areas that are not connected to a display area are inactive.

Displays are discovered, not created. By default, the main physical display of the computer is used for all graphics.

5.2. Constructor

None.

5.3. Children

  • width: number of pixels in a line of the display

  • height: number of pixels in a column of the display

  • viewport: viewport through which the display is connected to a display area

Input components

1. Input module

1.1. Description

The input module provides a mechanism for detection of input devices.

1.2. Initialization

#include <djnn/input.h>

djnInitInput()

1.3. Global variables

  • djnComponent* djnInputDevices

    Set of all input devices currently available on the computer.

  • djnComponent* djnPointers

    Set of all pointers currently available on the computer.

  • djnComponent* djnMice

    Set of all mice currently available on the computer.

  • djnComponent* djnTouchPanels

    Set of all touch panels currently available on the computer.

  • djnComponent* djnStyluses

    Set of all styluses currently available on the computer.

  • djnComponent* djnRotaryKnobs

    Set of all rotary knobs currently available on the computer.

  • djnComponent* djnAbsolute3DDevices

    Set of all absolute 3D devices currently available on the computer.

  • djnComponent* djnJoysticks

    Set of all joysticks currently available on the computer.

  • djnComponent* djnMakeyMakeys

    Set of all makey makey currently available on the computer.

2. Pointer

2.1. Description

A pointer is a component that has integer or double properties named X and Y, and updates according to movements controlled by a user or by a similar process. Pointers include touches on a touch panel, styluses, and accumulated mouse movements.

2.2. Constructor

None.

2.3. Children

  • X: abscissa of the pointer

  • Y: ordinate of the pointer

2.4. Standard actions

None.

3. Mouse

3.1. Description

A mouse is a component that behaves like a physical mouse, that is a device that measures relative horizontal movements and has at least one two-state button.

3.2. Constructor

None.

3.3. Children

  • move is activated when the mouse is moved, it has 2 children dx and dy

  • wheel is activated when the wheel is rolled, it has 2 children dx and dy

  • button has 3 children: press and released wich are activated when a button is pressed or released, and name which contains the name of the pressed / released button (left, right, middle or side)

3.4. Standard actions

None.

4. Touch Panel

4.1. Description

A touch panel component is a component that behaves like a single or multi-touch input panel, including touch screens and touch pads. It manages a set of all the touches currently tracked by the panel.

4.2. Constructor

None.

4.3. Children

  • touches: set of all touches currently tracked by the touch panel. See the Touch component for more details.

  • touch: this is an alias to the oldest touch that is currently active; for single touch panels, it will always be the only touch available.

4.4. Standard actions

None.

5. Touch

5.1. Description

A djnn touch is a component that corresponds to a touch tracked by a multitouch input device. It qualifies as a pointer (see the Pointer component).

5.2. Constructor

None.

5.3. Children

  • X: abscissa of the touch

  • Y: ordinate of the touch

  • minX: minimum possible abscissa for the touch

  • maxX: maximum possible abscissa for the touch

  • minY: minimum possible ordinate for the touch

  • maxY: maximum possible ordinate for the touch

Depending on the touch panel device:

  • width: width of the blob

  • height: size of the blob

  • cX: abscissa of the center of the blob

  • cY: ordinate of the center of the blob

  • pressure: pressure of the touch

5.4. Standard actions

None.

6. Stylus

6.1. Description

A stylus is a component that behaves like a stylus tracked by Wacom-like input devices. It qualifies as a pointer (see the Pointer component).

6.2. Constructor

None.

6.3. Children

  • X: abscissa of the stylus

  • Y: ordinate of the stylus

  • minX, maxX, minY, maxY: boundaries of the stylus detection in the device referential

  • pressure: pressure of the stylus

  • press is activated when the stylus presses the surface, it has 2 children x and y

  • move is activated when the stylus moves, it has 2 children x and y

  • released is activated when the stylus releases its pression on the surface

The following children are optional:

  • distance: distance of the stylus

  • button has 2 children press and release

  • button2 has 2 children press and release

  • tilt has 2 children x and y

  • pen has 2 children enter and leave

  • rubber has 2 children enter and leave

  • pencil has 2 children enter and leave

  • brush has 2 children enter and leave

  • airbrush has 2 children enter and leave

6.4. Standard actions

None.

7. Rotary Knob

7.1. Description

A rotary knob component with a behavior similar to that of input devices that have a single button that can be rotated and pressed, such as a PowerMate.

7.2. Constructor

None.

7.3. Children

  • turn: this child is activated when the button of the rotary knob is turned. Its child dTheta gives the relative value of the rotation.

  • button: the button of the rotary knob. It has wto children press and release, activated when the button is pressed or released.

7.4. Standard actions

None.

8. Absolute 3D device

8.1. Description

Absolute 3D devices are components that behave like input devices that have a button that can be rotated and moved in 3 dimensions (eg. 3D mice), and whose movements are presented through the variations of absolute values.

8.2. Constructor

None.

8.3. Children

  • turn: this child is activated when the 3D device is turned. Its children are the rotation values: Rx, Ry and Rz.

  • move: this child is activated when the 3D device is moved. Its children are the absolute coordinates: x, y and z.

  • button: the button of the 3D device. Its two children press and release are activated when the button is pressed or released.

8.4. Standard actions

None.

9. Joystick

9.1. Description

A joystick component represents a joystick input device. It can have up to twleve buttons, and has two degrees of freedom X and Y, and sometimes an additional Z degree of freedom.

9.2. Constructor

None.

9.3. Children

  • move is activated when the joystick is moved. It has children named x, y and sometimes z

  • for each button (numbered <i>) on the joystick, button <i> is activated when the button is pressed or released. It has children named press and release.

9.4. Standard actions

None.

10. Makey Makey

10.1. Description

A MakeyMakey component represents a MakeyMakey board, that is a device that makes it possible to invent hardware input devices of various shapes, exposed to the computer as a collection of keys and buttons. See http://www.makeymakey.com for more details on the MakeyMakey board.

10.2. Constructor

None.

10.3. Children

Each of the following sub-components has children press and release, respectively activated when the corresponding key or button is pressed or released on the MakeyMakey board.

  • up

  • down

  • right

  • left

  • space

  • click

10.4. Standard actions

None.

Sound components

1. Sound module

1.1. Description

The sound module allows to produce sound.

1.2. Initialization

#include <djnn/sound.h>

djnInitSound()

2. Beep

2.1. Description

to be written

2.2. Constructor

djnComponent* djnCreateBeep (djnComponent* parent, const char* name, int isModel)

Create a beeper component, each time it is activated, it produces a beep (if the terminal is compatible with \a ASCII character).

If isModel = 1, the component is activated only when:

  • calling djnRunComponent on the component

  • the component is associated with a binding and the binding is triggered

  • the component is child of a switch and is in the active branch

  • the component is associated to the action of a fsm transition

If isModel = 0, the component is also activated with the tree traversal mechanism.

2.3. Children

None.

2.4. Standard actions

  • RUN: activates the component

MacBook components

1. MacBook module

1.1. Description

The MacBook module contains components that are specific to MacBooks: accelerometer, ambient lighting sensor, and keyboard lighting.

1.2. Initialization

#include <djnn/macbook.h>

djnInitMacBook()

2. Sudden motion sensor

2.1. Description

Some MacBooks have a sudden motion sensor, originally designed to protect hard disks in case of shocks. It can be used as an accelerometer. In the current implementation, the SMS component emits values every 100 ms. In the future the time interval will probably become a property.

2.2. Constructor

djnComponent* djnFindSMS ()

Find and return the MacBook sudden motion sensor component.

2.3. Children

  • x: acceleration along the X axis

  • y: acceleration along the Y axis

  • z: acceleration along the Z axis

2.4. Standard actions

None.

3. CPU load

3.1. Description

This component provides a measurement of the CPU load of the MacBook, as given by the commands w and top. In the current implementation, this component emits values every 1000 ms. In the future the time interval will probably become a property.

3.2. Constructor

djnComponent* djnFindCPULoad ()

Find and return the MacBook CPU load component.

3.3. Children

  • load: load value

3.4. Standard actions

None.

4. Light sensor

4.1. Description

Some MacBooks have two ambient light sensors on the left and right of the keyboard. This component represents the two sensors. In the current implementation, this component emits values every 100 ms. In the future the time interval will probably become a property.

4.2. Constructor

djnComponent* djnFindLightSensor ()

Find and return the MacBook light sensor component.

4.3. Children

  • left: value of the left sensor

  • right: value of the right sensor

4.4. Standard actions

None.

5. Keyboard light

5.1. Description

This component controls the keyboard backlighting of MacBooks. In the current implementation, several such components can be created; this allows for instance to associate a level of lighting to each component in a given application, when only one of these components can be activated at a time. In the future, this will probably change.

5.2. Constructor

djnCreateKeyboardLight (djnComponent* parent, const char* name, int level)

Create a Mackbook keyboard light component.

5.3. Children

  • level: light level value, from 0 to 100.

5.4. Standard actions

  • RUN: run the component, which starts controlling the lighting of the keyboard

  • STOP: stop the component, which stops controlling the lighting of the keyboard

Phidget components

1. Phidgets module

1.1. Description

The phidgets module provides a mechanism for management of phidget sensors: http://www.phidgets.com.

1.2. Initialization

#include <djnn/phidgets.h>

djnInitPhidgets()

1.3. Global variables

djnComponent* djnInterfaceKits

Set of all Phidget interface kits currently connected on the computer.

2. Interface kit

2.1. Description

An InterfaceKit is a USB phidget that serves to connect simple devices or phidgets to a computer. Each interface kit has ports for analog sensors, for digital inputs and digital outputs. Currently, only 8/8/8 interface kits are supported: eight devices of each kind.

2.2. Constructor

None.

2.3. Children

  • sensors: list of integer properties with values in the range [0-1000], each representing an analog sensor;

  • inputs: list of boolean properties, each representing a digital input;

  • outputs: list of boolean properties, each representing a digital output.

2.4. Standard actions

None.

Object components

1. Objects module

1.1. Description

The objects module provides a mechanism for detection of physical objects.

1.2. Initialization

#include <djnn/objects.h>

djnInitObjects()

2. Philips Hue

2.1. Description

to be written

2.2. Constructor

djnComponent* djnCreatePhilipsHueBridge (djnComponent* parent, const char* name, const char* uri, const char* userid)

Create a bridge component for Philips Hue. When activated, it parses the json file lights situated at path uri \ userid.

2.3. Children

None.

2.4. Standard actions

  • RUN: activates the component

  • STOP: stops the component

Power components

1. Power module

1.1. Description

The power module provides components that reflect the state of power sources available on a computer.

1.2. Initialization

#include <djnn/power.h>

djnInitPower()

2. Battery

2.1. Description

Each battery component reflects the state of a battery that powers the computer on which the program is running. There currently is no multi-platform standard for the structure of battery components.

2.2. Constructor

None.

2.3. Children

Not standardized yet.

2.4. Standard actions

None.

Gesture recognition

1. Gestures module

1.1. Description

The gestures module provides components that allows the recognition of patterns defined by the programmer or the user.

1.2. Initialization

#include <djnn/gestures.h>

djnInitGestures()

2. OneDollar

2.1. Description

A gesture recognizer based on the "One Dollar" algorithm from the University of Washington. Initially, the recognizer has no template in memory and thus cannot recognize anything. You can add your own templates or load some of the base set.

2.2. List of the templates in the base set

  • [CAPITAL LETTERS]: from A to Z

  • [DIGITS]: from 0 to 9

  • Rectangle: a rectangle (counterclockwise)

  • Circle: a circle (counterclockwise)

  • Triangle: a triangle (counterclockwise)

  • Star: a five-branch star

  • Arrow: an arrow

  • Delete:

  • Check: a check symbol

  • Pigtail:

  • ZigZag:

  • ^: a caret

  • {: a left curly brace

  • }: a right curly brace

  • [: a left square bracket

  • ]: a right square bracket

2.3. Constructor

djnComponent* djnCreateOneDollarClassifier (djnComponent* parent, const char* name)

Create a $1 gesture recognizer.

2.4. Other Functions

void djnODGRLoadTemplate (djnComponent* gr, const char* name)

loads a pattern of the base set (see the list of all patterns available).

void djnODGRLoadDefaultTemplates(djnComponent* gr)

loads all the patterns of the base set.

void djnODGRErase (djnComponent* gr)

cancels the recognition in progress.

2.5. Children

  • start: event which signifies the beginning of a new pattern to recognize. It has two double properties: x and y.

  • move: event which signifies that a new set of coordinates is added to the pattern. It has two double properties: x and y.

  • end: event which signifies that the pattern is completed and can now be recognized.

  • [PATTERN]: there is one such child for each template loaded in memory, with the name of the pattern. A child is activated when the corresponding pattern is recognized.

2.6. Standard actions

  • RUN: activates the component

  • STOP: stops the component