6. OEDepict Classes and Methods

The ``rendering'' or ``drawing'' components of the OEDepict library allow molecules with 2D co-ordinates to be displayed on the screen or written to a number of molecular graphics file formats. This process is conceptually divided into two steps; the first that determines the scale of the depiction, the colors of atoms and bonds, the way in which aromaticity and hydrogens are represented, etc... and the second that converts the graphics primitives generated by the first step into either an in-memory bitmap, a sequence of calls to a graphical drawing library or a sequence of PostScript commands to an output file.

In the OEDepict library, the process of determining how to display a molecule is the task of the OEDepictView class. Once the molecule to display and the various display options have been set the OEDepictView class's RenderImage method is used to actually output the molecule to the specified OEDepictBase. The OEDepict::OEDepictBase abstract base class defines an interface to (or abstraction of) a graphical rendering API. By deriving classes from OEDepictBase and providing different implementations, the same rendering code in OEDepictView can be used to drive different output devices and/or file formats.

As an example reference implementation of an OEDepictBase, the OEDepict library provides a 8 bit-per-pixel in-memory frame-buffer implementation called OE8BitImage. This can be used to display the molecule into a bitmap. A number of additional functions are also provided to allow the OE8BitImage to be written to a file (or other OEPlatform::oeostream) in several popular file formats including CompuServe GIF, Microsoft Bitmap (BMP), Portable Pixmap (PPM), PostScript Bitmap, and SGI's RGB file format.


Subsections