The following items are included:
dingonet.dll — .Net 2.0 assemblylib32/dingo.dll — 32-bit C++ library exposing C interfacelib64/dingo.dll — 64-bit C++ library exposing C interfacelib{32,64}/libcairo-2.dll (LGPL 2.1, MPL 1.1)lib{32,64}/libpng12-0.dll (as is)lib{32,64}/zlib1.dll (as is)All binaries except dingonet.dll are offered in 32-bit and 64-bit versions. Depending on the architecture,
proper DLL files are loaded automatically from lib32 or lib64 directories. The path to those directories
may be set up when creating a library instance.
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. Please
note, however, that the instances cannot be shared across multiple threads. Also, 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:
setBondLength() method.render().getResult().Whenever an error occurs DingoException is thrown. The Message field normally contains the error
information passed by the underlying C++ library.
Dingo (String prefix);
Receives the relative path to lib32 and lib64 (see Distribution section
above for details). E.g., if the libraries are stored in lib/Dingo/lib32 and lib/Dingo/lib64, call new
Dingo(“lib/Dingo”).
Dingo ();
Same as Dingo(“.”)
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.
void loadMoleculeFromFile (String filename);
void loadMolecule (String str);
void loadMolecule (byte[] buf);
Loads the molecule from file, string, or buffer.
void loadReactionFromFile (string filename);
void loadReaction (byte[] buf);
void loadReaction (String buf);
Loads the reaction from file, string, or buffer.
bool isEmpty ();
Checks whether the loaded molecule/reaction structural formula is empty.
void setOutputFormat (String format)
Sets the output format to png, svg, pdf, or wmf 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().
void setOutputHDC (IntPtr hdc);
void setOutputPrintingHDC (IntPtr hdc);
Sets the output to given HDC (display or printer).
Note: HDC is not disposed automatically. E.g., if it is obtained by means of Graphics.GetDC(), call
Graphics.ReleaseDC() as the rendering is complete, and call Graphics.Dispose() as you finish with this
object. Both are to be done after calling Dingo.render() but before using the result, e.g. saving or
displaying the image.
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.
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, bool value)
void setOption (string name, float value)
void setOption (string name, Color value)
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”, Color.Blue).
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.
void render ();
void layout ();
Perform layout and store the result as a MOLFile or RXNFile. Proper format should be set using setOutputFormat().
byte[] getResult ();
Macros are provided for simplicity. They are called after a structural formula is loaded. You can also set the options before calling a macro.
Bitmap renderToBitmap (int width, int height);
Creates a transparent Bitmap of the size given and performs rendering.
Bitmap renderToBitmap (int width, int height, Color background);
Creates a Bitmap of size given with background given and performs rendering.
Metafile renderToMetafile (int width, int height);
Creates Metafile of the size given and perform rendering.
Metafile renderToMetafile ();
Creates Metafile and perform rendering. Size is determined automatically, based on the molecule/reaction
loaded.
Dingo dingo = new Dingo();
try
{
dingo.loadMoleculeFromFile("test.mol");
dingo.setOptions("aromatization=aromatize; output-file=out.png;");
dingo.setOption("output-format", "png");
dingo.setOption("background-color", Color.White);
dingo.setOption("relative-thickness", 1.7f);
dingo.render();
Console.WriteLine("Done");
}
catch (DingoException ex)
{
Console.WriteLine(ex.Message);
}
Console.ReadLine();