Dali: PNM Files -- C API

[ Header Files | Types | Constants | Allocation | Initialization | PnmHdr Queries | Output | PPM Files | PGM Files | PBM Files | See Also ]

Header Files

#include <dvmpnm.h>

Type Definitions

PnmHdr

Header used for PBM, PGM, and PPM files.

      typedef struct PnmHdr {
          int type;
          int width;
          int height;
          int maxVal;
      } PnmHdr;
  
type
The type of the image (see Constant section below).
width
The width of the image in number of pixels.
height
The height of the image in number of pixels.
maxVal
The maximum value any pixels in the image can have (typically 255). Note that this is not the maximum value any pixel in the image does have. Instead, it's an indication of the precision of the image.

Constants

PnmHdr Type

The type of the image.

    #define PBM_TEXT 1
    #define PGM_TEXT 2
    #define PPM_TEXT 3
    #define PBM_BIN  4
    #define PGM_BIN  5
    #define PPM_BIN  6
  

Return Code

Return code from various PNM primitives. DVM_PNM_OK indicates the primitive executed succesfully. DVM_PNM_INVALID_HDR indicates there is an error in the header. DVM_PNM_BS_UNDERFLOW indicates the bitstream does not contain enough bits for the complete file. DVM_PNM_IS_BYTE_ALIGN and DVM_PNM_NOT_BYTE_ALIGN are

    #define DVM_PNM_OK 0
    #define DVM_PNM_INVALID_HDR -1
    #define DVM_PNM_BS_UNDERFLOW -2
    #define DVM_PNM_IS_BYTE_ALIGN -3
    #define DVM_PNM_NOT_BYTE_ALIGN -4
  

Operators

Allocation

PnmHdr *PnmHdrNew ( )

void PnmHdrFree (PnmHdr *hdr)


Initialization

void PnmHdrCopy (PnmHdr *src, PnmHdr *dest)

int PnmHdrParse (BitParser *bp, PnmHdr *hdr)

void PnmHdrSetType (PnmHdr *hdr, int type)
void PnmHdrSetWidth (PnmHdr *hdr, int width)
void PnmHdrSetHeight (PnmHdr *hdr, int height)
void PnmHdrSetMaxVal (PnmHdr *hdr, int maxval)


PnmHdr Queries

int PnmHdrGetType (PnmHdr *hdr)
int PnmHdrGetWidth (PnmHdr *hdr)
int PnmHdrGetHeight (PnmHdr *hdr)
int PnmHdrGetMaxVal (PnmHdr *hdr)


Output

int PnmHdrEncode (PnmHdr *hdr, BitParser *bp)


PPM Files

int PpmParse (BitParser *bp, ByteImage *r, ByteImage *g, ByteImage *b)

int PpmEncode (ByteImage *r, ByteImage *g, ByteImage *b, BitParser *bp)


PGM Files

int PgmParse (BitParser *bp, ByteImage *byte)

int PgmEncode (ByteImage *byte, BitParser *bp)

BitStream *ByteCastToBitStream (ByteImage *byte)

Byte *BitStreamCastToByte (BitStream *bs, PnmHdr *hdr, int offset)


PBM Files

int PbmParse (BitParser *bp, BitImage *bit)

int PbmParse8 (BitParser *bp, BitImage *bit)

int PbmEncode (BitImage *bit, BitParser *bp)

int PbmEncode8 (BitImage *bit, BitParser *bp)

BitStream *BitCastToBitStream (BitImage *bit)

Bit *BitStreamCastToBit (BitStream *bs, PnmHdr *hdr, int offset)


See Also

ByteImage , BitImage , Streams , NetPBM


Last updated : Saturday, November 14, 1998, 07:50 PM