Indigo

Distribution

The following items are included:

Depending on the OS and architecture, proper binaries are loaded automatically.

Rendering

Dingo class object represents a library instance. All operations are represented by methods of this object. Several library instances may be created within one thread to act simultaneously and independently. However, each instance requires a certain amount of memory, and thus it is recommended to have as few instances as possible.

The procedure for rendering workflow is the following:

  1. Create library instance.
  2. Load molecule/reaction structural formula from file/string/buffer.
  3. Set target file (optional). If the target file not set, rendering is done to the internal buffer.
  4. Set desired file output format: PNG, PDF, or SVG. See setOutputFormat().
  5. Set the target image size in pixels (optional). If the size is not set, it is determined by the average bond size in pixels. The latter one can be set using the setBondLength() method.
  6. Set additional options if necessary.
  7. Call render().
  8. When rendering to buffer, call getResult().

Dingo Class Public Methods

Constructor

Dingo (String path);

Receives the path to Win, Linux, and Mac directories containing binary modules (see distribution section above for details). E.g., if the libraries are stored in lib/Win/, lib/Linux, and lib/Mac directories, call new Dingo(“lib”). You can specify absolute paths as well.

Dingo ();

Same as Dingo(“lib”).

Instances are independent and are safe to be used in parallel.

Before loading

void setLogPath (String path);

Sets the path to the log file. If not set, no logging is done.

See also load-highlighting option in option reference.

Loading

void loadMoleculeFromFile (String filename);
void loadMolecule (String str);
void loadMolecule (byte[] buf);
void loadReactionFromFile (string filename);
void loadReaction (byte[] buf);
void loadReaction (String buf);

Loads the molecule or reaction from file, string, or buffer.

bool moleculeIsEmpty ();
bool reactionIsEmpty ();

Checks whether the loaded molecule or reaction structural formula is empty.

Target and format

void setOutputFormat (String format)

Sets the output format to png, svg or pdf for rendering or mol or rxn for molecule and reaction layout respectively. No default value. Case-insensitive.

void setOutputFile (String filename)

Sets the output file. If not set, rendering is performed to internal buffer, which you can later obtain with getResult().

Image size

void setImageSize (int width, int height);

Sets the desired image size in pixels. If no size is given, the picture is adjusted automatically according to the specified bond length and margins:

void setBondLength (float length);

Sets the average bond length in pixels. If the size is not set, this determines the size of the resulting image; otherwise it is ignored. The default value is 100 pixels.

See also margin-factor setting in option reference.

Additional options

The concept of options in Dingo is to make the interface more flexible. Examples of options are relative- thickness, implicit-hydrogen-mode, background-color, etc (names are case-insensitive). image-size, bond-length, output-format, output-file options duplicate the setImageSize, setBondLength, setOutputFormat, and setOutputFile calls, respectively. See Option reference for the complete list of options.

Use an appropriate method depending on the type of the option.

void setOption (String name, String value)
void setOption (String name, boolean value)
void setOption (String name, float value)
void setOption (String name, float r, float g, float b)
void setOption (String name, int w, int h)

One can use the first method for to set options of any kind, e.g. setOption(“base-color”, “0.0,0.0,1.0”) instead of setOption(“base-color”, 0.0f, 0.0f, 1.0f).

The components of the value are comma-separated, and C-style formatting is used for floats, i.e. decimal point is a period, not a comma.

void setOptions (String options)

It is also possible to set multiple options at once, e.g. setOptions(“implicit-hydrogen-mode=none; coloring=1; aam-color=0.2,0.5,0.3”). The options within the string should be separated by a semicolon. Equality sign may be surrounded by spaces, too.

Rendering

void render ();

Layout

void layout ();

Perform layout and store the result as a MOLFile or RXNFile. Proper format should be set using setOutputFormat().

Getting the result

byte[] getResult ();

Example

Dingo dingo = new Dingo();
dingo.setOutputFormat("png");
dingo.setOutputFile("test.png");
dingo.setBondLength(50);
dingo.setOption("base-color", 0.0f, 0.5f, 0.2f);
dingo.loadMolFromString("C1=CC=NC=C1");
dingo.render();

The shorter version of the above would be the following:

Dingo dingo = new Dingo();
dingo.setOptions("output-format=png; output-file=test.png; bond-length=50; base-color=0,0.5,0.2");
dingo.loadMolFromString("C1=CC=NC=C1");
dingo.render();