pdftron::PDF::Shading Class Reference

Shading is a class that represents a flat interface around all PDF shading types:. More...

#include <Shading.h>

List of all members.

Public Types

enum  Type {
  e_function_shading, e_axial_shading, e_radial_shading, e_free_gouraud_shading,
  e_lattice_gouraud_shading, e_coons_shading, e_tensor_shading, e_null
}

Public Member Functions

 Shading (SDF::Obj shading_dict=0)
 Create a Shading from the given SDF/Cos object listed under /Shading entry in the page Resource dictionary.
 Shading (const Shading &s)
Shadingoperator= (const Shading &s)
 ~Shading ()
Shading::Type GetType () const
SDF::Obj GetSDFObj ()
ColorSpace GetBaseColorSpace ()
bool HasBBox ()
Rect GetBBox ()
bool HasBackground ()
ColorPt GetBackground ()
 An color point represented in base color space specifying a single background color value.
bool GetAntialias ()
double GetParamStart ()
double GetParamEnd ()
bool IsExtendStart ()
bool IsExtendEnd ()
void GetColor (double t, ColorPt &out_color)
void GetCoords (double &out_x0, double &out_y0, double &out_x1, double &out_y1)
void GetCoords (double &out_x0, double &out_y0, double &out_r0, double &out_x1, double &out_y1, double &out_r1)
void GetDomain (double &out_xmin, double &out_xmax, double &out_ymin, double &out_ymax)
Common::Matrix2D GetMatrix ()
void GetColor (double t1, double t2, ColorPt &out_color)

Static Public Member Functions

static Type GetType (SDF::Obj shading_dict)


Detailed Description

Shading is a class that represents a flat interface around all PDF shading types:.

A Coons patch generally has two independent aspects:


Member Enumeration Documentation

Enumerator:
e_function_shading 
e_axial_shading 
e_radial_shading 
e_free_gouraud_shading 
e_lattice_gouraud_shading 
e_coons_shading 
e_tensor_shading 
e_null 


Constructor & Destructor Documentation

pdftron::PDF::Shading::Shading ( SDF::Obj  shading_dict = 0  ) 

Create a Shading from the given SDF/Cos object listed under /Shading entry in the page Resource dictionary.

If shading_dict dictionary is null, a non valid Shading object is created.

pdftron::PDF::Shading::Shading ( const Shading s  ) 

pdftron::PDF::Shading::~Shading (  ) 


Member Function Documentation

Shading& pdftron::PDF::Shading::operator= ( const Shading s  ) 

static Type pdftron::PDF::Shading::GetType ( SDF::Obj  shading_dict  )  [static]

Returns:
The Type of a given SDF/Cos shading dictionary, or e_null for if SDF object is not a valid shading object
Parameters:
cs 

Shading::Type pdftron::PDF::Shading::GetType (  )  const

Returns:
The shading type

SDF::Obj pdftron::PDF::Shading::GetSDFObj (  ) 

Returns:
the underlying SDF/Cos object

ColorSpace pdftron::PDF::Shading::GetBaseColorSpace (  ) 

Returns:
The color space in which color values are expressed. This may be any device, CIE-based, or special color space except a Pattern space.

bool pdftron::PDF::Shading::HasBBox (  ) 

Returns:
true if shading has a bounding box, false otherwise.

Rect pdftron::PDF::Shading::GetBBox (  ) 

Returns:
a rectangle giving the left, bottom, right, and top coordinates, respectively, of the shading’s bounding box. The coordinates are interpreted in the shading’s target coordinate space. If present, this bounding box is applied as a temporary clipping boundary when the shading is painted, in addition to the current clipping path and any other clipping boundaries in effect at that time.
Note:
Use HasBBox() method to determine whether the shading has a background color.

bool pdftron::PDF::Shading::HasBackground (  ) 

Returns:
true if the shading has a background color or false otherwise.

ColorPt pdftron::PDF::Shading::GetBackground (  ) 

An color point represented in base color space specifying a single background color value.

If present, this color is used before any painting operation involving the shading, to fill those portions of the area to be painted that lie outside the bounds of the shading object itself. In the opaque imaging model, the effect is as if the painting operation were performed twice: first with the background color and then again with the shading.

Note:
The background color is applied only when the shading is used as part of a shading pattern, not when it is painted directly with the sh operator.

Use HasBackground() method to determine whether the shading has a background color.

bool pdftron::PDF::Shading::GetAntialias (  ) 

Returns:
A flag indicating whether to filter the shading function to prevent aliasing artifacts. See Table 4.25

double pdftron::PDF::Shading::GetParamStart (  ) 

Returns:
a number specifying the limiting value of a parametric variable t. The variable is considered to vary linearly between GetParamStart() and GetParamEnd() as the color gradient varies between the starting and ending points of the axis for Axial shading or circles for Radial shading. The variable t becomes the input argument to the color function(s).
Note:
the returned value corresponds to the first value in Domain array.

for shadings other than Axial or Radial this method throws an exception.

double pdftron::PDF::Shading::GetParamEnd (  ) 

Returns:
a number specifying the limiting value of a parametric variable t. The variable is considered to vary linearly between GetParamStart() and GetParamEnd() as the color gradient varies between the starting and ending points of the axis for Axial shading or circles for Radial shading. The variable t becomes the input argument to the color function(s).
Note:
the returned value corresponds to the second value in Domain array.

for shadings other than Axial or Radial this method throws an exception.

bool pdftron::PDF::Shading::IsExtendStart (  ) 

Returns:
a flag specifying whether to extend the shading beyond the starting point of the axis for Axial shading or starting circle for Radial shading.
Note:
for shadings other than Axial or Radial this method throws an exception.

bool pdftron::PDF::Shading::IsExtendEnd (  ) 

Returns:
a flag specifying whether to extend the shading beyond the ending point of the axis for Axial shading or ending circle for Radial shading.
Note:
for shadings other than Axial or Radial this method throws an exception.

void pdftron::PDF::Shading::GetColor ( double  t,
ColorPt out_color 
)

Returns:
a color point for the given value of parametric variable t.
Note:
for shadings other than Axial or Radial this method throws an exception.

void pdftron::PDF::Shading::GetCoords ( double &  out_x0,
double &  out_y0,
double &  out_x1,
double &  out_y1 
)

Returns:
for Axial shading returns four numbers (out_x0, out_y0, out_x1, out_y1) specifying the starting and ending coordinates of the axis, expressed in the shading’s target coordinate space.
Note:
for shadings other than Axial this method throws an exception.

void pdftron::PDF::Shading::GetCoords ( double &  out_x0,
double &  out_y0,
double &  out_r0,
double &  out_x1,
double &  out_y1,
double &  out_r1 
)

Returns:
for Radial shading returns six numbers (x0 y0 r0 x1 y1 r1) specifying the centers and radii of the starting and ending circles, expressed in the shading’s target coordinate space. The radii r0 and r1 must both be greater than or equal to 0. If one radius is 0, the corresponding circle is treated as a point; if both are 0, nothing is painted.
Note:
for shadings other than Radial this method throws an exception.

void pdftron::PDF::Shading::GetDomain ( double &  out_xmin,
double &  out_xmax,
double &  out_ymin,
double &  out_ymax 
)

Returns:
An array of four numbers [xmin xmax ymin ymax] specifying the rectangular domain of coordinates over which the color function(s) are defined. If the function does not contain /Domain entry the function returns: [0 1 0 1].
Note:
for shadings other than Function this method throws an exception.

Common::Matrix2D pdftron::PDF::Shading::GetMatrix (  ) 

Returns:
a matrix specifying a mapping from the coordinate space specified by the Domain entry into the shading’s target coordinate space.
Note:
for shadings other than Function this method throws an exception.

void pdftron::PDF::Shading::GetColor ( double  t1,
double  t2,
ColorPt out_color 
)

Returns:
a color point for the given value of parametric variable (t1, t2).
Note:
for shadings other than Function this method throws an exception.


© 2002-2010 PDFTron Systems Inc.