Back to index

tetex-bin  3.0
Public Member Functions | Private Attributes
ImageStream Class Reference

#include <Stream.h>

Collaboration diagram for ImageStream:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ImageStream (Stream *strA, int widthA, int nCompsA, int nBitsA)
 ~ImageStream ()
void reset ()
GBool getPixel (Guchar *pix)
GuchargetLine ()
void skipLine ()

Private Attributes

Streamstr
int width
int nComps
int nBits
int nVals
GucharimgLine
int imgIdx

Detailed Description

Definition at line 187 of file Stream.h.


Constructor & Destructor Documentation

ImageStream::ImageStream ( Stream strA,
int  widthA,
int  nCompsA,
int  nBitsA 
)

Definition at line 318 of file Stream.cc.

                                                                          {
  int imgLineSize;

  str = strA;
  width = widthA;
  nComps = nCompsA;
  nBits = nBitsA;

  nVals = width * nComps;
  if (nBits == 1) {
    imgLineSize = (nVals + 7) & ~7;
  } else {
    imgLineSize = nVals;
  }
  imgLine = (Guchar *)gmalloc(imgLineSize * sizeof(Guchar));
  imgIdx = nVals;
}

Here is the call graph for this function:

Definition at line 336 of file Stream.cc.

                          {
  gfree(imgLine);
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 357 of file Stream.cc.

                             {
  Gulong buf, bitMask;
  int bits;
  int c;
  int i;

  if (nBits == 1) {
    for (i = 0; i < nVals; i += 8) {
      c = str->getChar();
      imgLine[i+0] = (Guchar)((c >> 7) & 1);
      imgLine[i+1] = (Guchar)((c >> 6) & 1);
      imgLine[i+2] = (Guchar)((c >> 5) & 1);
      imgLine[i+3] = (Guchar)((c >> 4) & 1);
      imgLine[i+4] = (Guchar)((c >> 3) & 1);
      imgLine[i+5] = (Guchar)((c >> 2) & 1);
      imgLine[i+6] = (Guchar)((c >> 1) & 1);
      imgLine[i+7] = (Guchar)(c & 1);
    }
  } else if (nBits == 8) {
    for (i = 0; i < nVals; ++i) {
      imgLine[i] = str->getChar();
    }
  } else {
    bitMask = (1 << nBits) - 1;
    buf = 0;
    bits = 0;
    for (i = 0; i < nVals; ++i) {
      if (bits < nBits) {
       buf = (buf << 8) | (str->getChar() & 0xff);
       bits += 8;
      }
      imgLine[i] = (Guchar)((buf >> (bits - nBits)) & bitMask);
      bits -= nBits;
    }
  }
  return imgLine;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 344 of file Stream.cc.

                                       {
  int i;

  if (imgIdx >= nVals) {
    getLine();
    imgIdx = 0;
  }
  for (i = 0; i < nComps; ++i) {
    pix[i] = imgLine[imgIdx++];
  }
  return gTrue;
}

Here is the call graph for this function:

Definition at line 340 of file Stream.cc.

                        {
  str->reset();
}

Here is the call graph for this function:

Definition at line 395 of file Stream.cc.

                           {
  int n, i;

  n = (nVals * nBits + 7) >> 3;
  for (i = 0; i < n; ++i) {
    str->getChar();
  }
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 219 of file Stream.h.

Definition at line 218 of file Stream.h.

Definition at line 216 of file Stream.h.

Definition at line 215 of file Stream.h.

Definition at line 217 of file Stream.h.

Definition at line 213 of file Stream.h.

Definition at line 214 of file Stream.h.


The documentation for this class was generated from the following files: