java.lang.Object | |
↳ | com.pdftron.pdf.Shading |
Shading is a class that represents a flat interface around all PDF shading
types:
- In Function-based (type 1) shadings, the color at every point in the domain
is defined by a specified mathematical function. The function need not be
smooth or continuous. This is the most general of the available shading
types, and is useful for shadings that cannot be adequately described with
any of the other types.
- Axial shadings (type 2) define a color blend along a line between two
points, optionally extended beyond the boundary points by continuing the
boundary colors.
- Radial shadings (type 3) define a color blend that varies between two
circles. Shadings of this type are commonly used to depict three-dimensional
spheres and cones.
- Free-form Gouraud-shaded triangle mesh shadings (type 4) and lattice
gouraud shadings (type 5) are commonly used to represent complex colored and
shaded three-dimensional shapes. The area to be shaded is defined by a path
composed entirely of triangles. The color at each vertex of the triangles is
specified, and a technique known as Gouraud interpolation is used to color
the interiors. The interpolation functions defining the shading may be linear
or nonlinear.
- Coons patch mesh shadings (type 6) are constructed from one or more color
patches, each bounded by four cubic Bezier curves.
A Coons patch generally has two independent aspects: - Colors are specified
for each corner of the unit square, and bilinear interpolation is used to
fill in colors over the entire unit square
- Coordinates are mapped from the unit square into a four-sided patch whose
sides are not necessarily linear. The mapping is continuous: the corners of
the unit square map to corners of the patch and the sides of the unit square
map to sides of the patch.
- Tensor-product patch mesh shadings (type 7) are identical to type 6 (Coons
mesh), except that they are based on a bicubic tensor-product patch defined
by 16 control points, instead of the 12 control points that define a Coons
patch. The shading Patterns dictionaries representing the two patch types
differ only in the value of the Type entry and in the number of control
points specified for each patch in the data stream. Although the Coons patch
is more concise and easier to use, the tensor- product patch affords greater
control over color mapping.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | e_axial_shading | The Constant e_axial_shading. | |||||||||
int | e_coons_shading | The Constant e_coons_shading. | |||||||||
int | e_free_gouraud_shading | The Constant e_free_gouraud_shading. | |||||||||
int | e_function_shading | The Constant e_function_shading. | |||||||||
int | e_lattice_gouraud_shading | The Constant e_lattice_gouraud_shading. | |||||||||
int | e_null | The Constant e_null. | |||||||||
int | e_radial_shading | The Constant e_radial_shading. | |||||||||
int | e_tensor_shading | The Constant e_tensor_shading. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Shading(Obj shading_dict)
Create a Shading from the given SDF/Cos object listed under /Shading
entry in the page Resource dictionary.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
boolean |
getAntialias()
check if shading is anti-alias.
| ||||||||||
Rect |
getBBox()
Get the bounding box
Note: Use HasBBox() method to determine whether the shading has a background color. | ||||||||||
ColorPt |
getBackground()
An color point represented in base color space specifying a single
background color value.
| ||||||||||
ColorSpace |
getBaseColorSpace()
Get the base color space.
| ||||||||||
ColorPt |
getColor(double t1, double t2)
Get the color for the given value of the parametric variables
Note: for shadings other than Function this method throws an exception. | ||||||||||
ColorPt |
getColor(double t)
Get the color point from parametric varible t
Note: for shadings other than Axial or Radial this method throws an exception. | ||||||||||
double[] |
getCoords()
Get the starting and ending coordinates of the axis, expressed in the
shading's target coordinate space.
| ||||||||||
double[] |
getCoordsRadial()
Get the coords radial.
| ||||||||||
double[] |
getDomain()
Get the domain.
| ||||||||||
Matrix2D |
getMatrix()
Get the transformation matrix.
| ||||||||||
double |
getParamEnd()
Get the number specifying the limiting value of a parametric variable t.
| ||||||||||
double |
getParamStart()
Get the number specifying the limiting value of a parametric variable t.
| ||||||||||
Obj |
getSDFObj()
Get the SDFObj.
| ||||||||||
int |
getType()
Get this shading object's type
| ||||||||||
static int |
getType(Obj shading_dict)
Get the shading type from specifed shading object
| ||||||||||
boolean |
hasBBox()
Checks for bounding box
| ||||||||||
boolean |
hasBackground()
Checks for background.
| ||||||||||
boolean |
isExtendEnd()
Checks whether to extend the shading beyond the ending point of the axis
for Axial shading or ending circle for Radial shading.
| ||||||||||
boolean |
isExtendStart()
Checks whether to extend the shading beyond the starting point of the
axis for Axial shading or starting circle for Radial shading.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
The Constant e_axial_shading.
The Constant e_coons_shading.
The Constant e_free_gouraud_shading.
The Constant e_function_shading.
The Constant e_lattice_gouraud_shading.
The Constant e_null.
The Constant e_radial_shading.
The Constant e_tensor_shading.
Create a Shading from the given SDF/Cos object listed under /Shading entry in the page Resource dictionary.
shading_dict | the shading dictionary object |
---|
check if shading is anti-alias.
PDFNetException |
---|
Get the bounding box
Note: Use HasBBox() method to determine whether the shading has a background color.
PDFNetException |
---|
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.
PDFNetException |
---|
Get the base color space.
PDFNetException |
---|
Get the color for the given value of the parametric variables
Note: for shadings other than Function this method throws an exception.
t1 | a parametric varible |
---|---|
t2 | a parametric varible |
PDFNetException |
---|
Get the color point from parametric varible t
Note: for shadings other than Axial or Radial this method throws an exception.
t | parametric variable t |
---|
PDFNetException |
---|
Get 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.
PDFNetException |
---|
Get the coords radial.
Note: for shadings other than Radial this method throws an exception.
PDFNetException |
---|
Get the domain.
Note: for shadings other than Function this method throws an exception.
PDFNetException |
---|
Get the transformation matrix.
Note: for shadings other than Function this method throws an exception.
PDFNetException |
---|
Get the number specifying the limiting value of a parametric variable t.
Note: the returned value corresponds to the second value in Domain array.
for shadings other than Axial or Radial this method throws an exception.
PDFNetException |
---|
Get the number specifying the limiting value of a parametric variable t.
Note: the returned value corresponds to the first value in Domain array.
for shadings other than Axial or Radial this method throws an exception.
PDFNetException |
---|
Get the shading type from specifed shading object
shading_dict | input shading dictionary object |
---|
PDFNetException |
---|
Checks for bounding box
PDFNetException |
---|
Checks for background.
PDFNetException |
---|
Checks 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.
PDFNetException |
---|
Checks 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.
PDFNetException |
---|