Back to index

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

#include <GfxState.h>

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

List of all members.

Public Member Functions

 GfxRadialShading (double x0A, double y0A, double r0A, double x1A, double y1A, double r1A, double t0A, double t1A, Function **funcsA, int nFuncsA, GBool extend0A, GBool extend1A)
 GfxRadialShading (GfxRadialShading *shading)
virtual ~GfxRadialShading ()
virtual GfxShadingcopy ()
void getCoords (double *x0A, double *y0A, double *r0A, double *x1A, double *y1A, double *r1A)
double getDomain0 ()
double getDomain1 ()
void getColor (double t, GfxColor *color)
GBool getExtend0 ()
GBool getExtend1 ()
int getType ()
GfxColorSpacegetColorSpace ()
GfxColorgetBackground ()
GBool getHasBackground ()
void getBBox (double *xMinA, double *yMinA, double *xMaxA, double *yMaxA)
GBool getHasBBox ()

Static Public Member Functions

static GfxRadialShadingparse (Dict *dict)
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

Private Attributes

double x0
double y0
double r0
double x1
double y1
double r1
double t0
double t1
Functionfuncs [gfxColorMaxComps]
int nFuncs
GBool extend0
GBool extend1

Detailed Description

Definition at line 652 of file GfxState.h.


Constructor & Destructor Documentation

GfxRadialShading::GfxRadialShading ( double  x0A,
double  y0A,
double  r0A,
double  x1A,
double  y1A,
double  r1A,
double  t0A,
double  t1A,
Function **  funcsA,
int  nFuncsA,
GBool  extend0A,
GBool  extend1A 
)

Definition at line 1819 of file GfxState.cc.

                                                              :
  GfxShading(3)
{
  int i;

  x0 = x0A;
  y0 = y0A;
  r0 = r0A;
  x1 = x1A;
  y1 = y1A;
  r1 = r1A;
  t0 = t0A;
  t1 = t1A;
  nFuncs = nFuncsA;
  for (i = 0; i < nFuncs; ++i) {
    funcs[i] = funcsA[i];
  }
  extend0 = extend0A;
  extend1 = extend1A;
}

Here is the caller graph for this function:

Definition at line 1844 of file GfxState.cc.

                                                           :
  GfxShading(shading)
{
  int i;

  x0 = shading->x0;
  y0 = shading->y0;
  r0 = shading->r0;
  x1 = shading->x1;
  y1 = shading->y1;
  r1 = shading->r1;
  t0 = shading->t0;
  y1 = shading->t1;
  nFuncs = shading->nFuncs;
  for (i = 0; i < nFuncs; ++i) {
    funcs[i] = shading->funcs[i]->copy();
  }
  extend0 = shading->extend0;
  extend1 = shading->extend1;
}

Here is the call graph for this function:

Definition at line 1865 of file GfxState.cc.

                                    {
  int i;

  for (i = 0; i < nFuncs; ++i) {
    delete funcs[i];
  }
}

Member Function Documentation

Implements GfxShading.

Definition at line 1962 of file GfxState.cc.

                                   {
  return new GfxRadialShading(this);
}

Here is the call graph for this function:

GfxColor* GfxShading::getBackground ( ) [inline, inherited]

Definition at line 563 of file GfxState.h.

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

Definition at line 565 of file GfxState.h.

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

Here is the caller graph for this function:

void GfxRadialShading::getColor ( double  t,
GfxColor color 
)

Definition at line 1966 of file GfxState.cc.

                                                         {
  int i;

  // NB: there can be one function with n outputs or n functions with
  // one output each (where n = number of color components)
  for (i = 0; i < nFuncs; ++i) {
    funcs[i]->transform(&t, &color->c[i]);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

GfxColorSpace* GfxShading::getColorSpace ( ) [inline, inherited]

Definition at line 562 of file GfxState.h.

{ return colorSpace; }

Here is the caller graph for this function:

void GfxRadialShading::getCoords ( double *  x0A,
double *  y0A,
double *  r0A,
double *  x1A,
double *  y1A,
double *  r1A 
) [inline]

Definition at line 667 of file GfxState.h.

    { *x0A = x0; *y0A = y0; *r0A = r0; *x1A = x1; *y1A = y1; *r1A = r1; }

Here is the caller graph for this function:

double GfxRadialShading::getDomain0 ( ) [inline]

Definition at line 670 of file GfxState.h.

{ return t0; }

Here is the caller graph for this function:

double GfxRadialShading::getDomain1 ( ) [inline]

Definition at line 671 of file GfxState.h.

{ return t1; }

Here is the caller graph for this function:

Definition at line 673 of file GfxState.h.

{ return extend0; }

Here is the caller graph for this function:

Definition at line 674 of file GfxState.h.

{ return extend1; }

Here is the caller graph for this function:

GBool GfxShading::getHasBackground ( ) [inline, inherited]

Definition at line 564 of file GfxState.h.

{ return hasBackground; }
GBool GfxShading::getHasBBox ( ) [inline, inherited]

Definition at line 567 of file GfxState.h.

{ return hasBBox; }

Here is the caller graph for this function:

int GfxShading::getType ( ) [inline, inherited]

Definition at line 561 of file GfxState.h.

{ return type; }

Here is the caller graph for this function:

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

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, inherited]

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:

Definition at line 1873 of file GfxState.cc.

                                                    {
  GfxRadialShading *shading;
  double x0A, y0A, r0A, x1A, y1A, r1A;
  double t0A, t1A;
  Function *funcsA[gfxColorMaxComps];
  int nFuncsA;
  GBool extend0A, extend1A;
  Object obj1, obj2;
  int i;

  x0A = y0A = r0A = x1A = y1A = r1A = 0;
  if (dict->lookup("Coords", &obj1)->isArray() &&
      obj1.arrayGetLength() == 6) {
    x0A = obj1.arrayGet(0, &obj2)->getNum();
    obj2.free();
    y0A = obj1.arrayGet(1, &obj2)->getNum();
    obj2.free();
    r0A = obj1.arrayGet(2, &obj2)->getNum();
    obj2.free();
    x1A = obj1.arrayGet(3, &obj2)->getNum();
    obj2.free();
    y1A = obj1.arrayGet(4, &obj2)->getNum();
    obj2.free();
    r1A = obj1.arrayGet(5, &obj2)->getNum();
    obj2.free();
  } else {
    error(-1, "Missing or invalid Coords in shading dictionary");
    goto err1;
  }
  obj1.free();

  t0A = 0;
  t1A = 1;
  if (dict->lookup("Domain", &obj1)->isArray() &&
      obj1.arrayGetLength() == 2) {
    t0A = obj1.arrayGet(0, &obj2)->getNum();
    obj2.free();
    t1A = obj1.arrayGet(1, &obj2)->getNum();
    obj2.free();
  }
  obj1.free();

  dict->lookup("Function", &obj1);
  if (obj1.isArray()) {
    nFuncsA = obj1.arrayGetLength();
    if (nFuncsA > gfxColorMaxComps) {
      error(-1, "Invalid Function array in shading dictionary");
      goto err1;
    }
    for (i = 0; i < nFuncsA; ++i) {
      obj1.arrayGet(i, &obj2);
      if (!(funcsA[i] = Function::parse(&obj2))) {
       obj1.free();
       obj2.free();
       goto err1;
      }
      obj2.free();
    }
  } else {
    nFuncsA = 1;
    if (!(funcsA[0] = Function::parse(&obj1))) {
      obj1.free();
      goto err1;
    }
  }
  obj1.free();

  extend0A = extend1A = gFalse;
  if (dict->lookup("Extend", &obj1)->isArray() &&
      obj1.arrayGetLength() == 2) {
    extend0A = obj1.arrayGet(0, &obj2)->getBool();
    obj2.free();
    extend1A = obj1.arrayGet(1, &obj2)->getBool();
    obj2.free();
  }
  obj1.free();

  shading = new GfxRadialShading(x0A, y0A, r0A, x1A, y1A, r1A, t0A, t1A,
                             funcsA, nFuncsA, extend0A, extend1A);
  if (!shading->init(dict)) {
    delete shading;
    return NULL;
  }
  return shading;

 err1:
  return NULL;
}

Here is the call graph for this function:


Member Data Documentation

GfxColor GfxShading::background [protected, inherited]

Definition at line 575 of file GfxState.h.

GfxColorSpace* GfxShading::colorSpace [protected, inherited]

Definition at line 574 of file GfxState.h.

Definition at line 682 of file GfxState.h.

Definition at line 682 of file GfxState.h.

Definition at line 680 of file GfxState.h.

GBool GfxShading::hasBackground [protected, inherited]

Definition at line 576 of file GfxState.h.

GBool GfxShading::hasBBox [protected, inherited]

Definition at line 578 of file GfxState.h.

Definition at line 681 of file GfxState.h.

double GfxRadialShading::r0 [private]

Definition at line 678 of file GfxState.h.

double GfxRadialShading::r1 [private]

Definition at line 678 of file GfxState.h.

double GfxRadialShading::t0 [private]

Definition at line 679 of file GfxState.h.

double GfxRadialShading::t1 [private]

Definition at line 679 of file GfxState.h.

int GfxShading::type [protected, inherited]

Definition at line 573 of file GfxState.h.

double GfxRadialShading::x0 [private]

Definition at line 678 of file GfxState.h.

double GfxRadialShading::x1 [private]

Definition at line 678 of file GfxState.h.

double GfxShading::xMax [protected, inherited]

Definition at line 577 of file GfxState.h.

double GfxShading::xMin [protected, inherited]

Definition at line 577 of file GfxState.h.

double GfxRadialShading::y0 [private]

Definition at line 678 of file GfxState.h.

double GfxRadialShading::y1 [private]

Definition at line 678 of file GfxState.h.

double GfxShading::yMax [protected, inherited]

Definition at line 577 of file GfxState.h.

double GfxShading::yMin [protected, inherited]

Definition at line 577 of file GfxState.h.


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