Signal/Geometry Processing Library (SPL)  2.0.8
pnmCodec.cpp File Reference

This file contains a PNM codec. More...

#include <SPL/config.hpp>
#include <iostream>
#include <sstream>
#include <cassert>
#include <cstdlib>
#include <SPL/pnmCodec.hpp>

Functions

int SPL::pnmPutHeader (std::ostream &out, PnmHeader &header)
 Write a PNM header to the specified stream. More...
 
int SPL::pnmPutBinInt (std::ostream &out, int wordSize, bool sgnd, long val)
 Write an integer from the specified stream. More...
 
int SPL::pnmGetHeader (std::istream &in, PnmHeader &header)
 Read a PNM header from the specified stream. More...
 
int SPL::pnmGetTxtBit (std::istream &in)
 Read a bit from the specified stream. More...
 
long SPL::pnmGetTxtInt (std::istream &in, bool sgnd, int &status)
 Read an integer from the specified stream. More...
 
int SPL::pnmGetChar (std::istream &in)
 Read a character from the specified stream. More...
 
long SPL::pnmGetBinInt (std::istream &in, int wordSize, bool sgnd, int &status)
 Read an integer from the specified stream. More...
 
PnmType SPL::pnmGetType (PnmMagic magic)
 Determine the type (i.e., PGM or PPM) from the magic number. More...
 
PnmFmt SPL::pnmGetFmt (PnmMagic magic)
 Determine the format (i.e., text or binary) from magic number. More...
 
int SPL::pnmGetNumComps (PnmType type)
 Get the number of components from the PNM type. More...
 
int SPL::pnmMaxValToPrec (int maxVal)
 Determine the precision from the maximum value. More...
 

Detailed Description

This file contains a PNM codec.

Function Documentation

◆ pnmGetBinInt()

long SPL::pnmGetBinInt ( std::istream &  in,
int  wordSize,
bool  sgnd,
int &  status 
)

Read an integer from the specified stream.

◆ pnmGetChar()

int SPL::pnmGetChar ( std::istream &  in)

Read a character from the specified stream.

◆ pnmGetFmt()

PnmFmt SPL::pnmGetFmt ( PnmMagic  magic)

Determine the format (i.e., text or binary) from magic number.

◆ pnmGetHeader()

int SPL::pnmGetHeader ( std::istream &  in,
PnmHeader header 
)

Read a PNM header from the specified stream.

◆ pnmGetNumComps()

int SPL::pnmGetNumComps ( PnmType  type)

Get the number of components from the PNM type.

◆ pnmGetTxtBit()

int SPL::pnmGetTxtBit ( std::istream &  in)

Read a bit from the specified stream.

◆ pnmGetTxtInt()

long SPL::pnmGetTxtInt ( std::istream &  in,
bool  sgnd,
int &  status 
)

Read an integer from the specified stream.

◆ pnmGetType()

PnmType SPL::pnmGetType ( PnmMagic  magic)

Determine the type (i.e., PGM or PPM) from the magic number.

◆ pnmMaxValToPrec()

int SPL::pnmMaxValToPrec ( int  maxVal)

Determine the precision from the maximum value.

◆ pnmPutBinInt()

int SPL::pnmPutBinInt ( std::ostream &  out,
int  wordSize,
bool  sgnd,
long  val 
)

Write an integer from the specified stream.

◆ pnmPutHeader()

int SPL::pnmPutHeader ( std::ostream &  out,
PnmHeader header 
)

Write a PNM header to the specified stream.