Ilib Image Library

The Ilib library is a portable set of routines for manipulating images. It has been successfully compiled and run on various UNIX platforms as well as Windows 95/98/NT (gcc, lcc-win32 and MS Visual C++). The source is 32-bit, so this will never be a 16-bit Windows application. It is intended to be independent of any windowing system or graphics file format.

API Documentation


IAllocColor

Allocates a color to be used for drawing. (See ISetForeground).

Returns: IColor

Input Parameters:

ICopyImage

Copies all or part of one image onto another image at a specified coordinate.

Returns: IError

Input Parameters:

ICreateGC

Creates a graphic context for drawing on an image.

Returns: IGC

Input Parameters:

ICreateImage

Create a blank (white) image of a specified width and height.

Returns: IImage

Input Parameters:

IDrawLine

Draws a line onto the image using the graphics context's current line style ( see ISetLineStyle).

Returns: IError

Input Parameters:

IDrawPoint

Draws a single point on the image.

Returns: IError

Input Parameters:

IDrawRectangle

Draws a rectangle onto the image of the specified width and height using the graphic context's current line stlye ( see ISetLineStyle).

Returns: IError

Input Parameters:

IDrawString

Draws text onto the image at the specified coordinate. Non-ASCII charactes are supported by using escape sequences. For example, the copyright symbol is typically represented as "\033copyright;". See the font definition file to determine which characters are supported.
Note: the font is set with ISetFont.

Returns: IError

Input Parameters:

IDuplicateImage

Creates a duplicate of the original image.

Returns: IError

Input Parameters:

Output Parameters:

IErrorString

Convert an IError value into text suitable for printing in an error message.

Returns: char *

Input Parameters:

IFileType

Determine the type of image by the file extension.

Returns: IError

Input Parameters:

Output Parameters:

IFillRectangle

Fills a rectangle on the image using the graphics context's foreground color (see ISetForeground).

Returns: IError

Input Parameters:

IFontSize

Gets the pixel height of the font. (See ITextHeight for calculating the height of a multiline text.)

Returns: IError

Input Parameters:

Output Parameters:

IFreeColor

Frees a color no longer in use.

Returns: IError

Input Parameters:

IFreeFont

Frees a font no longer in use.

Returns: IError

Input Parameters:

IFreeGC

Frees a graphic context no longer in use.

Returns: IError

Input Parameters:

IFreeImage

Frees the memory associated with an image that will not be used again.

Returns: IError

Input Parameters:

ILoadFontFromData

Loads a font from data passed in. This is identical to ILoadFontFromFile except the font data is passed in as an argument rather than a file. This allows the font to be embedded in the application rather than distributed as a separate file.

Returns: IError

Input Parameters:

Output Parameters:

ILoadFontFromFile

Load a font from file. Currently, only BDF font files can be used. BDF font files can be found at: ftp://ftp.x.org/pub/R6.1/xc/fonts/bdf/75dpi/. (BDF fonts are part of the X11 Window System developed at MIT and used on almost all UNIX workstations.)

Returns: IError

Input Parameters:

Output Parameters:

IReadImageFile

Creates an image from an image file. Currently can only read raw PPM (IFORMAT_PPM), GIF (IFORMAT_GIF) and PNG (IFORMAT_PNG) files. The file is left open for the caller to close. (Note: you should set the file to binary mode on Win32 platforms.)

Returns: IError

Input Parameters:

Output Parameters:

ISetFont

Sets the current drawing font for a graphics context. Subsequent calls to IDrawString will use the specified font.

Returns: IError

Input Parameters:

ISetForeground

Set the foreground color of a graphics context. This will set the drawing color for drawing functions (IDrawLine, IFillRectangle, etc.)

Returns: IError

Input Parameters:

ISetLineStyle

Sets the curret line drawing style for a graphics context. Currently support ILINE_SOLID (default) and ILINE_ON_OFF_DASH. (This applies to IDrawLine and IDrawRectangle.)

Returns: IError

Input Parameters:

ISetLineWidth

Sets the line drawing with for a graphics context. (This applies to IDrawLine and IDrawRectangle.)

Returns: IError

Input Parameters:

ISetTransparent

Set the transparent color of the image. This is only relevant to images that are written to either GIF or XPM formats.

Returns: IError

Input Parameters:

ITextDimensions

Determines the width & height (in pixels) of the given text for the specified font. (useful for multiline text)

Returns: IError

Input Parameters:

Output Parameters:

ITextHeight

Determines the height (in pixels) of the given text for the specified font. This is useful for multiline text.

Returns: IError

Input Parameters:

Output Parameters:

ITextWidth

Determines the length (in pixels) of the given text for the specified font.

Returns: IError

Input Parameters:

Output Parameters:

IWriteImageFile

Writes an image to a file. Currently supports writing PPM (IFORMAT_PPM), XPM (IFORMAT_XPM), GIF (IFORMAT_GIF), and PNG (IFORMAT_PNG) formats. The file is left open for the caller to close. (Note: you should set the file to binary mode on Win32 platforms.)

Returns: IError

Input Parameters: