<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> <html><head><title>OpenRM - RMI Library (rmppm.c)</title></head> <body bgcolor=white fgcolor=black> <table width="100%" border=2 cellspacing=0 cellpadding=0 bgcolor="khaki" valign="center"> <th><img src="./images/ormsg.gif"> </th> </table> <spacer type=vertical size=15> <h2>Index of OpenRM - RMI Library</h2> <spacer type=vertical size=15> <a name="rmiReadPPM"> <pre><b> RMimage * rmiReadPPM (const char * filename, RMenum format, unsigned char alpha) </b></pre> <pre> char * filename - filename of PGM/PPM image file to read RMenum format - image format: RM_IMAGE_ALPHA, RM_IMAGE_LUMINANCE, RM_IMAGE_RGB, RM_IMAGE_RGBA unsigned char alpha - alpha for RMimage [0..255] </pre> <menu><P> Read in a PGM/PPM file and return a handle to the RMimage object created from the image file. </P> <P> Certain simplifying assumptions are made about the file format: </P> <P> <pre> image header - the magic number <CR> - comments (lines starting with "#") may follow <CR> - the width and height follow, delineated by whitespace <CR> - comments may follow <CR> - maximum value parameter follows, delineated by whitespace <CR> </P> <P> P3 # this is an example 128x128 PPM file (8-bit RGB pixels) 128 128 255 [image data] </P> <P> image pixels - ASCII lines may be no more than 70 characters (PBM/PGM/PPM spec) - image data is assumed to be ordered top to bottom, left to right </pre> The following RMimage formats are supported: RM_IMAGE_ALPHA, RM_IMAGE_LUMINANCE, RM_IMAGE_RGB, RM_IMAGE_RGBA </P> <P> The user-specified image format controls how the image is read in as an RMimage: </P> <P> <pre> PGM files: map directly to RM_IMAGE_ALPHA + RM_IMAGE_LUMINANCE channel replicated RGB to RM_IMAGE_RGB channel replicated RGB to RM_IMAGE_RGBA with alpha </P> <P> PPM files: image luminance to RM_IMAGE_ALPHA + RM_IMAGE_LUMINANCE map directly to RM_IMAGE_RGB map directly to RM_IMAGE_RGBA with alpha </pre> </P> <P> Currently, pixels must have type RM_UNSIGNED_BYTE. </P></menu> <i>librmi library source file: rmppm.c </i><hr width="75%"> <a name="rmiWritePPM"> <pre><b> RMenum rmiWritePPM (const char * filename, int type, const RMimage * image) </b></pre> <pre> const char * filename - filename for RMimage write int type - image file type (RMI_PPM_ASCII or RMI_PPM_BINARY) const RMimage * image - image to write </pre> <menu><P> Write the user-supplied RMimage to a PGM/PPM image file. The type of file written is inferred from the RMimage format and user-supplied type. Returns RM_CHILL upon success, or RM_WHACKED upon failure. </P> <P> The following RMimage formats are supported by PBM/PGM/PPM files: <pre> RM_IMAGE_ALPHA, RM_IMAGE_LUMINANCE (output as PGM) RM_IMAGE_RGB (outputs as PPM) RM_IMAGE_RGBA (outputs as PPM, alpha discarded) </pre> </P> <P> The file format follows the PGM/PPM spec, as described in the docs for rmiWritePPM (). </P> <P> Currently, pixel components must have type RM_UNSIGNED_BYTE. </P></menu> <i>librmi library source file: rmppm.c </i><hr width="75%"> </body></html>