Merge pull request #4192 from yurydelendik/shading-r
Implements shading types 4-7
This commit is contained in:
commit
1e4d35c3a0
@ -15,13 +15,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals ColorSpace, PDFFunction, Util, error, warn, info, isArray, isStream,
|
||||
isPDFFunction, UnsupportedManager, UNSUPPORTED_FEATURES */
|
||||
assert, isPDFFunction, UnsupportedManager, UNSUPPORTED_FEATURES */
|
||||
|
||||
'use strict';
|
||||
|
||||
var PatternType = {
|
||||
FUNCTION_BASED: 1,
|
||||
AXIAL: 2,
|
||||
RADIAL: 3
|
||||
RADIAL: 3,
|
||||
FREE_FORM_MESH: 4,
|
||||
LATTICE_FORM_MESH: 5,
|
||||
COONS_PATCH_MESH: 6,
|
||||
TENSOR_PATCH_MESH: 7
|
||||
};
|
||||
|
||||
var Pattern = (function PatternClosure() {
|
||||
@ -49,6 +54,11 @@ var Pattern = (function PatternClosure() {
|
||||
case PatternType.RADIAL:
|
||||
// Both radial and axial shadings are handled by RadialAxial shading.
|
||||
return new Shadings.RadialAxial(dict, matrix, xref, res);
|
||||
case PatternType.FREE_FORM_MESH:
|
||||
case PatternType.LATTICE_FORM_MESH:
|
||||
case PatternType.COONS_PATCH_MESH:
|
||||
case PatternType.TENSOR_PATCH_MESH:
|
||||
return new Shadings.Mesh(shading, matrix, xref, res);
|
||||
default:
|
||||
UnsupportedManager.notify(UNSUPPORTED_FEATURES.shadingPattern);
|
||||
return new Shadings.Dummy();
|
||||
@ -213,6 +223,575 @@ Shadings.RadialAxial = (function RadialAxialClosure() {
|
||||
return RadialAxial;
|
||||
})();
|
||||
|
||||
// All mesh shading. For now, they will be presented as set of the triangles
|
||||
// to be drawn on the canvas and rgb color for each vertex.
|
||||
Shadings.Mesh = (function MeshClosure() {
|
||||
function MeshStreamReader(stream, context) {
|
||||
this.stream = stream;
|
||||
this.context = context;
|
||||
this.buffer = 0;
|
||||
this.bufferLength = 0;
|
||||
}
|
||||
MeshStreamReader.prototype = {
|
||||
get hasData() {
|
||||
if (this.stream.end) {
|
||||
return this.stream.pos < this.stream.end;
|
||||
}
|
||||