configurable: true,
writable: false });
} catch (e) {
- obj.__defineGetter__(prop, function() {
+ obj.__defineGetter__(prop, function shadowDefineGetter() {
return value;
});
}
return str2;
}
-var Stream = (function() {
+var Stream = (function streamStream() {
function constructor(arrayBuffer, start, length, dict) {
this.bytes = new Uint8Array(arrayBuffer);
this.start = start || 0;
return constructor;
})();
-var StringStream = (function() {
+var StringStream = (function stringStream() {
function constructor(str) {
var length = str.length;
var bytes = new Uint8Array(length);
})();
// super class for the decoding streams
-var DecodeStream = (function() {
+var DecodeStream = (function decodeStream() {
function constructor() {
this.pos = 0;
this.bufferLength = 0;
return constructor;
})();
-var FakeStream = (function() {
+var FakeStream = (function fakeStream() {
function constructor(stream) {
this.dict = stream.dict;
DecodeStream.call(this);
}
constructor.prototype = Object.create(DecodeStream.prototype);
- constructor.prototype.readBlock = function() {
+ constructor.prototype.readBlock = function fakeStreamReadBlock() {
var bufferLength = this.bufferLength;
bufferLength += 1024;
var buffer = this.ensureBuffer(bufferLength);
this.bufferLength = bufferLength;
};
- constructor.prototype.getBytes = function(length) {
+ constructor.prototype.getBytes = function fakeStreamGetBytes(length) {
var end, pos = this.pos;
if (length) {
return constructor;
})();
-var StreamsSequenceStream = (function() {
+var StreamsSequenceStream = (function streamSequenceStream() {
function constructor(streams) {
this.streams = streams;
DecodeStream.call(this);
constructor.prototype = Object.create(DecodeStream.prototype);
- constructor.prototype.readBlock = function() {
+ constructor.prototype.readBlock = function streamSequenceStreamReadBlock() {
var streams = this.streams;
if (streams.length == 0) {
this.eof = true;
return constructor;
})();
-var FlateStream = (function() {
+var FlateStream = (function flateStream() {
var codeLenCodeMap = new Uint32Array([
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
]);
constructor.prototype = Object.create(DecodeStream.prototype);
- constructor.prototype.getBits = function(bits) {
+ constructor.prototype.getBits = function flateStreamGetBits(bits) {
var codeSize = this.codeSize;
var codeBuf = this.codeBuf;
var bytes = this.bytes;
return b;
};
- constructor.prototype.getCode = function(table) {
+ constructor.prototype.getCode = function flateStreamGetCode(table) {
var codes = table[0];
var maxLen = table[1];
var codeSize = this.codeSize;
return codeVal;
};
- constructor.prototype.generateHuffmanTable = function(lengths) {
+ constructor.prototype.generateHuffmanTable =
+ function flateStreamGenerateHuffmanTable(lengths) {
var n = lengths.length;
// find max code length
return [codes, maxLen];
};
- constructor.prototype.readBlock = function() {
+ constructor.prototype.readBlock = function flateStreamReadBlock() {
// read block header
var hdr = this.getBits(3);
if (hdr & 1)
return constructor;
})();
-var PredictorStream = (function() {
+var PredictorStream = (function predictorStream() {
function constructor(stream, params) {
var predictor = this.predictor = params.get('Predictor') || 1;
constructor.prototype = Object.create(DecodeStream.prototype);
- constructor.prototype.readBlockTiff = function() {
+ constructor.prototype.readBlockTiff =
+ function predictorStreamReadBlockTiff() {
var rowBytes = this.rowBytes;
var bufferLength = this.bufferLength;
this.bufferLength += rowBytes;
};
- constructor.prototype.readBlockPng = function() {
+ constructor.prototype.readBlockPng = function predictorStreamReadBlockPng() {
var rowBytes = this.rowBytes;
var pixBytes = this.pixBytes;
// A JpegStream can't be read directly. We use the platform to render
// the underlying JPEG data for us.
-var JpegStream = (function() {
+var JpegStream = (function jpegStream() {
function isYcckImage(bytes) {
var maxBytesScanned = Math.max(bytes.length - 16, 1024);
// Looking for APP14, 'Adobe' and transform = 2
// create DOM image
var img = new Image();
- img.onload = (function() {
+ img.onload = (function jpegStreamOnload() {
this.loaded = true;
if (this.onLoad)
this.onLoad();
}
constructor.prototype = {
- getImage: function() {
+ getImage: function jpegStreamGetImage() {
return this.domImage;
},
- getChar: function() {
+ getChar: function jpegStreamGetChar() {
error('internal error: getChar is not valid on JpegStream');
}
};
// Initialy for every that is in loading call imageLoading()
// and, when images onload is fired, call imageLoaded()
// When all images are loaded, the onLoad event is fired.
-var ImagesLoader = (function() {
+var ImagesLoader = (function imagesLoader() {
function constructor() {
this.loading = 0;
}
constructor.prototype = {
- imageLoading: function() {
+ imageLoading: function imagesLoaderImageLoading() {
++this.loading;
},
- imageLoaded: function() {
+ imageLoaded: function imagesLoaderImageLoaded() {
if (--this.loading == 0 && this.onLoad) {
this.onLoad();
delete this.onLoad;
}
},
- bind: function(jpegStream) {
+ bind: function imagesLoaderBind(jpegStream) {
if (jpegStream.loaded)
return;
this.imageLoading();
jpegStream.onLoad = this.imageLoaded.bind(this);
},
- notifyOnLoad: function(callback) {
+ notifyOnLoad: function imagesLoaderNotifyOnLoad(callback) {
if (this.loading == 0)
callback();
this.onLoad = callback;
return constructor;
})();
-var DecryptStream = (function() {
+var DecryptStream = (function decryptStream() {
function constructor(str, decrypt) {
this.str = str;
this.dict = str.dict;
constructor.prototype = Object.create(DecodeStream.prototype);
- constructor.prototype.readBlock = function() {
+ constructor.prototype.readBlock = function decryptStreamReadBlock() {
var chunk = this.str.getBytes(chunkSize);
if (!chunk || chunk.length == 0) {
this.eof = true;
return constructor;
})();
-var Ascii85Stream = (function() {
+var Ascii85Stream = (function ascii85Stream() {
function constructor(str) {
this.str = str;
this.dict = str.dict;
constructor.prototype = Object.create(DecodeStream.prototype);
- constructor.prototype.readBlock = function() {
+ constructor.prototype.readBlock = function ascii85StreamReadBlock() {
var tildaCode = '~'.charCodeAt(0);
var zCode = 'z'.charCodeAt(0);
var str = this.str;
return constructor;
})();
-var AsciiHexStream = (function() {
+var AsciiHexStream = (function asciiHexStream() {
function constructor(str) {
this.str = str;
this.dict = str.dict;
constructor.prototype = Object.create(DecodeStream.prototype);
- constructor.prototype.readBlock = function() {
+ constructor.prototype.readBlock = function asciiHexStreamReadBlock() {
var gtCode = '>'.charCodeAt(0), bytes = this.str.getBytes(), c, n,
decodeLength, buffer, bufferLength, i, length;
return constructor;
})();
-var CCITTFaxStream = (function() {
+var CCITTFaxStream = (function cCITTFaxStream() {
var ccittEOL = -2;
var twoDimPass = 0;
constructor.prototype = Object.create(DecodeStream.prototype);
- constructor.prototype.readBlock = function() {
+ constructor.prototype.readBlock = function cCITTFaxStreamReadBlock() {
while (!this.eof) {
var c = this.lookChar();
this.buf = EOF;
}
};
- constructor.prototype.addPixels = function(a1, blackPixels) {
+ constructor.prototype.addPixels =
+ function cCITTFaxStreamAddPixels(a1, blackPixels) {
var codingLine = this.codingLine;
var codingPos = this.codingPos;
this.codingPos = codingPos;
};
- constructor.prototype.addPixelsNeg = function(a1, blackPixels) {
+ constructor.prototype.addPixelsNeg =
+ function cCITTFaxStreamAddPixelsNeg(a1, blackPixels) {
var codingLine = this.codingLine;
var codingPos = this.codingPos;
this.codingPos = codingPos;
};
- constructor.prototype.lookChar = function() {
+ constructor.prototype.lookChar = function cCITTFaxStreamLookChar() {
if (this.buf != EOF)
return this.buf;
return this.buf;
};
- constructor.prototype.getTwoDimCode = function() {
+ constructor.prototype.getTwoDimCode = function cCITTFaxStreamGetTwoDimCode() {
var code = 0;
var p;
if (this.eoblock) {
return EOF;
};
- constructor.prototype.getWhiteCode = function() {
+ constructor.prototype.getWhiteCode = function cCITTFaxStreamGetWhiteCode() {
var code = 0;
var p;
var n;
return 1;
};
- constructor.prototype.getBlackCode = function() {
+ constructor.prototype.getBlackCode = function cCITTFaxStreamGetBlackCode() {
var code, p;
if (this.eoblock) {
code = this.lookBits(13);
return 1;
};
- constructor.prototype.lookBits = function(n) {
+ constructor.prototype.lookBits = function cCITTFaxStreamLookBits(n) {
var c;
while (this.inputBits < n) {
if ((c = this.str.getByte()) == null) {
return (this.inputBuf >> (this.inputBits - n)) & (0xFFFF >> (16 - n));
};
- constructor.prototype.eatBits = function(n) {
+ constructor.prototype.eatBits = function cCITTFaxStreamEatBits(n) {
if ((this.inputBits -= n) < 0)
this.inputBits = 0;
};
return constructor;
})();
-var LZWStream = (function() {
+var LZWStream = (function lZWStream() {
function constructor(str, earlyChange) {
this.str = str;
this.dict = str.dict;
constructor.prototype = Object.create(DecodeStream.prototype);
- constructor.prototype.readBits = function(n) {
+ constructor.prototype.readBits = function lZWStreamReadBits(n) {
var bitsCached = this.bitsCached;
var cachedData = this.cachedData;
while (bitsCached < n) {
return (cachedData >>> bitsCached) & ((1 << n) - 1);
};
- constructor.prototype.readBlock = function() {
+ constructor.prototype.readBlock = function lZWStreamReadBlock() {
var blockSize = 512;
var estimatedDecodedSize = blockSize * 2, decodedSizeDelta = blockSize;
var i, j, q;
})();
-var Name = (function() {
+var Name = (function nameName() {
function constructor(name) {
this.name = name;
}
return constructor;
})();
-var Cmd = (function() {
+var Cmd = (function cmdCmd() {
function constructor(cmd) {
this.cmd = cmd;
}
return constructor;
})();
-var Dict = (function() {
+var Dict = (function dictDict() {
function constructor() {
this.map = Object.create(null);
}
constructor.prototype = {
- get: function(key1, key2, key3) {
+ get: function dictGet(key1, key2, key3) {
var value;
if (typeof (value = this.map[key1]) != 'undefined' || key1 in this.map ||
typeof key2 == 'undefined') {
return this.map[key3] || null;
},
- set: function(key, value) {
+ set: function dictSet(key, value) {
this.map[key] = value;
},
- has: function(key) {
+ has: function dictHas(key) {
return key in this.map;
},
- forEach: function(callback) {
+ forEach: function dictForEach(callback) {
for (var key in this.map) {
callback(key, this.map[key]);
}
return constructor;
})();
-var Ref = (function() {
+var Ref = (function refRef() {
function constructor(num, gen) {
this.num = num;
this.gen = gen;
// The reference is identified by number and generation,
// this structure stores only one instance of the reference.
-var RefSet = (function() {
+var RefSet = (function refSet() {
function constructor() {
this.dict = {};
}
constructor.prototype = {
- has: function(ref) {
+ has: function refSetHas(ref) {
return !!this.dict['R' + ref.num + '.' + ref.gen];
},
- put: function(ref) {
+ put: function refSetPut(ref) {
this.dict['R' + ref.num + '.' + ref.gen] = ref;
}
};
return v == None;
}
-var Lexer = (function() {
+var Lexer = (function lexer() {
function constructor(stream) {
this.stream = stream;
}
- constructor.isSpace = function(ch) {
+ constructor.isSpace = function lexerIsSpace(ch) {
return ch == ' ' || ch == '\t' || ch == '\x0d' || ch == '\x0a';
};
}
constructor.prototype = {
- getNumber: function(ch) {
+ getNumber: function lexerGetNumber(ch) {
var floating = false;
var str = ch;
var stream = this.stream;
error('Invalid floating point number: ' + value);
return value;
},
- getString: function() {
+ getString: function lexerGetString() {
var numParen = 1;
var done = false;
var str = '';
} while (!done);
return str;
},
- getName: function(ch) {
+ getName: function lexerGetName(ch) {
var str = '';
var stream = this.stream;
while (!!(ch = stream.lookChar()) && !specialChars[ch.charCodeAt(0)]) {
str.length);
return new Name(str);
},
- getHexString: function(ch) {
+ getHexString: function lexerGetHexString(ch) {
var str = '';
var stream = this.stream;
for (;;) {
}
return str;
},
- getObj: function() {
+ getObj: function lexerGetObj() {
// skip whitespace and comments
var comment = false;
var stream = this.stream;
return null;
return new Cmd(str);
},
- skipToNextLine: function() {
+ skipToNextLine: function lexerSkipToNextLine() {
var stream = this.stream;
while (true) {
var ch = stream.getChar();
}
}
},
- skip: function() {
+ skip: function lexerSkip() {
this.stream.skip();
}
};
return constructor;
})();
-var Parser = (function() {
+var Parser = (function parserParser() {
function constructor(lexer, allowStreams, xref) {
this.lexer = lexer;
this.allowStreams = allowStreams;
}
constructor.prototype = {
- refill: function() {
+ refill: function parserRefill() {
this.buf1 = this.lexer.getObj();
this.buf2 = this.lexer.getObj();
},
- shift: function() {
+ shift: function parserShift() {
if (IsCmd(this.buf2, 'ID')) {
this.buf1 = this.buf2;
this.buf2 = null;
this.buf2 = this.lexer.getObj();
}
},
- getObj: function(cipherTransform) {
+ getObj: function parserGetObj(cipherTransform) {
if (IsCmd(this.buf1, 'BI')) { // inline image
this.shift();
return this.makeInlineImage(cipherTransform);
this.shift();
return obj;
},
- makeInlineImage: function(cipherTransform) {
+ makeInlineImage: function parserMakeInlineImage(cipherTransform) {
var lexer = this.lexer;
var stream = lexer.stream;
return imageStream;
},
- makeStream: function(dict, cipherTransform) {
+ makeStream: function parserMakeStream(dict, cipherTransform) {
var lexer = this.lexer;
var stream = lexer.stream;
stream.parameters = dict;
return stream;
},
- filter: function(stream, dict, length) {
+ filter: function parserFilter(stream, dict, length) {
var filter = dict.get('Filter', 'F');
var params = dict.get('DecodeParms', 'DP');
if (IsName(filter))
}
return stream;
},
- makeFilter: function(stream, name, length, params) {
+ makeFilter: function parserMakeFilter(stream, name, length, params) {
if (name == 'FlateDecode' || name == 'Fl') {
if (params) {
return new PredictorStream(new FlateStream(stream), params);
return constructor;
})();
-var Linearization = (function() {
+var Linearization = (function linearizationLinearization() {
function constructor(stream) {
this.parser = new Parser(new Lexer(stream), false);
var obj1 = this.parser.getObj();
}
constructor.prototype = {
- getInt: function(name) {
+ getInt: function linearizationGetInt(name) {
var linDict = this.linDict;
var obj;
if (IsDict(linDict) &&
error('"' + name + '" field in linearization table is invalid');
return 0;
},
- getHint: function(index) {
+ getHint: function linearizationGetHint(index) {
var linDict = this.linDict;
var obj1, obj2;
if (IsDict(linDict) &&
return constructor;
})();
-var XRef = (function() {
+var XRef = (function xRefXRef() {
function constructor(stream, startXRef, mainXRefEntriesOffset) {
this.stream = stream;
this.entries = [];
error('Invalid XRef');
return null;
},
- getEntry: function(i) {
+ getEntry: function xRefGetEntry(i) {
var e = this.entries[i];
if (e.free)
error('reading an XRef stream not implemented yet');
return e;
},
- fetchIfRef: function(obj) {
+ fetchIfRef: function xRefFetchIfRef(obj) {
if (!IsRef(obj))
return obj;
return this.fetch(obj);
},
- fetch: function(ref, suppressEncryption) {
+ fetch: function xRefFetch(ref, suppressEncryption) {
var num = ref.num;
var e = this.cache[num];
if (e)
}
return e;
},
- getCatalogObj: function() {
+ getCatalogObj: function xRefGetCatalogObj() {
return this.fetch(this.root);
}
};
return constructor;
})();
-var Page = (function() {
+var Page = (function pagePage() {
function constructor(xref, pageNumber, pageDict, ref) {
this.pageNumber = pageNumber;
this.pageDict = pageDict;
}
constructor.prototype = {
- getPageProp: function(key) {
+ getPageProp: function pageGetPageProp(key) {
return this.xref.fetchIfRef(this.pageDict.get(key));
},
- inheritPageProp: function(key) {
+ inheritPageProp: function pageInheritPageProp(key) {
var dict = this.pageDict;
var obj = dict.get(key);
while (obj === undefined) {
}
return shadow(this, 'rotate', rotate);
},
- startRendering: function(canvasCtx, continuation) {
+ startRendering: function pageStartRendering(canvasCtx, continuation) {
var self = this;
var stats = self.stats;
stats.compile = stats.fonts = stats.render = 0;
this.compile(gfx, fonts, images);
stats.compile = Date.now();
- var displayContinuation = function() {
+ var displayContinuation = function pageDisplayContinuation() {
// Always defer call to display() to work around bug in
// Firefox error reporting from XHR callbacks.
- setTimeout(function() {
+ setTimeout(function pageSetTimeout() {
var exc = null;
try {
self.display(gfx);
var fontObjs = FontLoader.bind(
fonts,
- function() {
+ function pageFontObjs() {
stats.fonts = Date.now();
- images.notifyOnLoad(function() {
+ images.notifyOnLoad(function pageNotifyOnLoad() {
stats.images = Date.now();
displayContinuation();
});
},
- compile: function(gfx, fonts, images) {
+ compile: function pageCompile(gfx, fonts, images) {
if (this.code) {
// content was compiled
return;
}
this.code = gfx.compile(content, xref, resources, fonts, images);
},
- display: function(gfx) {
+ display: function pageDisplay(gfx) {
assert(this.code instanceof Function,
'page content must be compiled first');
var xref = this.xref;
gfx.execute(this.code, xref, resources);
gfx.endDrawing();
},
- rotatePoint: function(x, y) {
+ rotatePoint: function pageRotatePoint(x, y) {
var rotate = this.rotate;
switch (rotate) {
case 180:
return {x: x, y: this.height - y};
}
},
- getLinks: function() {
+ getLinks: function pageGetLinks() {
var xref = this.xref;
var annotations = xref.fetchIfRef(this.annotations) || [];
var i, n = annotations.length;
return constructor;
})();
-var Catalog = (function() {
+var Catalog = (function catalogCatalog() {
function constructor(xref) {
this.xref = xref;
var obj = xref.getCatalogObj();
// shadow the prototype getter
return shadow(this, 'num', obj);
},
- traverseKids: function(pagesDict) {
+ traverseKids: function catalogTraverseKids(pagesDict) {
var pageCache = this.pageCache;
var kids = pagesDict.get('Kids');
assertWellFormed(IsArray(kids),
if (nameDictionaryRef) {
// reading simple destination dictionary
obj = xref.fetchIfRef(nameDictionaryRef);
- obj.forEach(function(key, value) {
+ obj.forEach(function catalogForEach(key, value) {
if (!value) return;
dests[key] = fetchDestination(xref, value);
});
}
return shadow(this, 'destinations', dests);
},
- getPage: function(n) {
+ getPage: function catalogGetPage(n) {
var pageCache = this.pageCache;
if (!pageCache) {
pageCache = this.pageCache = [];
return constructor;
})();
-var PDFDoc = (function() {
+var PDFDoc = (function pDFDoc() {
function constructor(stream) {
assertWellFormed(stream.length > 0, 'stream must have data');
this.stream = stream;
},
// Find the header, remove leading garbage and setup the stream
// starting from the header.
- checkHeader: function() {
+ checkHeader: function pDFDocCheckHeader() {
var stream = this.stream;
stream.reset();
if (find(stream, '%PDF-', 1024)) {
}
// May not be a PDF file, continue anyway.
},
- setup: function(ownerPassword, userPassword) {
+ setup: function pDFDocSetup(ownerPassword, userPassword) {
this.checkHeader();
this.xref = new XRef(this.stream,
this.startXRef,
// shadow the prototype getter
return shadow(this, 'numPages', num);
},
- getPage: function(n) {
+ getPage: function pDFDocGetPage(n) {
return this.catalog.getPage(n);
}
};
var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
-var EvalState = (function() {
+var EvalState = (function evalState() {
function constructor() {
// Are soft masks and alpha values shapes or opacities?
this.alphaIsShape = false;
return constructor;
})();
-var PartialEvaluator = (function() {
+var PartialEvaluator = (function partialEvaluator() {
function constructor() {
this.state = new EvalState();
this.stateStack = [];
};
constructor.prototype = {
- evaluate: function(stream, xref, resources, fonts, images) {
+ evaluate: function partialEvaluatorEvaluate(stream, xref, resources, fonts,
+ images) {
resources = xref.fetchIfRef(resources) || new Dict();
var xobjs = xref.fetchIfRef(resources.get('XObject')) || new Dict();
var patterns = xref.fetchIfRef(resources.get('Pattern')) || new Dict();
}
}
- return function(gfx) {
+ return function partialEvaluatorReturn(gfx) {
for (var i = 0, length = argsArray.length; i < length; i++)
gfx[fnArray[i]].apply(gfx, argsArray[i]);
};
},
- extractEncoding: function(dict, xref, properties) {
+ extractEncoding: function partialEvaluatorExtractEncoding(dict,
+ xref,
+ properties) {
var type = properties.type, encoding;
if (properties.composite) {
if (type == 'CIDFontType2') {
return glyphs;
},
- translateFont: function(dict, xref, resources) {
+ translateFont: function partialEvaluatorTranslateFont(dict, xref,
+ resources) {
var baseDict = dict;
var type = dict.get('Subtype');
assertWellFormed(IsName(type), 'invalid font Subtype');
flags: descriptor.get('Flags'),
italicAngle: descriptor.get('ItalicAngle'),
differences: [],
- widths: (function() {
+ widths: (function partialEvaluatorWidths() {
var glyphWidths = {};
for (var i = 0; i < widths.length; i++)
glyphWidths[firstChar++] = widths[i];
// <canvas> contexts store most of the state we need natively.
// However, PDF needs a bit more state, which we store here.
-var CanvasExtraState = (function() {
+var CanvasExtraState = (function canvasExtraState() {
function constructor(old) {
// Are soft masks and alpha values shapes or opacities?
this.alphaIsShape = false;
return canvas;
}
-var CanvasGraphics = (function() {
+var CanvasGraphics = (function canvasGraphics() {
function constructor(canvasCtx, imageCanvas) {
this.ctx = canvasCtx;
this.current = new CanvasExtraState();
var EO_CLIP = {};
constructor.prototype = {
- beginDrawing: function(mediaBox) {
+ beginDrawing: function canvasGraphicsBeginDrawing(mediaBox) {
var cw = this.ctx.canvas.width, ch = this.ctx.canvas.height;
this.ctx.save();
switch (mediaBox.rotate) {
this.ctx.scale(cw / mediaBox.width, ch / mediaBox.height);
},
- compile: function(stream, xref, resources, fonts, images) {
+ compile: function canvasGraphicsCompile(stream, xref, resources, fonts,
+ images) {
var pe = new PartialEvaluator();
return pe.evaluate(stream, xref, resources, fonts, images);
},
- execute: function(code, xref, resources) {
+ execute: function canvasGraphicsExecute(code, xref, resources) {
resources = xref.fetchIfRef(resources) || new Dict();
var savedXref = this.xref, savedRes = this.res, savedXobjs = this.xobjs;
this.xref = xref;
this.xref = savedXref;
},
- endDrawing: function() {
+ endDrawing: function canvasGraphicsEndDrawing() {
this.ctx.restore();
},
// Graphics state
- setLineWidth: function(width) {
+ setLineWidth: function canvasGraphicsSetLineWidth(width) {
this.ctx.lineWidth = width;
},
- setLineCap: function(style) {
+ setLineCap: function canvasGraphicsSetLineCap(style) {
this.ctx.lineCap = LINE_CAP_STYLES[style];
},
- setLineJoin: function(style) {
+ setLineJoin: function canvasGraphicsSetLineJoin(style) {
this.ctx.lineJoin = LINE_JOIN_STYLES[style];
},
- setMiterLimit: function(limit) {
+ setMiterLimit: function canvasGraphicsSetMiterLimit(limit) {
this.ctx.miterLimit = limit;
},
- setDash: function(dashArray, dashPhase) {
+ setDash: function canvasGraphicsSetDash(dashArray, dashPhase) {
this.ctx.mozDash = dashArray;
this.ctx.mozDashOffset = dashPhase;
},
- setRenderingIntent: function(intent) {
+ setRenderingIntent: function canvasGraphicsSetRenderingIntent(intent) {
TODO('set rendering intent: ' + intent);
},
- setFlatness: function(flatness) {
+ setFlatness: function canvasGraphicsSetFlatness(flatness) {
TODO('set flatness: ' + flatness);
},
- setGState: function(dictName) {
+ setGState: function canvasGraphicsSetGState(dictName) {
TODO('set graphics state from dict: ' + dictName);
},
- save: function() {
+ save: function canvasGraphicsSave() {
this.ctx.save();
if (this.ctx.$saveCurrentX) {
this.ctx.$saveCurrentX();
this.stateStack.push(old);
this.current = old.clone();
},
- restore: function() {
+ restore: function canvasGraphicsRestore() {
var prev = this.stateStack.pop();
if (prev) {
if (this.ctx.$restoreCurrentX) {
this.ctx.restore();
}
},
- transform: function(a, b, c, d, e, f) {
+ transform: function canvasGraphicsTransform(a, b, c, d, e, f) {
this.ctx.transform(a, b, c, d, e, f);
},
// Path
- moveTo: function(x, y) {
+ moveTo: function canvasGraphicsMoveTo(x, y) {
this.ctx.moveTo(x, y);
this.current.setCurrentPoint(x, y);
},
- lineTo: function(x, y) {
+ lineTo: function canvasGraphicsLineTo(x, y) {
this.ctx.lineTo(x, y);
this.current.setCurrentPoint(x, y);
},
- curveTo: function(x1, y1, x2, y2, x3, y3) {
+ curveTo: function canvasGraphicsCurveTo(x1, y1, x2, y2, x3, y3) {
this.ctx.bezierCurveTo(x1, y1, x2, y2, x3, y3);
this.current.setCurrentPoint(x3, y3);
},
- curveTo2: function(x2, y2, x3, y3) {
+ curveTo2: function canvasGraphicsCurveTo2(x2, y2, x3, y3) {
var current = this.current;
this.ctx.bezierCurveTo(current.x, current.y, x2, y2, x3, y3);
current.setCurrentPoint(x3, y3);
},
- curveTo3: function(x1, y1, x3, y3) {
+ curveTo3: function canvasGraphicsCurveTo3(x1, y1, x3, y3) {
this.curveTo(x1, y1, x3, y3, x3, y3);
this.current.setCurrentPoint(x3, y3);
},
- closePath: function() {
+ closePath: function canvasGraphicsClosePath() {
this.ctx.closePath();
},
- rectangle: function(x, y, width, height) {
+ rectangle: function canvasGraphicsRectangle(x, y, width, height) {
this.ctx.rect(x, y, width, height);
},
- stroke: function() {
+ stroke: function canvasGraphicsStroke() {
var ctx = this.ctx;
var strokeColor = this.current.strokeColor;
if (strokeColor && strokeColor.type === 'Pattern') {
this.consumePath();
},
- closeStroke: function() {
+ closeStroke: function canvasGraphicsCloseStroke() {
this.closePath();
this.stroke();
},
- fill: function() {
+ fill: function canvasGraphicsFill() {
var ctx = this.ctx;
var fillColor = this.current.fillColor;
this.consumePath();
},
- eoFill: function() {
+ eoFill: function canvasGraphicsEoFill() {
var savedFillRule = this.setEOFillRule();
this.fill();
this.restoreFillRule(savedFillRule);
},
- fillStroke: function() {
+ fillStroke: function canvasGraphicsFillStroke() {
var ctx = this.ctx;
var fillColor = this.current.fillColor;
this.consumePath();
},
- eoFillStroke: function() {
+ eoFillStroke: function canvasGraphicsEoFillStroke() {
var savedFillRule = this.setEOFillRule();
this.fillStroke();
this.restoreFillRule(savedFillRule);
},
- closeFillStroke: function() {
+ closeFillStroke: function canvasGraphicsCloseFillStroke() {
return this.fillStroke();
},
- closeEOFillStroke: function() {
+ closeEOFillStroke: function canvasGraphicsCloseEOFillStroke() {
var savedFillRule = this.setEOFillRule();
this.fillStroke();
this.restoreFillRule(savedFillRule);
},
- endPath: function() {
+ endPath: function canvasGraphicsEndPath() {
this.consumePath();
},
// Clipping
- clip: function() {
+ clip: function canvasGraphicsClip() {
this.pendingClip = NORMAL_CLIP;
},
- eoClip: function() {
+ eoClip: function canvasGraphicsEoClip() {
this.pendingClip = EO_CLIP;
},
// Text
- beginText: function() {
+ beginText: function canvasGraphicsBeginText() {
this.current.textMatrix = IDENTITY_MATRIX;
if (this.ctx.$setCurrentX) {
this.ctx.$setCurrentX(0);
this.current.x = this.current.lineX = 0;
this.current.y = this.current.lineY = 0;
},
- endText: function() {
+ endText: function canvasGraphicsEndText() {
},
- setCharSpacing: function(spacing) {
+ setCharSpacing: function canvasGraphicsSetCharSpacing(spacing) {
this.current.charSpacing = spacing;
},
- setWordSpacing: function(spacing) {
+ setWordSpacing: function canvasGraphicsSetWordSpacing(spacing) {
this.current.wordSpacing = spacing;
},
- setHScale: function(scale) {
+ setHScale: function canvasGraphicsSetHScale(scale) {
this.current.textHScale = scale / 100;
},
- setLeading: function(leading) {
+ setLeading: function canvasGraphicsSetLeading(leading) {
this.current.leading = -leading;
},
- setFont: function(fontRef, size) {
+ setFont: function canvasGraphicsSetFont(fontRef, size) {
var font = this.xref.fetchIfRef(this.res.get('Font'));
if (!IsDict(font))
return;
this.ctx.font = rule;
}
},
- setTextRenderingMode: function(mode) {
+ setTextRenderingMode: function canvasGraphicsSetTextRenderingMode(mode) {
TODO('text rendering mode: ' + mode);
},
- setTextRise: function(rise) {
+ setTextRise: function canvasGraphicsSetTextRise(rise) {
TODO('text rise: ' + rise);
},
- moveText: function(x, y) {
+ moveText: function canvasGraphicsMoveText(x, y) {
this.current.x = this.current.lineX += x;
this.current.y = this.current.lineY += y;
if (this.ctx.$setCurrentX) {
this.ctx.$setCurrentX(this.current.x);
}
},
- setLeadingMoveText: function(x, y) {
+ setLeadingMoveText: function canvasGraphicsSetLeadingMoveText(x, y) {
this.setLeading(-y);
this.moveText(x, y);
},
- setTextMatrix: function(a, b, c, d, e, f) {
+ setTextMatrix: function canvasGraphicsSetTextMatrix(a, b, c, d, e, f) {
this.current.textMatrix = [a, b, c, d, e, f];
if (this.ctx.$setCurrentX) {
this.current.x = this.current.lineX = 0;
this.current.y = this.current.lineY = 0;
},
- nextLine: function() {
+ nextLine: function canvasGraphicsNextLine() {
this.moveText(0, this.current.leading);
},
- showText: function(text) {
+ showText: function canvasGraphicsShowText(text) {
var ctx = this.ctx;
var current = this.current;
var font = current.font;
this.ctx.restore();
},
- showSpacedText: function(arr) {
+ showSpacedText: function canvasGraphicsShowSpacedText(arr) {
for (var i = 0; i < arr.length; ++i) {
var e = arr[i];
if (IsNum(e)) {
}
}
},
- nextLineShowText: function(text) {
+ nextLineShowText: function canvasGraphicsNextLineShowText(text) {
this.nextLine();
this.showText(text);
},
- nextLineSetSpacingShowText: function(wordSpacing, charSpacing, text) {
+ nextLineSetSpacingShowText:
+ function canvasGraphicsNextLineSetSpacingShowText(wordSpacing,
+ charSpacing,
+ text) {
this.setWordSpacing(wordSpacing);
this.setCharSpacing(charSpacing);
this.nextLineShowText(text);
},
// Type3 fonts
- setCharWidth: function(xWidth, yWidth) {
+ setCharWidth: function canvasGraphicsSetCharWidth(xWidth, yWidth) {
TODO('type 3 fonts ("d0" operator) xWidth: ' + xWidth + ' yWidth: ' +
yWidth);
},
- setCharWidthAndBounds: function(xWidth, yWidth, llx, lly, urx, ury) {
+ setCharWidthAndBounds: function canvasGraphicsSetCharWidthAndBounds(xWidth,
+ yWidth,
+ llx,
+ lly,
+ urx,
+ ury) {
TODO('type 3 fonts ("d1" operator) xWidth: ' + xWidth + ' yWidth: ' +
yWidth + ' llx: ' + llx + ' lly: ' + lly + ' urx: ' + urx +
' ury ' + ury);
},
// Color
- setStrokeColorSpace: function(space) {
+ setStrokeColorSpace: function canvasGraphicsSetStrokeColorSpace(space) {
this.current.strokeColorSpace =
ColorSpace.parse(space, this.xref, this.res);
},
- setFillColorSpace: function(space) {
+ setFillColorSpace: function canvasGraphicsSetFillColorSpace(space) {
this.current.fillColorSpace =
ColorSpace.parse(space, this.xref, this.res);
},
- setStrokeColor: function(/*...*/) {
+ setStrokeColor: function canvasGraphicsSetStrokeColor(/*...*/) {
var cs = this.current.strokeColorSpace;
var color = cs.getRgb(arguments);
this.setStrokeRGBColor.apply(this, color);
},
- setStrokeColorN: function(/*...*/) {
+ setStrokeColorN: function canvasGraphicsSetStrokeColorN(/*...*/) {
var cs = this.current.strokeColorSpace;
if (cs.name == 'Pattern') {
this.setStrokeColor.apply(this, arguments);
}
},
- setFillColor: function(/*...*/) {
+ setFillColor: function canvasGraphicsSetFillColor(/*...*/) {
var cs = this.current.fillColorSpace;
var color = cs.getRgb(arguments);
this.setFillRGBColor.apply(this, color);
},
- setFillColorN: function(/*...*/) {
+ setFillColorN: function canvasGraphicsSetFillColorN(/*...*/) {
var cs = this.current.fillColorSpace;
if (cs.name == 'Pattern') {
this.setFillColor.apply(this, arguments);
}
},
- setStrokeGray: function(gray) {
+ setStrokeGray: function canvasGraphicsSetStrokeGray(gray) {
this.setStrokeRGBColor(gray, gray, gray);
},
- setFillGray: function(gray) {
+ setFillGray: function canvasGraphicsSetFillGray(gray) {
this.setFillRGBColor(gray, gray, gray);
},
- setStrokeRGBColor: function(r, g, b) {
+ setStrokeRGBColor: function canvasGraphicsSetStrokeRGBColor(r, g, b) {
var color = Util.makeCssRgb(r, g, b);
this.ctx.strokeStyle = color;
this.current.strokeColor = color;
},
- setFillRGBColor: function(r, g, b) {
+ setFillRGBColor: function canvasGraphicsSetFillRGBColor(r, g, b) {
var color = Util.makeCssRgb(r, g, b);
this.ctx.fillStyle = color;
this.current.fillColor = color;
},
- setStrokeCMYKColor: function(c, m, y, k) {
+ setStrokeCMYKColor: function canvasGraphicsSetStrokeCMYKColor(c, m, y, k) {
var color = Util.makeCssCmyk(c, m, y, k);
this.ctx.strokeStyle = color;
this.current.strokeColor = color;
},
- setFillCMYKColor: function(c, m, y, k) {
+ setFillCMYKColor: function canvasGraphicsSetFillCMYKColor(c, m, y, k) {
var color = Util.makeCssCmyk(c, m, y, k);
this.ctx.fillStyle = color;
this.current.fillColor = color;
},
// Shading
- shadingFill: function(shadingName) {
+ shadingFill: function canvasGraphicsShadingFill(shadingName) {
var xref = this.xref;
var res = this.res;
var ctx = this.ctx;
},
// Images
- beginInlineImage: function() {
+ beginInlineImage: function canvasGraphicsBeginInlineImage() {
error('Should not call beginInlineImage');
},
- beginImageData: function() {
+ beginImageData: function canvasGraphicsBeginImageData() {
error('Should not call beginImageData');
},
- endInlineImage: function(image) {
+ endInlineImage: function canvasGraphicsEndInlineImage(image) {
this.paintImageXObject(null, image, true);
},
// XObjects
- paintXObject: function(obj) {
+ paintXObject: function canvasGraphicsPaintXObject(obj) {
var xobj = this.xobjs.get(obj.name);
if (!xobj)
return;
}
},
- paintFormXObject: function(ref, stream) {
+ paintFormXObject: function canvasGraphicsPaintFormXObject(ref, stream) {
this.save();
var matrix = stream.dict.get('Matrix');
this.restore();
},
- paintImageXObject: function(ref, image, inline) {
+ paintImageXObject: function canvasGraphicsPaintImageXObject(ref, image,
+ inline) {
this.save();
var ctx = this.ctx;
// Marked content
- markPoint: function(tag) {
+ markPoint: function canvasGraphicsMarkPoint(tag) {
TODO('Marked content');
},
- markPointProps: function(tag, properties) {
+ markPointProps: function canvasGraphicsMarkPointProps(tag, properties) {
TODO('Marked content');
},
- beginMarkedContent: function(tag) {
+ beginMarkedContent: function canvasGraphicsBeginMarkedContent(tag) {
TODO('Marked content');
},
- beginMarkedContentProps: function(tag, properties) {
+ beginMarkedContentProps:
+ function canvasGraphicsBeginMarkedContentProps(tag, properties) {
TODO('Marked content');
},
- endMarkedContent: function() {
+ endMarkedContent: function canvasGraphicsEndMarkedContent() {
TODO('Marked content');
},
// Compatibility
- beginCompat: function() {
+ beginCompat: function canvasGraphicsBeginCompat() {
TODO('ignore undefined operators (should we do that anyway?)');
},
- endCompat: function() {
+ endCompat: function canvasGraphicsEndCompat() {
TODO('stop ignoring undefined operators');
},
// Helper functions
- consumePath: function() {
+ consumePath: function canvasGraphicsConsumePath() {
if (this.pendingClip) {
var savedFillRule = null;
if (this.pendingClip == EO_CLIP)
// We generally keep the canvas context set for
// nonzero-winding, and just set evenodd for the operations
// that need them.
- setEOFillRule: function() {
+ setEOFillRule: function canvasGraphicsSetEOFillRule() {
var savedFillRule = this.ctx.mozFillRule;
this.ctx.mozFillRule = 'evenodd';
return savedFillRule;
},
- restoreFillRule: function(rule) {
+ restoreFillRule: function canvasGraphicsRestoreFillRule(rule) {
this.ctx.mozFillRule = rule;
}
};
return constructor;
})();
-var Util = (function() {
+var Util = (function utilUtil() {
function constructor() {}
constructor.makeCssRgb = function makergb(r, g, b) {
var ri = (255 * r) | 0, gi = (255 * g) | 0, bi = (255 * b) | 0;
return constructor;
})();
-var ColorSpace = (function() {
+var ColorSpace = (function colorSpaceColorSpace() {
// Constructor should define this.numComps, this.defaultColor, this.name
function constructor() {
error('should not call ColorSpace constructor');
return constructor;
})();
-var SeparationCS = (function() {
+var SeparationCS = (function separationCS() {
function constructor(base, tintFn) {
this.name = 'Separation';
this.numComps = 1;
return constructor;
})();
-var PatternCS = (function() {
+var PatternCS = (function patternCS() {
function constructor(baseCS) {
this.name = 'Pattern';
this.base = baseCS;
return constructor;
})();
-var IndexedCS = (function() {
+var IndexedCS = (function indexedCS() {
function constructor(base, highVal, lookup) {
this.name = 'Indexed';
this.numComps = 1;
return constructor;
})();
-var DeviceGrayCS = (function() {
+var DeviceGrayCS = (function deviceGrayCS() {
function constructor() {
this.name = 'DeviceGray';
this.numComps = 1;
return constructor;
})();
-var DeviceRgbCS = (function() {
+var DeviceRgbCS = (function deviceRgbCS() {
function constructor(bits) {
this.name = 'DeviceRGB';
this.numComps = 3;
return constructor;
})();
-var DeviceCmykCS = (function() {
+var DeviceCmykCS = (function deviceCmykCS() {
function constructor() {
this.name = 'DeviceCMYK';
this.numComps = 4;
return constructor;
})();
-var Pattern = (function() {
+var Pattern = (function patternPattern() {
// Constructor should define this.getPattern
function constructor() {
error('should not call Pattern constructor');
return constructor;
})();
-var DummyShading = (function() {
+var DummyShading = (function dummyShading() {
function constructor() {
this.type = 'Pattern';
}
// Radial and axial shading have very similar implementations
// If needed, the implementations can be broken into two classes
-var RadialAxialShading = (function() {
+var RadialAxialShading = (function radialAxialShading() {
function constructor(dict, matrix, xref, res, ctx) {
this.matrix = matrix;
this.coordsArr = dict.get('Coords');
}
constructor.prototype = {
- getPattern: function() {
+ getPattern: function radialAxialShadingGetPattern() {
var coordsArr = this.coordsArr;
var type = this.shadingType;
var p0, p1, r0, r1;
return constructor;
})();
-var TilingPattern = (function() {
+var TilingPattern = (function tilingPattern() {
var PAINT_TYPE_COLORED = 1, PAINT_TYPE_UNCOLORED = 2;
function constructor(pattern, code, dict, color, xref, ctx) {
})();
-var PDFImage = (function() {
+var PDFImage = (function pDFImage() {
function constructor(xref, res, image, inline) {
this.image = image;
if (image.getParams) {
return constructor;
})();
-var PDFFunction = (function() {
+var PDFFunction = (function pDFFunction() {
function constructor(xref, fn) {
var dict = fn.dict;
if (!dict)
}
constructor.prototype = {
- constructSampled: function(str, dict) {
+ constructSampled: function pDFFunctionConstructSampled(str, dict) {
var domain = dict.get('Domain');
var range = dict.get('Range');
var samples = this.getSampleArray(size, outputSize, bps, str);
- this.func = function(args) {
- var clip = function(v, min, max) {
+ this.func = function pDFFunctionFunc(args) {
+ var clip = function pDFFunctionClip(v, min, max) {
if (v > max)
v = max;
else if (v < min)
return output;
};
},
- getSampleArray: function(size, outputSize, bps, str) {
+ getSampleArray: function pDFFunctionGetSampleArray(size, outputSize, bps,
+ str) {
var length = 1;
for (var i = 0; i < size.length; i++)
length *= size[i];
}
return array;
},
- constructInterpolated: function(str, dict) {
+ constructInterpolated: function pDFFunctionConstructInterpolated(str,
+ dict) {
var c0 = dict.get('C0') || [0];
var c1 = dict.get('C1') || [1];
var n = dict.get('N');
for (var i = 0; i < length; ++i)
diff.push(c1[i] - c0[i]);
- this.func = function(args) {
+ this.func = function pDFFunctionConstructInterpolatedFunc(args) {
var x = args[0];
var out = [];