GrLoadImageFromFile()

Name

GrLoadImageFromFile() -- Load an image from a file into memory

Synopsis

GR_IMAGE_ID GrLoadImageFromFile ( char * path , int flags );

Description

This function loads the image file specified by path into a newly created image in the nano-X server's memory and returns the ID of the new image.

Note

The actual image types supported by the Nano-X server depend on the image types that were compiled in at server build time.

Note

Filename extensions are irrelevant. The algorithm examines the magic numbers in the file's header to determine the image type. Supported image types include GIF, JPEG, Windows BMP, PNG, XPM and both ASCII and binary variants of PBM, PGM and PPM.

Note

The file is read from a file by the nano-X server not the nano-X client. This distinction will become more important when nano-X gains support for remote cient operation over network. When the client and server are on the same machine the distinction becomes less important, unless the path is relative. If the path is relative, it must be specified relative to the servers current working directory rather than the client's.

Parameters

TypeNameDescription
char*pathA string containing the filename of the file to load.
intflagsFlags based of the specific image type. Currenly flags is only used for loading JPEG files. If set to TRUE the JPEG will be loaded in "fast grayscale" mode. If set to FALSE the image will be drawn in RGB color mode.

See Also

GrFreeImage(), GrGetImageInfo(), GrDrawImageFromFile(), GrDrawImageToFit().