Herd Software Development
DaVinci Graphics Library
DaVinci Documentation
Before your application can offer import/export operations with graphic data, there has to be a standardized data format in place within your application to act as an "intermediary" format.
Whenever possible, DaVinci uses Windows-supported image file formats (metafile for vector-based images and DIB for bitmapped images) so that you can easily access Windows API functions alongside DaVinci and Leonardo functions in your applications.
While there are several documented formats compatible with the Windows API, DaVinci uses the DIB (Device Independend Bitmap) as its internal format for processing bitmapped graphics. This means that JPEGs, TIFFs, GIFs, BMPs and others are all converted to DIB format when imported by DaVinci.
DIB is a standard set by Microsoft for use with Windows versions 3.0 to date. If it helps, in most (but by no means all) cases, standard uncompressed .BMP files on your hard disk are laid out in the DIB format. DIB header information in memory is virtually identical to the header of a standard .BMP on your hard disk. This partly explains why the .DIB extension was offered as an option when saving files with the 16 bit PaintBrush program.
When a DIB is loaded into memory, the entire image is copied into one contiguous memory block representing the DIB. This block contains both the header information for the image (see BITMAPINFOHEADER in the WIN32 API documentation) and the bitmapped image data itself. Most languages represent an image in memory as a handle to the block of memory containing the image, so DaVinci uses HDIB ("handle to the DIB") to represent the image in memory.
In addition to the DIB bitmap format, Windows supports a vector-based image format known as a metafile. DaVinci supports common vector-based image formats including Windows metafiles and enhanced metafiles, and various DXF image formats as well.
Vector-based images are quite unlike bitmapped images. A bitmapped image is explicitly defined as per the number of pixels the image contains and the color of each pixel. It might help to think of vector-based images as similar to CAD drawings, in that the image is represented in memory, or in a file, as a set of drawing instructions. The image is defined by a set of lines (straight or curved) and polygons. Rather than specifying line lengths and polygon dimensions using fixed pixel counts, a vector-based image specifies it in terms of fractions of the size of the image. Vector-based images thus lend themselves to situations where the container, or bordering rectangle, of an image, might be stretchable or otherwise variable in size. The components of a vector-based image such as a metafile can thus be resized and reproportioned to fit different container dimensions.
Perhaps the most visible examples of vector-based images on Windows PCs are the characters in TrueType fonts. Each character is represented in the font file as a series of lines and curves, so that when different font sizes are selected, the graphical image that makes up the character reproportions itself to fit a new set of dimensions.
32 bit Windows operating systems also support a so-called Enhanced MetaFiles (EMF) format in addition to Windows Metafile (WMF) format. This new standard was implemented to take advantage of 32 bit GDI extensions (Bezier curves, 32 bit coordinates, and a host of additional features). EMF is not normally backward-compatible with WMF, however, since it uses a different method of converting coordinate information into actual screen positions for lines and polygons.
The 32 bit version of DaVinci supports these enhanced metafiles as well as the "standard" Windows metafile format.
DaVinci allows Bitmapped images to be converted to vector-based formats, and vice versa, but because these are two fundamentally different types of image data, there is almost always a degree of quality lost in the conversion.
In order to keep things simple, DaVinci makes its own determination about whether an imported image is a bitmapped image or a vector-based image, and automatically converts it to the internal format most suited to that image type. Bitmapped images are always converted internally to DIBs and processed as HDIB; metafiles become Windows metafiles and are handled internally as HMETAFILE's.
In most cases, you'll prefer to use use ipImportInd to perform a file import and ipExportInd for file import and export respectively. These functions give you the most control over how image import/export is handled.
However, these functions require a DAVPARAMS structure to be filled by your application, and this structure needs to include specifications about the type of the data to be converted. Not all development platforms support the use of types and records, so the ipImportExt and ipExportExt functions are offered as alternative solutions.