Back to index

tetex-bin  3.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
GfxShading Class Reference

#include <GfxState.h>

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

List of all members.

Public Member Functions

 GfxShading (int typeA)
 GfxShading (GfxShading *shading)
virtual ~GfxShading ()
virtual GfxShadingcopy ()=0
int getType ()
GfxColorSpacegetColorSpace ()
GfxColorgetBackground ()
GBool getHasBackground ()
void getBBox (double *xMinA, double *yMinA, double *xMaxA, double *yMaxA)
GBool getHasBBox ()

Static Public Member Functions

static GfxShadingparse (Object *obj)

Protected Member Functions

GBool init (Dict *dict)

Protected Attributes

int type
GfxColorSpacecolorSpace
GfxColor background
GBool hasBackground
double xMin
double yMin
double xMax
double yMax
GBool hasBBox

Detailed Description

Definition at line 550 of file GfxState.h.


Constructor & Destructor Documentation

Definition at line 1394 of file GfxState.cc.

                                {
  type = typeA;
  colorSpace = NULL;
}

Definition at line 1399 of file GfxState.cc.

                                          {
  int i;

  type = shading->type;
  colorSpace = shading->colorSpace->copy();
  for (i = 0; i < gfxColorMaxComps; ++i) {
    background.c[i] = shading->background.c[i];
  }
  hasBackground = shading->hasBackground;
  xMin = shading->xMin;
  yMin = shading->yMin;
  xMax = shading->xMax;
  yMax = shading->yMax;
  hasBBox = shading->hasBBox;
}

Here is the call graph for this function:

GfxShading::~GfxShading ( ) [virtual]

Definition at line 1415 of file GfxState.cc.

                        {
  if (colorSpace) {
    delete colorSpace;
  }
}

Member Function Documentation

virtual GfxShading* GfxShading::copy ( ) [pure virtual]

Implemented in GfxRadialShading, GfxAxialShading, and GfxFunctionShading.

Here is the caller graph for this function:

Definition at line 563 of file GfxState.h.

{ return &background; }
void GfxShading::getBBox ( double *  xMinA,
double *  yMinA,
double *  xMaxA,
double *  yMaxA 
) [inline]

Definition at line 565 of file GfxState.h.

    { *xMinA = xMin; *yMinA = yMin; *xMaxA = xMax; *yMaxA = yMax; }

Here is the caller graph for this function:

Definition at line 562 of file GfxState.h.

{ return colorSpace; }

Here is the caller graph for this function:

Definition at line 564 of file GfxState.h.

{ return hasBackground; }

Definition at line 567 of file GfxState.h.

{ return hasBBox; }

Here is the caller graph for this function:

int GfxShading::getType ( ) [inline]

Definition at line 561 of file GfxState.h.

{ return type; }

Here is the caller graph for this function:

GBool GfxShading::init ( Dict dict) [protected]

Definition at line 1464 of file GfxState.cc.

                                 {
  Object obj1, obj2;
  int i;

  dict->lookup("ColorSpace", &obj1);
  if (!(colorSpace = GfxColorSpace::parse(&obj1))) {
    error(-1, "Bad color space in shading dictionary");
    obj1.free();
    return gFalse;
  }
  obj1.free();

  for (i = 0; i < gfxColorMaxComps; ++i) {
    background.c[i] = 0;
  }
  hasBackground = gFalse;
  if (dict->lookup("Background", &obj1)->isArray()) {
    if (obj1.arrayGetLength() == colorSpace->getNComps()) {
      hasBackground = gTrue;
      for (i = 0; i < colorSpace->getNComps(); ++i) {
       background.c[i] = obj1.arrayGet(i, &obj2)->getNum();
       obj2.free();
      }
    } else {
      error(-1, "Bad Background in shading dictionary");
    }
  }
  obj1.free();

  xMin = yMin = xMax = yMax = 0;
  hasBBox = gFalse;
  if (dict->lookup("BBox", &obj1)->isArray()) {
    if (obj1.arrayGetLength() == 4) {
      hasBBox = gTrue;
      xMin = obj1.arrayGet(0, &obj2)->getNum();
      obj2.free();
      yMin = obj1.arrayGet(1, &obj2)->getNum();
      obj2.free();
      xMax = obj1.arrayGet(2, &obj2)->getNum();
      obj2.free();
      yMax = obj1.arrayGet(3, &obj2)->getNum();
      obj2.free();
    } else {
      error(-1, "Bad BBox in shading dictionary");
    }
  }
  obj1.free();

  return gTrue;
}

Here is the call graph for this function:

Here is the caller graph for this function:

GfxShading * GfxShading::parse ( Object obj) [static]

Definition at line 1421 of file GfxState.cc.

                                         {
  GfxShading *shading;
  Dict *dict;
  int typeA;
  Object obj1;

  if (obj->isDict()) {
    dict = obj->getDict();
  } else if (obj->isStream()) {
    dict = obj->streamGetDict();
  } else {
    return NULL;
  }

  if (!dict->lookup("ShadingType", &obj1)->isInt()) {
    error(-1, "Invalid ShadingType in shading dictionary");
    obj1.free();
    return NULL;
  }
  typeA = obj1.getInt();
  obj1.free();

  switch (typeA) {
  case 1:
    shading = GfxFunctionShading::parse(dict);
    break;
  case 2:
    shading = GfxAxialShading::parse(dict);
    break;
  case 3:
    shading = GfxRadialShading::parse(dict);
    break;
  default:
    error(-1, "Unimplemented shading type %d", typeA);
    goto err1;
  }

  return shading;

 err1:
  return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 575 of file GfxState.h.

Definition at line 574 of file GfxState.h.

Definition at line 576 of file GfxState.h.

Definition at line 578 of file GfxState.h.

int GfxShading::type [protected]

Definition at line 573 of file GfxState.h.

double GfxShading::xMax [protected]

Definition at line 577 of file GfxState.h.

double GfxShading::xMin [protected]

Definition at line 577 of file GfxState.h.

double GfxShading::yMax [protected]

Definition at line 577 of file GfxState.h.

double GfxShading::yMin [protected]

Definition at line 577 of file GfxState.h.


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