pnm_hdr_new
Allocates a new PnmHdr, and return a handle to it.
pnm_hdr_free hdr
index {PnmHdr, Freeing} index {Freeing PnmHdrs} Deallocates the PnmHdr hdr.
pnm_hdr_copy src dest
Copy the contents of src to dest.
pnm_hdr_parse bp hdr
Parse the BitStream attached to bp, assuming that cursor of bp is at the beginning of an PNM file stream. The header information is parsed from the BitStream and stored into the hdr (a PnmHdr). Comments in the encoded header are skipped. This function returns the number of bytes parsed from bp if parsing is successful. Otherwise, it returns an error. Possible errors are an incorrectly formatted header or an underflow of the bitstream.
pnm_hdr_set_type hdr type
pnm_hdr_set_width hdr width
pnm_hdr_set_height hdr height
pnm_hdr_set_maxval hdr maxval
Each of these functions sets the corresponding slot of hdr. For pnm_set_hdr_type, pass in one of the following strings: "pbm-bin", "pbm-text", "pgm-bin", "pgm-text", "ppm-bin", "ppm-text".
pnm_hdr_get_type hdr
pnm_hdr_get_width hdr
pnm_hdr_get_height hdr
pnm_hdr_get_maxval hdr
Return the value of the corresponding slot in the PnmHdr hdr. The type slot is returned as one of the following strings: "pbm-bin", "pbm-text", "pgm-bin", "pgm-text", "ppm-bin", "ppm-text".
pnm_hdr_encode hdr bp
Output hdr to the BitStream attached to bp. Returns the number of bytes encoded.
ppm_parse bp r g b
Parse PPM image data from bp into ByteImages r, g, and b (the red, green, and blue planes of the PPM image). Assumes the cursor of bp is just before the beginning of the PPM data. Return the number of bytes parsed from the BitStream.
ppm_encode r g b bp
Write the three ByteImages r, g and b in PPM binary format to an output BitStream using bp. Assumes that the BitStream is large enough to hold the PPM data. Return the number of bytes written into the BitStream.
pgm_parse bp byte
Parse PGM image data bp into the ByteImage byte. This function assumes that bp's cursor is just before the beginning of the PGM data. Return the number of bytes parsed from the BitStream.
pgm_encode byte bp
Write the contents of ByteImage byte in PGM binary format to a BitStream using bp. This function assumes that the BitStream is large enough to hold the PGM data. Returns the number of bytes written into the BitStream.
byte_cast_to_bitstream byte
Cast a physical ByteImage byte into a virtual BitStream object of size w*h, where w, and h are the width and height of byte. A new, virtual BitStream object is returned. This function can be used to avoid copying data when encoding.
bitstream_cast_to_byte bs hdr offset
Cast a physical BitStream object bs into a virtual ByteImage object of dimension w x h, where w and h are the width and height specified in the PnmHdr object hdr. The data of the ByteImage must start offset bytes from the first byte of bs. A handle to a new virtual ByteImage is returned. This function can be used to avoid copying the data when decoding.
pbm_parse bp bit
This function parses a PBM image from an input stream using bp into the BitImage bit. It assumes that bp's cursor is just before the beginning of the PBM data. It returns the number of bytes parsed from the BitStream. An error message is returned and bp is not modified if bit is byte-aligned. For byte-aligned BitImages, pbm_parse_8 should be used instead.
pbm_parse_8 bp bit
This function parses a bit image from an input stream using bp into the byte-aligned BitImage bit. It assumes that bp's cursor is just before the beginning of the PBM data. An error message is returned and bp is not modified if bit is not byte-aligned. For non-byte-aligned BitImages, pbm_parse should be used instead.
pbm_encode bit bp
Write the contents of BitImage bit in PBM binary format to a BitStream using bp. This function assumes that the BitStream is large enough to hold the PBM data. An error message is returned and bp is not modified if bit is byte-aligned. For byte-aligned BitImage, pbm_encode_8 should be used instead.
pbm_encode_8 bit bp
Write the contents of the byte-aligned BitImage bit in PBM binary format to an output BitStream using bp. This function assumes that the BitStream is large enough to hold the PBM data. An error message is returned and bp is not modified if bit is not byte-aligned. For non- byte-aligned BitImage, pbm_encode_8 should be used instead.
bit_cast_to_bitstream bit
Cast a physical left-byte-aligned BitImage bit into a virtual BitStream. The resulting BitStream is a PBM encoded image (without the header, of course) that has size of w x h, where w and h are the width and height of bit. A pointer to the new Bitstream is returned.
bitstream_cast_to_bit bs hdr offset
Cast the physical BitStream bs into a virtual left-byte-aligned BitImage. Raw bytes from bs, starting from position offset bytes, is interpreted as the body of BitImage of size w x h, where w and h are specified by the PnmHdr hdr. A handle to the virtual BitImage is returned.
Last updated : Saturday, November 14, 1998, 07:50 PM