Back to index

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

#include <GfxState.h>

Inheritance diagram for GfxCalRGBColorSpace:
Inheritance graph
[legend]
Collaboration diagram for GfxCalRGBColorSpace:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 GfxCalRGBColorSpace ()
virtual ~GfxCalRGBColorSpace ()
virtual GfxColorSpacecopy ()
virtual GfxColorSpaceMode getMode ()
virtual void getGray (GfxColor *color, double *gray)
virtual void getRGB (GfxColor *color, GfxRGB *rgb)
virtual void getCMYK (GfxColor *color, GfxCMYK *cmyk)
virtual int getNComps ()
double getWhiteX ()
double getWhiteY ()
double getWhiteZ ()
double getBlackX ()
double getBlackY ()
double getBlackZ ()
double getGammaR ()
double getGammaG ()
double getGammaB ()
double * getMatrix ()
virtual void getDefaultRanges (double *decodeLow, double *decodeRange, int maxImgPixel)

Static Public Member Functions

static GfxColorSpaceparse (Array *arr)
static GfxColorSpaceparse (Object *csObj)
static int getNumColorSpaceModes ()
static char * getColorSpaceModeName (int idx)

Private Attributes

double whiteX
double whiteY
double whiteZ
double blackX
double blackY
double blackZ
double gammaR
double gammaG
double gammaB
double mat [9]

Detailed Description

Definition at line 189 of file GfxState.h.


Constructor & Destructor Documentation

Definition at line 289 of file GfxState.cc.

                                         {
  whiteX = whiteY = whiteZ = 1;
  blackX = blackY = blackZ = 0;
  gammaR = gammaG = gammaB = 1;
  mat[0] = 1; mat[1] = 0; mat[2] = 0;
  mat[3] = 0; mat[4] = 1; mat[5] = 0;
  mat[6] = 0; mat[7] = 0; mat[8] = 1;
}

Here is the caller graph for this function:

Definition at line 298 of file GfxState.cc.

                                          {
}

Member Function Documentation

Implements GfxColorSpace.

Definition at line 301 of file GfxState.cc.

                                         {
  GfxCalRGBColorSpace *cs;
  int i;

  cs = new GfxCalRGBColorSpace();
  cs->whiteX = whiteX;
  cs->whiteY = whiteY;
  cs->whiteZ = whiteZ;
  cs->blackX = blackX;
  cs->blackY = blackY;
  cs->blackZ = blackZ;
  cs->gammaR = gammaR;
  cs->gammaG = gammaG;
  cs->gammaB = gammaB;
  for (i = 0; i < 9; ++i) {
    cs->mat[i] = mat[i];
  }
  return cs;
}

Here is the call graph for this function:

double GfxCalRGBColorSpace::getBlackX ( ) [inline]

Definition at line 210 of file GfxState.h.

{ return blackX; }
double GfxCalRGBColorSpace::getBlackY ( ) [inline]

Definition at line 211 of file GfxState.h.

{ return blackY; }
double GfxCalRGBColorSpace::getBlackZ ( ) [inline]

Definition at line 212 of file GfxState.h.

{ return blackZ; }
void GfxCalRGBColorSpace::getCMYK ( GfxColor color,
GfxCMYK cmyk 
) [virtual]

Implements GfxColorSpace.

Definition at line 397 of file GfxState.cc.

                                                                {
  double c, m, y, k;

  c = clip01(1 - color->c[0]);
  m = clip01(1 - color->c[1]);
  y = clip01(1 - color->c[2]);
  k = c;
  if (m < k) {
    k = m;
  }
  if (y < k) {
    k = y;
  }
  cmyk->c = c - k;
  cmyk->m = m - k;
  cmyk->y = y - k;
  cmyk->k = k;
}

Here is the call graph for this function:

char * GfxColorSpace::getColorSpaceModeName ( int  idx) [static, inherited]

Definition at line 124 of file GfxState.cc.

                                                  {
  return gfxColorSpaceModeNames[idx];
}
void GfxColorSpace::getDefaultRanges ( double *  decodeLow,
double *  decodeRange,
int  maxImgPixel 
) [virtual, inherited]

Reimplemented in GfxIndexedColorSpace, GfxICCBasedColorSpace, and GfxLabColorSpace.

Definition at line 110 of file GfxState.cc.

                                                  {
  int i;

  for (i = 0; i < getNComps(); ++i) {
    decodeLow[i] = 0;
    decodeRange[i] = 1;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

double GfxCalRGBColorSpace::getGammaB ( ) [inline]

Definition at line 215 of file GfxState.h.

{ return gammaB; }
double GfxCalRGBColorSpace::getGammaG ( ) [inline]

Definition at line 214 of file GfxState.h.

{ return gammaG; }
double GfxCalRGBColorSpace::getGammaR ( ) [inline]

Definition at line 213 of file GfxState.h.

{ return gammaR; }
void GfxCalRGBColorSpace::getGray ( GfxColor color,
double *  gray 
) [virtual]

Implements GfxColorSpace.

Definition at line 385 of file GfxState.cc.

                                                               {
  *gray = clip01(0.299 * color->c[0] +
               0.587 * color->c[1] +
               0.114 * color->c[2]);
}

Here is the call graph for this function:

double* GfxCalRGBColorSpace::getMatrix ( ) [inline]

Definition at line 216 of file GfxState.h.

{ return mat; }
virtual GfxColorSpaceMode GfxCalRGBColorSpace::getMode ( ) [inline, virtual]

Implements GfxColorSpace.

Definition at line 195 of file GfxState.h.

{ return csCalRGB; }
virtual int GfxCalRGBColorSpace::getNComps ( ) [inline, virtual]

Implements GfxColorSpace.

Definition at line 204 of file GfxState.h.

{ return 3; }
int GfxColorSpace::getNumColorSpaceModes ( ) [static, inherited]

Definition at line 120 of file GfxState.cc.

                                         {
  return nGfxColorSpaceModes;
}
void GfxCalRGBColorSpace::getRGB ( GfxColor color,
GfxRGB rgb 
) [virtual]

Implements GfxColorSpace.

Definition at line 391 of file GfxState.cc.

                                                             {
  rgb->r = clip01(color->c[0]);
  rgb->g = clip01(color->c[1]);
  rgb->b = clip01(color->c[2]);
}

Here is the call graph for this function:

double GfxCalRGBColorSpace::getWhiteX ( ) [inline]

Definition at line 207 of file GfxState.h.

{ return whiteX; }
double GfxCalRGBColorSpace::getWhiteY ( ) [inline]

Definition at line 208 of file GfxState.h.

{ return whiteY; }
double GfxCalRGBColorSpace::getWhiteZ ( ) [inline]

Definition at line 209 of file GfxState.h.

{ return whiteZ; }
GfxColorSpace * GfxColorSpace::parse ( Object csObj) [static, inherited]

Definition at line 59 of file GfxState.cc.

                                                 {
  GfxColorSpace *cs;
  Object obj1;

  cs = NULL;
  if (csObj->isName()) {
    if (csObj->isName("DeviceGray") || csObj->isName("G")) {
      cs = new GfxDeviceGrayColorSpace();
    } else if (csObj->isName("DeviceRGB") || csObj->isName("RGB")) {
      cs = new GfxDeviceRGBColorSpace();
    } else if (csObj->isName("DeviceCMYK") || csObj->isName("CMYK")) {
      cs = new GfxDeviceCMYKColorSpace();
    } else if (csObj->isName("Pattern")) {
      cs = new GfxPatternColorSpace(NULL);
    } else {
      error(-1, "Bad color space '%s'", csObj->getName());
    }
  } else if (csObj->isArray()) {
    csObj->arrayGet(0, &obj1);
    if (obj1.isName("DeviceGray") || obj1.isName("G")) {
      cs = new GfxDeviceGrayColorSpace();
    } else if (obj1.isName("DeviceRGB") || obj1.isName("RGB")) {
      cs = new GfxDeviceRGBColorSpace();
    } else if (obj1.isName("DeviceCMYK") || obj1.isName("CMYK")) {
      cs = new GfxDeviceCMYKColorSpace();
    } else if (obj1.isName("CalGray")) {
      cs = GfxCalGrayColorSpace::parse(csObj->getArray());
    } else if (obj1.isName("CalRGB")) {
      cs = GfxCalRGBColorSpace::parse(csObj->getArray());
    } else if (obj1.isName("Lab")) {
      cs = GfxLabColorSpace::parse(csObj->getArray());
    } else if (obj1.isName("ICCBased")) {
      cs = GfxICCBasedColorSpace::parse(csObj->getArray());
    } else if (obj1.isName("Indexed") || obj1.isName("I")) {
      cs = GfxIndexedColorSpace::parse(csObj->getArray());
    } else if (obj1.isName("Separation")) {
      cs = GfxSeparationColorSpace::parse(csObj->getArray());
    } else if (obj1.isName("DeviceN")) {
      cs = GfxDeviceNColorSpace::parse(csObj->getArray());
    } else if (obj1.isName("Pattern")) {
      cs = GfxPatternColorSpace::parse(csObj->getArray());
    } else {
      error(-1, "Bad color space");
    }
    obj1.free();
  } else {
    error(-1, "Bad color space - expected name or array");
  }
  return cs;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 321 of file GfxState.cc.

                                                    {
  GfxCalRGBColorSpace *cs;
  Object obj1, obj2, obj3;
  int i;

  arr->get(1, &obj1);
  if (!obj1.isDict()) {
    error(-1, "Bad CalRGB color space");
    obj1.free();
    return NULL;
  }
  cs = new GfxCalRGBColorSpace();
  if (obj1.dictLookup("WhitePoint", &obj2)->isArray() &&
      obj2.arrayGetLength() == 3) {
    obj2.arrayGet(0, &obj3);
    cs->whiteX = obj3.getNum();
    obj3.free();
    obj2.arrayGet(1, &obj3);
    cs->whiteY = obj3.getNum();
    obj3.free();
    obj2.arrayGet(2, &obj3);
    cs->whiteZ = obj3.getNum();
    obj3.free();
  }
  obj2.free();
  if (obj1.dictLookup("BlackPoint", &obj2)->isArray() &&
      obj2.arrayGetLength() == 3) {
    obj2.arrayGet(0, &obj3);
    cs->blackX = obj3.getNum();
    obj3.free();
    obj2.arrayGet(1, &obj3);
    cs->blackY = obj3.getNum();
    obj3.free();
    obj2.arrayGet(2, &obj3);
    cs->blackZ = obj3.getNum();
    obj3.free();
  }
  obj2.free();
  if (obj1.dictLookup("Gamma", &obj2)->isArray() &&
      obj2.arrayGetLength() == 3) {
    obj2.arrayGet(0, &obj3);
    cs->gammaR = obj3.getNum();
    obj3.free();
    obj2.arrayGet(1, &obj3);
    cs->gammaG = obj3.getNum();
    obj3.free();
    obj2.arrayGet(2, &obj3);
    cs->gammaB = obj3.getNum();
    obj3.free();
  }
  obj2.free();
  if (obj1.dictLookup("Matrix", &obj2)->isArray() &&
      obj2.arrayGetLength() == 9) {
    for (i = 0; i < 9; ++i) {
      obj2.arrayGet(i, &obj3);
      cs->mat[i] = obj3.getNum();
      obj3.free();
    }
  }
  obj2.free();
  obj1.free();
  return cs;
}

Here is the call graph for this function:


Member Data Documentation

double GfxCalRGBColorSpace::blackX [private]

Definition at line 221 of file GfxState.h.

double GfxCalRGBColorSpace::blackY [private]

Definition at line 221 of file GfxState.h.

double GfxCalRGBColorSpace::blackZ [private]

Definition at line 221 of file GfxState.h.

double GfxCalRGBColorSpace::gammaB [private]

Definition at line 222 of file GfxState.h.

double GfxCalRGBColorSpace::gammaG [private]

Definition at line 222 of file GfxState.h.

double GfxCalRGBColorSpace::gammaR [private]

Definition at line 222 of file GfxState.h.

double GfxCalRGBColorSpace::mat[9] [private]

Definition at line 223 of file GfxState.h.

double GfxCalRGBColorSpace::whiteX [private]

Definition at line 220 of file GfxState.h.

double GfxCalRGBColorSpace::whiteY [private]

Definition at line 220 of file GfxState.h.

double GfxCalRGBColorSpace::whiteZ [private]

Definition at line 220 of file GfxState.h.


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