This file contains a PNM codec. More...
#include <SPL/config.hpp>
#include <iostream>
#include <sstream>
#include <cassert>
#include <cstdlib>
Go to the source code of this file.
Classes | |
struct | SPL::PnmHeader |
The header information for PNM data. More... | |
Enumerations | |
enum | SPL::PnmMagic |
The signature values that can appear at the start of the header. More... | |
enum | SPL::PnmType |
The type of the PNM data. More... | |
enum | SPL::PnmFmt |
The format of the PNM data (i.e., binary or text). More... | |
Functions | |
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::pnmMaxValToPrec (int maxVal) |
Determine the precision from the maximum value. More... | |
int | SPL::pnmGetNumComps (PnmType type) |
Get the number of components from the PNM type. More... | |
long | SPL::pnmOnes (int n) |
Get an integer whose representation in binary consists of the specified number of ones. More... | |
int | SPL::pnmGetHeader (std::istream &in, PnmHeader &header) |
Read a PNM header from the specified stream. More... | |
int | SPL::pnmPutHeader (std::ostream &out, PnmHeader &header) |
Write a PNM header to the specified stream. More... | |
int | SPL::pnmGetChar (std::istream &in) |
Read a character 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... | |
long | SPL::pnmGetBinInt (std::istream &in, int wordSize, bool sgnd, int &status) |
Read an integer from the specified stream. More... | |
int | SPL::pnmPutBinInt (std::ostream &out, int wordSize, bool sgnd, long val) |
Write an integer from the specified stream. More... | |
template<class GetData > | |
int | SPL::pnmEncode (std::ostream &outStream, int width, int height, int numComps, int maxVal, bool sgnd, GetData &getData, bool binaryFormat) |
Write data encoded in the PNM format to the specified stream. More... | |
template<class GetData > | |
int | SPL::putData (std::ostream &out, PnmHeader &header, GetData &getData) |
Write the actual image data to a stream. More... | |
template<class Initialize > | |
int | SPL::pnmDecode (std::istream &inStream, Initialize &initialize) |
Read data encoded in the PNM format from the specified stream. More... | |
template<class PutData > | |
int | SPL::getData (std::istream &in, PnmHeader &header, PutData &putData) |
Read the actual image data from the specified stream. More... | |
Variables | |
const int | SPL::pnmMaxLineLen = 80 |
The maximum line length to be produced when encoding in text format. More... | |
This file contains a PNM codec.
enum SPL::PnmFmt |
The format of the PNM data (i.e., binary or text).
enum SPL::PnmMagic |
The signature values that can appear at the start of the header.
enum SPL::PnmType |
The type of the PNM data.
int SPL::getData | ( | std::istream & | in, |
PnmHeader & | header, | ||
PutData & | putData | ||
) |
Read the actual image data from the specified stream.
int SPL::pnmDecode | ( | std::istream & | inStream, |
Initialize & | initialize | ||
) |
Read data encoded in the PNM format from the specified stream.
int SPL::pnmEncode | ( | std::ostream & | outStream, |
int | width, | ||
int | height, | ||
int | numComps, | ||
int | maxVal, | ||
bool | sgnd, | ||
GetData & | getData, | ||
bool | binaryFormat | ||
) |
Write data encoded in the PNM format to the specified stream.
long SPL::pnmGetBinInt | ( | std::istream & | in, |
int | wordSize, | ||
bool | sgnd, | ||
int & | status | ||
) |
Read an integer from the specified stream.
int SPL::pnmGetChar | ( | std::istream & | in | ) |
Read a character from the specified stream.
PnmFmt SPL::pnmGetFmt | ( | PnmMagic | magic | ) |
Determine the format (i.e., text or binary) from magic number.
int SPL::pnmGetHeader | ( | std::istream & | in, |
PnmHeader & | header | ||
) |
Read a PNM header from the specified stream.
int SPL::pnmGetNumComps | ( | PnmType | type | ) |
Get the number of components from the PNM type.
int SPL::pnmGetTxtBit | ( | std::istream & | in | ) |
Read a bit from the specified stream.
long SPL::pnmGetTxtInt | ( | std::istream & | in, |
bool | sgnd, | ||
int & | status | ||
) |
Read an integer from the specified stream.
PnmType SPL::pnmGetType | ( | PnmMagic | magic | ) |
Determine the type (i.e., PGM or PPM) from the magic number.
int SPL::pnmMaxValToPrec | ( | int | maxVal | ) |
Determine the precision from the maximum value.
|
inline |
Get an integer whose representation in binary consists of the specified number of ones.
int SPL::pnmPutBinInt | ( | std::ostream & | out, |
int | wordSize, | ||
bool | sgnd, | ||
long | val | ||
) |
Write an integer from the specified stream.
int SPL::pnmPutHeader | ( | std::ostream & | out, |
PnmHeader & | header | ||
) |
Write a PNM header to the specified stream.
int SPL::putData | ( | std::ostream & | out, |
PnmHeader & | header, | ||
GetData & | getData | ||
) |
Write the actual image data to a stream.
const int SPL::pnmMaxLineLen = 80 |
The maximum line length to be produced when encoding in text format.