Lines Matching refs:p

1010     var p = this;
1013 p.ArrayList = ArrayList;
1014 p.HashMap = HashMap;
1015 p.PVector = PVector;
1021 p.externals = {
1029 p.name = 'Processing.js Instance'; // Set Processing defaults / environment variables
1030 p.use3DContext = false; // default '2d' canvas context
1032 p.focused = true;
1033 p.breakShape = false;
1036 p.glyphTable = {};
1039 p.pmouseX = 0;
1040 p.pmouseY = 0;
1041 p.mouseX = 0;
1042 p.mouseY = 0;
1043 p.mouseButton = 0;
1044 p.mouseScroll = 0;
1047 p.mouseClicked = undef;
1048 p.mouseDragged = undef;
1049 p.mouseMoved = undef;
1050 p.mousePressed = undef;
1051 p.mouseReleased = undef;
1052 p.mouseScrolled = undef;
1053 p.key = undef;
1054 p.keyCode = undef;
1055 p.keyPressed = undef;
1056 p.keyReleased = undef;
1057 p.keyTyped = undef;
1058 p.draw = undef;
1059 p.setup = undef;
1062 p.__mousePressed = false;
1063 p.__keyPressed = false;
1064 p.__frameRate = 0;
1067 p.frameCount = 0;
1070 p.width = curElement.width - 0;
1071 p.height = curElement.height - 0;
1073 p.defineProperty = function(obj, name, desc) {
1821 var Char = p.Character = function Char(chr) {
1842 var PShape = p.PShape = function(family) {
1914 p.beginShape();
1919 p.vertex(this.vertices[i][0], this.vertices[i][1]);
1923 p.vertex(this.vertices[i][0], this.vertices[i][1], this.vertices[i][2]);
1933 p.vertex(this.vertices[index][0], this.vertices[index][1]);
1939 p.breakShape = false;
1943 p.bezierVertex(this.vertices[index+0][0], this.vertices[index+0][1],
1949 p.curveVertex(this.vertices[index][0], this.vertices[index][1]);
1953 p.breakShape = true;
1961p.vertex(this.vertices[index][0], this.vertices[index][1], this.vertices[index][2]);
1967 p.breakShape = false;
1970p.bezierVertex(this.vertices[index+0][0], this.vertices[index+0][1], this.vertices[index+0][2],
1976p.curveVertex(this.vertices[index][0], this.vertices[index][1], this.vertices[index][2]);
1980 p.breakShape = true;
1986 p.endShape(this.close ? PConstants.CLOSE : PConstants.OPEN);
1989 p.beginShape(this.kind);
1993 p.vertex(this.vertices[i]);
1999 p.vertex(vert[0], vert[1]);
2001 p.vertex(vert[0], vert[1], vert[2]);
2005 p.endShape();
2015 p.point(this.params[0], this.params[1]);
2019 p.line(this.params[0], this.params[1],
2022 p.line(this.params[0], this.params[1], this.params[2],
2027 p.triangle(this.params[0], this.params[1],
2032 p.quad(this.params[0], this.params[1],
2039 p.imageMode(PConstants.CORNER);
2040 p.image(this.image, this.params[0], this.params[1], this.params[2], this.params[3]);
2042 p.rectMode(PConstants.CORNER);
2043 p.rect(this.params[0], this.params[1], this.params[2], this.params[3]);
2047 p.ellipseMode(PConstants.CORNER);
2048 p.ellipse(this.params[0], this.params[1], this.params[2], this.params[3]);
2051 p.ellipseMode(PConstants.CORNER);
2052p.arc(this.params[0], this.params[1], this.params[2], this.params[3], this.params[4], this.params[…
2056 p.box(this.params[0]);
2058 p.box(this.params[0], this.params[1], this.params[2]);
2062 p.sphere(this.params[0]);
2068 p.pushMatrix();
2073 p.pushStyle();
2079 p.popMatrix();
2082 p.popStyle();
2087 p.stroke(this.strokeColor);
2088 p.strokeWeight(this.strokeWeight);
2089 p.strokeCap(this.strokeCap);
2090 p.strokeJoin(this.strokeJoin);
2092 p.noStroke();
2096 p.fill(this.fillColor);
2099 p.noFill();
2163 this.matrix = new p.PMatrix2D();
2165 this.matrix = new p.PMatrix3D();
2167 }else if(dimensions === 3 && this.matrix instanceof p.PMatrix2D) {
2168 this.matrix = new p.PMatrix3D();
2239 p.PShape.call( this ); // PShape is the base class.
2241 this.element = new p.XMLElement(null, arguments[0]);
2271 this.element = new p.XMLElement(null, arguments[1]);
2373 pieces.push(p.trim(all));
2376 p.println("Transformation:" + str + " is empty");
2401 this.matrix.rotate(p.radians(angle));
2404 this.matrix.rotate(p.radians(m[0]));
2417 var children = new p.PShape();
2476p.println("Text in SVG files is not currently supported, convert text to outlines instead." );
2479 p.println("Filters are not supported.");
2482 p.println("Masks are not supported.");
2485 p.println("Ignoring <" + name + "> tag.");
2495 …var pathData = p.trim(this.element.getStringAttribute("d").replace(/[\s,]+/g,' ')); //change multi…
2866 var pointsAttr = p.trim(this.element.getStringAttribute("points").replace(/[,\s]+/g,' '));
2878 p.println("Error parsing polygon points: odd number of coordinates provided");
2949 var tokens = p.trim(styleTokens[i].split( ":" ));
3098 p.shape = function(shape, x, y, width, height) {
3101 p.pushMatrix();
3104 p.translate(x - width/2, y - height/2);
3105 p.scale(width / shape.getWidth(), height / shape.getHeight());
3107 p.translate(x - shape.getWidth()/2, - shape.getHeight()/2);
3109 p.translate(-shape.getWidth()/2, -shape.getHeight()/2);
3113 p.translate(x, y);
3114 p.scale(width / shape.getWidth(), height / shape.getHeight());
3116 p.translate(x, y);
3122 p.translate(x, y);
3123 p.scale(width / shape.getWidth(), height / shape.getHeight());
3125 p.translate(x, y);
3130 p.popMatrix();
3136 p.shapeMode = function (mode) {
3140 p.loadShape = function (filename) {
3184 var XMLElement = p.XMLElement = function() {
3588 var PMatrix2D = p.PMatrix2D = function() {
3756 var output = "" + p.nfs(this.elements[0], digits, 4) + " " +
3757 p.nfs(this.elements[1], digits, 4) + " " +
3758 p.nfs(this.elements[2], digits, 4) + "\n" +
3759 p.nfs(this.elements[3], digits, 4) + " " +
3760 p.nfs(this.elements[4], digits, 4) + " " +
3761 p.nfs(this.elements[5], digits, 4) + "\n\n";
3762 p.println(output);
3770 var PMatrix3D = p.PMatrix3D = function PMatrix3D() {
3924 var c = p.cos(angle);
3925 var s = p.sin(angle);
3957 var c = p.cos(angle);
3958 var s = p.sin(angle);
3963 var c = p.cos(angle);
3964 var s = p.sin(angle);
4109 … var output = "" + p.nfs(this.elements[0], digits, 4) + " " + p.nfs(this.elements[1], digits, 4) +
4110 … " " + p.nfs(this.elements[2], digits, 4) + " " + p.nfs(this.elements[3], digits, 4) +
4111 … "\n" + p.nfs(this.elements[4], digits, 4) + " " + p.nfs(this.elements[5], digits, 4) +
4112 … " " + p.nfs(this.elements[6], digits, 4) + " " + p.nfs(this.elements[7], digits, 4) +
4113 … "\n" + p.nfs(this.elements[8], digits, 4) + " " + p.nfs(this.elements[9], digits, 4) +
4114 … " " + p.nfs(this.elements[10], digits, 4) + " " + p.nfs(this.elements[11], digits, 4) +
4115 … "\n" + p.nfs(this.elements[12], digits, 4) + " " + p.nfs(this.elements[13], digits, 4) +
4116 … " " + p.nfs(this.elements[14], digits, 4) + " " + p.nfs(this.elements[15], digits, 4) + "\n\n";
4117 p.println(output);
4146 var PMatrixStack = p.PMatrixStack = function PMatrixStack() {
4152 if (p.use3DContext) {
4176 if (p.use3DContext) {
4194 p.split = function(str, delim) {
4198 p.splitTokens = function(str, tokens) {
4231 p.append = function(array, element) {
4236 p.concat = function(array1, array2) {
4240 p.sort = function(array, numElem) {
4276 p.splice = function(array, value, index) {
4300 p.subset = function(array, offset, length) {
4308 p.join = function(array, seperator) {
4312 p.shorten = function(ary) {
4325 p.expand = function(ary, newSize) {
4338 p.arrayCopy = function() { // src, srcPos, dest, destPos, length) {
4369 p.reverse = function(array) {
4379 p.mix = function(a, b, f) {
4383 p.peg = function(n) {
4388 p.modes = {
4395 p.mix(c1 & PConstants.RED_MASK, c2 & PConstants.RED_MASK, f) & PConstants.RED_MASK |
4396p.mix(c1 & PConstants.GREEN_MASK, c2 & PConstants.GREEN_MASK, f) & PConstants.GREEN_MASK |
4397 p.mix(c1 & PConstants.BLUE_MASK, c2 & PConstants.BLUE_MASK, f));
4423p.mix(c1 & PConstants.RED_MASK, Math.min(c1 & PConstants.RED_MASK, ((c2 & PConstants.RED_MASK) >> …
4424p.mix(c1 & PConstants.GREEN_MASK, Math.min(c1 & PConstants.GREEN_MASK, ((c2 & PConstants.GREEN_MAS…
4425p.mix(c1 & PConstants.BLUE_MASK, Math.min(c1 & PConstants.BLUE_MASK, ((c2 & PConstants.BLUE_MASK) …
4441 (p.peg(ar + (((cr - ar) * f) >> 8)) << 16) |
4442 (p.peg(ag + (((cg - ag) * f) >> 8)) << 8) |
4443 (p.peg(ab + (((cb - ab) * f) >> 8))));
4459 (p.peg(ar + (((cr - ar) * f) >> 8)) << 16) |
4460 (p.peg(ag + (((cg - ag) * f) >> 8)) << 8) |
4461 (p.peg(ab + (((cb - ab) * f) >> 8))));
4477 (p.peg(ar + (((cr - ar) * f) >> 8)) << 16) |
4478 (p.peg(ag + (((cg - ag) * f) >> 8)) << 8) |
4479 (p.peg(ab + (((cb - ab) * f) >> 8))));
4495 (p.peg(ar + (((cr - ar) * f) >> 8)) << 16) |
4496 (p.peg(ag + (((cg - ag) * f) >> 8)) << 8) |
4497 (p.peg(ab + (((cb - ab) * f) >> 8))));
4513 (p.peg(ar + (((cr - ar) * f) >> 8)) << 16) |
4514 (p.peg(ag + (((cg - ag) * f) >> 8)) << 8) |
4515 (p.peg(ab + (((cb - ab) * f) >> 8))));
4531 (p.peg(ar + (((cr - ar) * f) >> 8)) << 16) |
4532 (p.peg(ag + (((cg - ag) * f) >> 8)) << 8) |
4533 (p.peg(ab + (((cb - ab) * f) >> 8))));
4549 (p.peg(ar + (((cr - ar) * f) >> 8)) << 16) |
4550 (p.peg(ag + (((cg - ag) * f) >> 8)) << 8) |
4551 (p.peg(ab + (((cb - ab) * f) >> 8))));
4562 … var cr = (br === 255) ? 255 : p.peg((ar << 8) / (255 - br)); // division requires pre-peg()-ing
4563 var cg = (bg === 255) ? 255 : p.peg((ag << 8) / (255 - bg)); // "
4564 var cb = (bb === 255) ? 255 : p.peg((ab << 8) / (255 - bb)); // "
4567 (p.peg(ar + (((cr - ar) * f) >> 8)) << 16) |
4568 (p.peg(ag + (((cg - ag) * f) >> 8)) << 8) |
4569 (p.peg(ab + (((cb - ab) * f) >> 8))));
4580 … var cr = (br === 0) ? 0 : 255 - p.peg(((255 - ar) << 8) / br); // division requires pre-peg()-ing
4581 var cg = (bg === 0) ? 0 : 255 - p.peg(((255 - ag) << 8) / bg); // "
4582 var cb = (bb === 0) ? 0 : 255 - p.peg(((255 - ab) << 8) / bb); // "
4585 (p.peg(ar + (((cr - ar) * f) >> 8)) << 16) |
4586 (p.peg(ag + (((cg - ag) * f) >> 8)) << 8) |
4587 (p.peg(ab + (((cb - ab) * f) >> 8))));
4595 var rgb = p.color.toRGB(aValue1, aValue2, aValue3);
4652 p.color = function color(aValue1, aValue2, aValue3, aValue4) {
4680 p.color.toString = function(colorInt) {
4686 p.color.toInt = function(r, g, b, a) {
4691 p.color.toArray = function(colorInt) {
4697 p.color.toGLArray = function(colorInt) {
4703 p.color.toRGB = function(h, s, b) {
4720 var p = Math.round((b * (100 - s)) / 10000 * 255);
4725 return [br, t, p];
4727 return [q, br, p];
4729 return [p, br, t];
4731 return [p, q, br];
4733 return [t, p, br];
4735 return [br, p, q];
4740 p.color.toHSB = function( colorInt ) {
4747 var max = p.max(p.max(red,green), blue),
4748 min = p.min(p.min(red,green), blue),
4775 p.brightness = function(colInt){
4776 return p.color.toHSB(colInt)[2];
4779 p.saturation = function(colInt){
4780 return p.color.toHSB(colInt)[1];
4783 p.hue = function(colInt){
4784 return p.color.toHSB(colInt)[0];
4791 return p.color(aColor);
4795 p.red = function(aColor) {
4799 p.green = function(aColor) {
4803 p.blue = function(aColor) {
4807 p.alpha = function(aColor) {
4811 p.lerpColor = function lerpColor(c1, c2, amt) {
4813 var colorBits1 = p.color(c1);
4820 var colorBits2 = p.color(c2);
4827 var r = parseInt(p.lerp(r1, r2, amt), 10);
4828 var g = parseInt(p.lerp(g1, g2, amt), 10);
4829 var b = parseInt(p.lerp(b1, b2, amt), 10);
4830 var a = parseFloat(p.lerp(a1, a2, amt) * colorModeA);
4832 return p.color.toInt(r, g, b, a);
4836 p.defaultColor = function(aValue1, aValue2, aValue3) {
4839 …var c = p.color(aValue1 / 255 * colorModeX, aValue2 / 255 * colorModeY, aValue3 / 255 * colorModeZ…
4844 p.colorMode = function colorMode() { // mode, range1, range2, range3, range4
4854 p.blendColor = function(c1, c2, mode) {
4858 color = p.modes.replace(c1, c2);
4861 color = p.modes.blend(c1, c2);
4864 color = p.modes.add(c1, c2);
4867 color = p.modes.subtract(c1, c2);
4870 color = p.modes.lightest(c1, c2);
4873 color = p.modes.darkest(c1, c2);
4876 color = p.modes.difference(c1, c2);
4879 color = p.modes.exclusion(c1, c2);
4882 color = p.modes.multiply(c1, c2);
4885 color = p.modes.screen(c1, c2);
4888 color = p.modes.hard_light(c1, c2);
4891 color = p.modes.soft_light(c1, c2);
4894 color = p.modes.overlay(c1, c2);
4897 color = p.modes.dodge(c1, c2);
4900 color = p.modes.burn(c1, c2);
4920 p.printMatrix = function printMatrix() {
4924 p.translate = function translate(x, y, z) {
4925 if (p.use3DContext) {
4933 p.scale = function scale(x, y, z) {
4934 if (p.use3DContext) {
4942 p.pushMatrix = function pushMatrix() {
4943 if (p.use3DContext) {
4950 p.popMatrix = function popMatrix() {
4951 if (p.use3DContext) {
4958 p.resetMatrix = function resetMatrix() {
4959 if (p.use3DContext) {
4967 p.applyMatrix = function applyMatrix() {
4969 if (!p.use3DContext) {
4980 p.rotateX = function(angleInRadians) {
4985 p.rotateZ = function(angleInRadians) {
4990 p.rotateY = function(angleInRadians) {
4995 p.rotate = function rotate(angleInRadians) {
4996 if (p.use3DContext) {
5004 p.pushStyle = function pushStyle() {
5008 p.pushMatrix();
5029 p.popStyle = function popStyle() {
5035 p.popMatrix();
5059 p.year = function year() {
5062 p.month = function month() {
5065 p.day = function day() {
5068 p.hour = function hour() {
5071 p.minute = function minute() {
5074 p.second = function second() {
5077 p.millis = function millis() {
5081 p.redraw = function redraw() {
5090 p.__frameRate = fps;
5093 p.frameCount++;
5097 if (p.use3DContext) {
5103 p.noLights();
5104 p.lightFalloff(1, 0, 0);
5105 p.shininess(1);
5106 p.ambient(255, 255, 255);
5107 p.specular(0, 0, 0);
5108 p.camera();
5109 p.draw();
5112 p.draw();
5119 p.noLoop = function noLoop() {
5125 p.loop = function loop() {
5133 p.focused = document.hasFocus();
5135 p.redraw();
5146 p.frameRate = function frameRate(aRate) {
5152 p.noLoop();
5153 p.loop();
5159 p.exit = function exit() {
5162 Processing.removeInstance(p.externals.canvas.id);
5181 p.cursor = function cursor() {
5182 if (arguments.length > 1 || (arguments.length === 1 && arguments[0] instanceof p.PImage)) {
5208 p.noCursor = function noCursor() {
5212 p.link = function(href, target) {
5223 p.beginDraw = function beginDraw() {};
5224 p.endDraw = function endDraw() {};
5227 p.Import = function Import(lib) {
5238 p.disableContextMenu = function disableContextMenu() {
5242 p.enableContextMenu = function enableContextMenu() {
5246 p.status = function(text) {
5271 p.binary = function(num, numBits) {
5301 p.unbinary = function unbinary(binaryString) {
5309 values[i] = p.unbinary(binaryString[i]);
5395 p.nf = function() {
5423 test = p.nf(arr[i], pad);
5478 test = p.nf(arr[i], left, right);
5492p.nfs = function(value, leftDigits, rightDigits) { return nfCore(value, " ", "-", leftDigits, righ…
5493p.nfp = function(value, leftDigits, rightDigits) { return nfCore(value, "+", "-", leftDigits, righ…
5494p.nfc = function(value, leftDigits, rightDigits) { return nfCore(value, "", "-", leftDigits, right…
5515 p.hex = function hex(value, len) {
5536 p.unhex = function(hex) {
5549 p.loadStrings = function loadStrings(filename) {
5554 p.saveStrings = function saveStrings(filename, strings) {
5558 p.loadBytes = function loadBytes(url, strings) {
5573 p.matchAll = function matchAll(aString, aRegExp) {
5602 p.match = function(str, regexp) {
5868 p.console = window.console || tinylogLite;
5870 p.println = function println(message) {
5884 p.print = function print(message) {
5890 p.str = function str(val) {
5902 p.trim = function(str) {
5928 p['boolean'] = function(val) { function
5941 p['byte'] = function(aNumber) {
5953 p['char'] = function(key) {
5983 p['float'] = function(val) {
6008 p['int'] = function(val) {
6029 p.abs = Math.abs;
6031 p.ceil = Math.ceil;
6033 p.constrain = function(aNumber, aMin, aMax) {
6037 p.dist = function() {
6051 p.exp = Math.exp;
6053 p.floor = Math.floor;
6055 p.lerp = function(value1, value2, amt) {
6059 p.log = Math.log;
6061 p.mag = function(a, b, c) {
6069 p.map = function(value, istart, istop, ostart, ostop) {
6073 p.max = function() {
6092 p.min = function() {
6111 p.norm = function(aNumber, low, high) {
6115 p.pow = Math.pow;
6117 p.round = Math.round;
6119 p.sq = function(aNumber) {
6123 p.sqrt = Math.sqrt;
6126 p.acos = Math.acos;
6128 p.asin = Math.asin;
6130 p.atan = Math.atan;
6132 p.atan2 = Math.atan2;
6134 p.cos = Math.cos;
6136 p.degrees = function(aAngle) {
6140 p.radians = function(aAngle) {
6144 p.sin = Math.sin;
6146 p.tan = Math.tan;
6150 p.random = function random() {
6182 p.randomSeed = function(seed) {
6187 p.Random = function(seed) {
6280 p.noise = function(x, y, z) {
6302 p.noiseDetail = function(octaves, fallout) {
6309 p.noiseSeed = function(seed) {
6317 if (p.use3DContext) {
6324 curContext.fillRect(0, 0, p.width, p.height);
6331 p.size = function size(aWidth, aHeight, aMode) {
6345 p.use3DContext = true;
6355 sinLUT[i] = p.sin(i * (PConstants.PI / 180) * 0.5);
6356 cosLUT[i] = p.cos(i * (PConstants.PI / 180) * 0.5);
6372 p.strokeWeight(1.0);
6383 p.lightFalloff(1, 0, 0);
6384 p.shininess(1);
6385 p.ambient(255, 255, 255);
6386 p.specular(0, 0, 0);
6446 p.camera();
6447 p.perspective();
6461 p.stroke(0);
6462 p.fill(255);
6467 p.use3DContext = false;
6482 curElement.width = p.width = aWidth || 100;
6483 curElement.height = p.height = aHeight || 100;
6498 p.externals.context = curContext;
6500 p.toImageData = function() {
6501 if(!p.use3DContext){
6522 p.ambientLight = function(r, g, b, x, y, z) {
6523 if (p.use3DContext) {
6542 p.directionalLight = function(r, g, b, nx, ny, nz) {
6543 if (p.use3DContext) {
6566 p.lightFalloff = function lightFalloff(constant, linear, quadratic) {
6567 if (p.use3DContext) {
6573 p.lightSpecular = function lightSpecular(r, g, b) {
6574 if (p.use3DContext) {
6585 p.lights = function lights() {
6586 p.ambientLight(128, 128, 128);
6587 p.directionalLight(128, 128, 128, 0, 0, -1);
6588 p.lightFalloff(1, 0, 0);
6589 p.lightSpecular(0, 0, 0);
6592 p.pointLight = function(r, g, b, x, y, z) {
6593 if (p.use3DContext) {
6618 p.noLights = function noLights() {
6619 if (p.use3DContext) {
6633 p.spotLight = function spotLight(r, g, b, x, y, z, nx, ny, nz, angle, concentration) {
6634 if (p.use3DContext) {
6671 p.beginCamera = function beginCamera() {
6681 p.endCamera = function endCamera() {
6693 p.camera = function camera(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ) {
6710 var z = new p.PVector(eyeX - centerX, eyeY - centerY, eyeZ - centerZ);
6711 var y = new p.PVector(upX, upY, upZ);
6714 var x = p.PVector.cross(y, z);
6715 y = p.PVector.cross(z, x);
6732 p.perspective = function perspective(fov, aspect, near, far) {
6751 p.frustum(xMin, xMax, yMin, yMax, near, far);
6754 p.frustum = function frustum(left, right, bottom, top, near, far) {
6763 p.ortho = function ortho(left, right, bottom, top, near, far) {
6766 right = p.width;
6768 top = p.height;
6787 p.printProjection = function() {
6791 p.printCamera = function() {
6799 p.box = function(w, h, d) {
6800 if (p.use3DContext) {
6956 p.sphereDetail = function sphereDetail(ures, vres) {
7014 p.sphere = function() {
7015 if (p.use3DContext) {
7019 p.sphereDetail(30);
7102 p.modelX = function modelX(x, y, z) {
7117 p.modelY = function modelY(x, y, z) {
7132 p.modelZ = function modelZ(x, y, z) {
7151 p.ambient = function ambient() {
7156 if (p.use3DContext) {
7178 p.emissive = function emissive() {
7182 if (p.use3DContext) {
7206 p.shininess = function shininess(shine) {
7207 if (p.use3DContext) {
7222 p.specular = function specular() {
7223 var c = p.color.apply(this, arguments);
7225 if (p.use3DContext) {
7228 uniformf(programObject3D, "mat_specular", p.color.toGLArray(c).slice(0, 3));
7235 p.screenX = function screenX( x, y, z ) {
7250 return p.width * ( 1 + ox ) / 2.0;
7253 p.screenY = function screenY( x, y, z ) {
7268 return p.height * ( 1 + oy ) / 2.0;
7271 p.screenZ = function screenZ( x, y, z ) {
7293 p.fill = function fill() {
7294 var color = p.color(arguments[0], arguments[1], arguments[2], arguments[3]);
7301 if (p.use3DContext) {
7302 fillStyle = p.color.toGLArray(color);
7311 curContext.fillStyle = p.color.toString(currentFillColor);
7318 p.noFill = function noFill() {
7322 p.stroke = function stroke() {
7323 var color = p.color(arguments[0], arguments[1], arguments[2], arguments[3]);
7330 if (p.use3DContext) {
7331 strokeStyle = p.color.toGLArray(color);
7340 curContext.strokeStyle = p.color.toString(currentStrokeColor);
7347 p.noStroke = function noStroke() {
7351 p.strokeWeight = function strokeWeight(w) {
7354 if (p.use3DContext) {
7362 p.strokeCap = function strokeCap(value) {
7366 p.strokeJoin = function strokeJoin(value) {
7370 p.smooth = function() {
7372 if (!p.use3DContext && "mozImageSmoothingEnabled" in curContext) {
7377 p.noSmooth = function() {
7379 if (!p.use3DContext && "mozImageSmoothingEnabled" in curContext) {
7391 p.mix(c1 & PConstants.RED_MASK, c2 & PConstants.RED_MASK, f) & PConstants.RED_MASK |
7392p.mix(c1 & PConstants.GREEN_MASK, c2 & PConstants.GREEN_MASK, f) & PConstants.GREEN_MASK |
7393 p.mix(c1 & PConstants.BLUE_MASK, c2 & PConstants.BLUE_MASK, f));
7396 p.point = function point(x, y, z) {
7397 if (p.use3DContext) {
7434 var c = p.get(x, y);
7435 p.set(x, y, colorBlendWithAlpha(c, currentStrokeColor, alphaOfPointWeight));
7438 curContext.fillStyle = p.color.toString(currentStrokeColor);
7445 curContext.fillStyle = p.color.toString(currentStrokeColor);
7454 p.beginShape = function beginShape(type) {
7460 if(p.use3DContext)
7466 p.vertex = function vertex() {
7487 if (p.use3DContext) {
7648 p.endShape = function endShape(mode){
7705 if (p.use3DContext) {
7746 if (p.use3DContext) {
7814 if (p.use3DContext) { // 3D context
8108 p.stroke(vertArray[i][6]);
8110 p.point(vertArray[i][0], vertArray[i][1]);
8115 p.stroke(vertArray[i+1][6]);
8117 p.line(vertArray[i][0], vertArray[i][1], vertArray[i+1][0], vertArray[i+1][1]);
8128 p.fill(vertArray[i+2][5]);
8132 p.stroke(vertArray[i+2][6]);
8145 p.stroke(vertArray[i+1][6]);
8148 p.fill(vertArray[i+1][5]);
8154 p.stroke(vertArray[i+2][6]);
8157 p.fill(vertArray[i+2][5]);
8172 p.fill(vertArray[2][5]);
8176 p.stroke(vertArray[2][6]);
8188 p.fill(vertArray[i][5]);
8192 p.stroke(vertArray[i][6]);
8209 p.fill(vertArray[i+3][5]);
8213 p.stroke(vertArray[i+3][6]);
8230 p.fill(vertArray[i+3][5]);
8233 p.stroke(vertArray[i+3][6]);
8317 p.bezierVertex = function bezierVertex() {
8324 if (p.use3DContext) {
8351 p.vertex(x1, y1, z1);
8353 p.vertex(arguments[6], arguments[7], arguments[8]);
8384 p.texture = function(pimage) {
8434 p.textureMode = function(mode){
8457 p.vertex(x0, y0, z0);
8462 p.vertex(x0, y0, z0);
8466 p.curveVertex = function(x, y, z) {
8468 if(p.use3DContext){
8495 p.vertex(x, y, z);
8499 p.curve = function curve() {
8502 p.beginShape();
8503 p.curveVertex(arguments[0], arguments[1]);
8504 p.curveVertex(arguments[2], arguments[3]);
8505 p.curveVertex(arguments[4], arguments[5]);
8506 p.curveVertex(arguments[6], arguments[7]);
8507 p.endShape();
8509 if (p.use3DContext) {
8510 p.beginShape();
8511 p.curveVertex(arguments[0], arguments[1], arguments[2]);
8512 p.curveVertex(arguments[3], arguments[4], arguments[5]);
8513 p.curveVertex(arguments[6], arguments[7], arguments[8]);
8514 p.curveVertex(arguments[9], arguments[10], arguments[11]);
8515 p.endShape();
8520 p.curveTightness = function(tightness) {
8524 p.curveDetail = function curveDetail( detail ) {
8529 p.rectMode = function rectMode(aRectMode) {
8533 p.imageMode = function(mode) {
8549 p.ellipseMode = function ellipseMode(aEllipseMode) {
8553 p.arc = function arc(x, y, width, height, start, stop) {
8574 p.line = function line() {
8577 if (p.use3DContext) {
8635 p.set(x1, y, currentStrokeColor);
8640 p.set(x, y1, currentStrokeColor);
8656 p.bezier = function bezier() {
8657 if( arguments.length === 8 && !p.use3DContext ){
8658 p.beginShape();
8659 p.vertex( arguments[0], arguments[1] );
8660 p.bezierVertex( arguments[2], arguments[3],
8663 p.endShape();
8665 else if( arguments.length === 12 && p.use3DContext ){
8666 p.beginShape();
8667 p.vertex( arguments[0], arguments[1], arguments[2] );
8668 p.bezierVertex( arguments[3], arguments[4], arguments[5],
8671 p.endShape();
8677 p.bezierDetail = function bezierDetail( detail ){
8681 p.bezierPoint = function bezierPoint(a, b, c, d, t) {
8685 p.bezierTangent = function bezierTangent(a, b, c, d, t) {
8689 p.curvePoint = function curvePoint(a, b, c, d, t) {
8693 p.curveTangent = function curveTangent(a, b, c, d, t) {
8697 p.triangle = function triangle(x1, y1, x2, y2, x3, y3) {
8698 p.beginShape(PConstants.TRIANGLES);
8699 p.vertex(x1, y1, 0);
8700 p.vertex(x2, y2, 0);
8701 p.vertex(x3, y3, 0);
8702 p.endShape();
8705 p.quad = function quad(x1, y1, x2, y2, x3, y3, x4, y4) {
8706 p.beginShape(PConstants.QUADS);
8707 p.vertex(x1, y1, 0);
8708 p.vertex(x2, y2, 0);
8709 p.vertex(x3, y3, 0);
8710 p.vertex(x4, y4, 0);
8711 p.endShape();
8714 p.rect = function rect(x, y, width, height) {
8715 if (p.use3DContext) {
8795 p.set(x + i, y, currentStrokeColor);
8796 p.set(x + i, y2, currentStrokeColor);
8799 p.set(x, y + i, currentStrokeColor);
8800 p.set(x2, y + i, currentStrokeColor);
8835 p.ellipse = function ellipse(x, y, width, height) {
8861 if ((!p.use3DContext) && (width === height)) {
8875 if(!p.use3DContext){
8877 p.beginShape();
8878 p.vertex(x + w, y);
8879 p.bezierVertex(x + w, y - c_y, x + c_x, y - h, x, y - h);
8880 p.bezierVertex(x - c_x, y - h, x - w, y - c_y, x - w, y);
8881 p.bezierVertex(x - w, y + c_y, x - c_x, y + h, x, y + h);
8882 p.bezierVertex(x + c_x, y + h, x + w, y + c_y, x + w, y);
8883 p.endShape();
8886 p.beginShape();
8887 p.vertex(x + w, y);
8888 p.bezierVertex(x + w, y - c_y, 0, x + c_x, y - h, 0, x, y - h, 0);
8889 p.bezierVertex(x - c_x, y - h, 0, x - w, y - c_y, 0, x - w, y, 0);
8890 p.bezierVertex(x - w, y + c_y, 0, x - c_x, y + h, 0, x, y + h, 0);
8891 p.bezierVertex(x + c_x, y + h, 0, x + w, y + c_y, 0, x + w, y, 0);
8892 p.endShape();
8935 p.normal = function normal(nx, ny, nz) {
8957 p.save = function save(file, img) {
8963 return window.open(p.externals.canvas.toDataURL(),"_blank");
9002 return p.get(this);
9004 return p.get(x, y, this);
9006 return p.get(x, y, w, h, this);
9011 p.set(x, y, c, this);
9016 p.blend(this, srcImg, x, y, width, height, dx, dy, dwidth, dheight, this);
9018 p.blend(srcImg, x, y, width, height, dx, dy, dwidth, dheight, MODE, this);
9024 p.blend(this, srcImg, sx, sy, swidth, sheight, dx, dy, dwidth, PConstants.REPLACE, this);
9026p.blend(srcImg, sx, sy, swidth, sheight, dx, dy, dwidth, dheight, PConstants.REPLACE, this);
9032 p.filter(mode, param, this);
9035 p.filter(mode, null, this);
9040 p.save(file,this);
9104 return p.color.toInt(aImg.imageData.data[offset], aImg.imageData.data[offset+1],
9196 p.PImage = PImage;
9198 p.createImage = function createImage(w, h, mode) {
9203 p.loadImage = function loadImage(file, type, callback) {
9239 p.requestImage = p.loadImage;
9243 var c = new PImage(p.width, p.height, PConstants.RGB);
9244 c.fromImageData(curContext.getImageData(0, 0, p.width, p.height));
9251 if (x < p.width && x >= 0 && y >= 0 && y < p.height) {
9253 var offset = ((0|x) + p.width * (0|y))*4;
9254 data = p.imageData.data;
9255 return p.color.toInt(data[offset], data[offset+1],
9261 return p.color.toInt(data[0], data[1], data[2], data[3]);
9274 return p.color.toInt(img.imageData.data[offset],
9308 p.get = function get(x, y, w, h, img) {
9327 p.createGraphics = function createGraphics(w, h, render) {
9342 p.updatePixels();
9362 p.defineProperty(newContext, name, { get: getter, set: setter });
9376 p.loadPixels();
9387 if (x < p.width && x >= 0 && y >= 0 && y < p.height) {
9389 p.pixels.setPixel((0|x)+p.width*(0|y), c);
9399 var c = p.color.toArray(obj);
9409 p.set = function set(x, y, obj, img) {
9416 p.image(obj, x, y);
9423 p.imageData = {};
9428 p.pixels = {
9429 getLength: function() { return p.imageData.data.length ? p.imageData.data.length/4 : 0; },
9432 return (p.imageData.data[offset+3] << 24) & 0xff000000 |
9433 (p.imageData.data[offset+0] << 16) & 0x00ff0000 |
9434 (p.imageData.data[offset+1] << 8) & 0x0000ff00 |
9435 p.imageData.data[offset+2] & 0x000000ff;
9439 p.imageData.data[offset+0] = (c & 0x00ff0000) >>> 16; // RED_MASK
9440 p.imageData.data[offset+1] = (c & 0x0000ff00) >>> 8; // GREEN_MASK
9441 p.imageData.data[offset+2] = (c & 0x000000ff); // BLUE_MASK
9442 p.imageData.data[offset+3] = (c & 0xff000000) >>> 24; // ALPHA_MASK
9452 p.loadPixels = function() {
9454 p.imageData = curContext.getImageData(0, 0, p.width, p.height);
9458 p.updatePixels = function() {
9460 if (p.imageData) {
9461 curContext.putImageData(p.imageData, 0, 0);
9465 p.hint = function hint(which) {
9478 p.background = function background() {
9482 color = p.color.apply(this, arguments);
9491 if (!img.pixels || img.width !== p.width || img.height !== p.height) {
9498 if (p.use3DContext) {
9500 var c = p.color.toGLArray(color);
9513 curContext.clearRect(0,0, p.width, p.height);
9515 curContext.fillStyle = p.color.toString(color);
9516 curContext.fillRect(0, 0, p.width, p.height);
9521 p.image(img, 0, 0);
9529 p.image = function image(img, x, y, w, h) {
9533 if (p.use3DContext) {
9534 p.beginShape(p.QUADS);
9535 p.texture(img.externals.canvas);
9536 p.vertex(x, y, 0, 0, 0);
9537 p.vertex(x, y+hgt, 0, 0, hgt);
9538 p.vertex(x+wid, y+hgt, 0, wid, hgt);
9539 p.vertex(x+wid, y, 0, wid, 0);
9540 p.endShape();
9570 p.clear = function clear(x, y, width, height) {
9572 curContext.clearRect(0, 0, p.width, p.height);
9578 p.tint = function tint() {
9579 var tintColor = p.color.apply(this, arguments);
9580 var r = p.red(tintColor) / colorModeX;
9581 var g = p.green(tintColor) / colorModeY;
9582 var b = p.blue(tintColor) / colorModeZ;
9583 var a = p.alpha(tintColor) / colorModeA;
9597 p.noTint = function noTint() {
9601 p.copy = function copy(src, sx, sy, sw, sh, dx, dy, dw, dh) {
9612 src = p;
9614 p.blend(src, sx, sy, sw, sh, dx, dy, dw, dh, PConstants.REPLACE);
9617 p.blend = function blend(src, sx, sy, sw, sh, dx, dy, dw, dh, mode, pimgdest) {
9629 src = p;
9642 p.loadPixels();
9643 dest = p;
9647 if (src === p) {
9648 if (p.intersect(sx, sy, sx2, sy2, dx, dy, dx2, dy2)) {
9649 p.blit_resize(p.get(sx, sy, sx2 - sx, sy2 - sy), 0, 0, sx2 - sx - 1, sy2 - sy - 1,
9653p.blit_resize(src, sx, sy, sx2, sy2, dest.imageData.data, dest.width, dest.height, dx, dy, dx2, dy…
9657p.blit_resize(src, sx, sy, sx2, sy2, dest.imageData.data, dest.width, dest.height, dx, dy, dx2, dy…
9660 p.updatePixels();
9667 var radius = p.floor(r * 3.5), i, radiusi;
9669 if (p.shared.blurRadius !== radius) {
9670 p.shared.blurRadius = radius;
9671 p.shared.blurKernelSize = 1 + (p.shared.blurRadius<<1);
9672 p.shared.blurKernel = new Array(p.shared.blurKernelSize);
9674 for (i = 0; i < p.shared.blurKernelSize; i++) {
9675 p.shared.blurKernel[i] = 0;
9679 p.shared.blurKernel[radius+i] = p.shared.blurKernel[radiusi] = radiusi * radiusi;
9681 p.shared.blurKernel[radius] = radius * radius;
9701 read = x - p.shared.blurRadius;
9711 for (i = bk0; i < p.shared.blurKernelSize; i++) {
9716 m = p.shared.blurKernel[i];
9734 ym = -p.shared.blurRadius;
9751 for (i = bk0; i < p.shared.blurKernelSize; i++) {
9755 m = p.shared.blurKernel[i];
9895 p.filter = function filter(kind, param, aImg){
9902 p.loadPixels();
9903 img = p;
9947 var levels = p.floor(param);
9977 var thresh = p.floor(param * 255);
9979 …var max = p.max((img.pixels.getPixel(i) & PConstants.RED_MASK) >> 16, p.max((img.pixels.getPixel(i…
9999 p.shared = {
10033 p.intersect = function intersect(sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2) {
10063 p.filter_new_scanline = function filter_new_scanline() {
10064 p.shared.sX = p.shared.srcXOffset;
10065 p.shared.fracV = p.shared.srcYOffset & PConstants.PREC_MAXVAL;
10066 p.shared.ifV = PConstants.PREC_MAXVAL - p.shared.fracV;
10067 p.shared.v1 = (p.shared.srcYOffset >> PConstants.PRECISIONB) * p.shared.iw;
10068p.shared.v2 = Math.min((p.shared.srcYOffset >> PConstants.PRECISIONB) + 1, p.shared.ih1) * p.share…
10071 p.filter_bilinear = function filter_bilinear() {
10072 p.shared.fracU = p.shared.sX & PConstants.PREC_MAXVAL;
10073 p.shared.ifU = PConstants.PREC_MAXVAL - p.shared.fracU;
10074 p.shared.ul = (p.shared.ifU * p.shared.ifV) >> PConstants.PRECISIONB;
10075 p.shared.ll = (p.shared.ifU * p.shared.fracV) >> PConstants.PRECISIONB;
10076 p.shared.ur = (p.shared.fracU * p.shared.ifV) >> PConstants.PRECISIONB;
10077 p.shared.lr = (p.shared.fracU * p.shared.fracV) >> PConstants.PRECISIONB;
10078 p.shared.u1 = (p.shared.sX >> PConstants.PRECISIONB);
10079 p.shared.u2 = Math.min(p.shared.u1 + 1, p.shared.iw1);
10082 var cULoffset = (p.shared.v1 + p.shared.u1) * 4;
10083 var cURoffset = (p.shared.v1 + p.shared.u2) * 4;
10084 var cLLoffset = (p.shared.v2 + p.shared.u1) * 4;
10085 var cLRoffset = (p.shared.v2 + p.shared.u2) * 4;
10086 p.shared.cUL = p.color.toInt(p.shared.srcBuffer[cULoffset], p.shared.srcBuffer[cULoffset+1],
10087 p.shared.srcBuffer[cULoffset+2], p.shared.srcBuffer[cULoffset+3]);
10088 p.shared.cUR = p.color.toInt(p.shared.srcBuffer[cURoffset], p.shared.srcBuffer[cURoffset+1],
10089 p.shared.srcBuffer[cURoffset+2], p.shared.srcBuffer[cURoffset+3]);
10090 p.shared.cLL = p.color.toInt(p.shared.srcBuffer[cLLoffset], p.shared.srcBuffer[cLLoffset+1],
10091 p.shared.srcBuffer[cLLoffset+2], p.shared.srcBuffer[cLLoffset+3]);
10092 p.shared.cLR = p.color.toInt(p.shared.srcBuffer[cLRoffset], p.shared.srcBuffer[cLRoffset+1],
10093 p.shared.srcBuffer[cLRoffset+2], p.shared.srcBuffer[cLRoffset+3]);
10094 p.shared.r = ((p.shared.ul * ((p.shared.cUL & PConstants.RED_MASK) >> 16) + p.shared.ll *
10095 …((p.shared.cLL & PConstants.RED_MASK) >> 16) + p.shared.ur * ((p.shared.cUR & PConstants.RED_MASK)…
10096p.shared.lr * ((p.shared.cLR & PConstants.RED_MASK) >> 16)) << PConstants.PREC_RED_SHIFT) & PConst…
10097p.shared.g = ((p.shared.ul * (p.shared.cUL & PConstants.GREEN_MASK) + p.shared.ll * (p.shared.cLL …
10098 p.shared.ur * (p.shared.cUR & PConstants.GREEN_MASK) + p.shared.lr *
10099 … (p.shared.cLR & PConstants.GREEN_MASK)) >>> PConstants.PRECISIONB) & PConstants.GREEN_MASK;
10100p.shared.b = (p.shared.ul * (p.shared.cUL & PConstants.BLUE_MASK) + p.shared.ll * (p.shared.cLL & …
10101p.shared.ur * (p.shared.cUR & PConstants.BLUE_MASK) + p.shared.lr * (p.shared.cLR & PConstants.BLU…
10102 p.shared.a = ((p.shared.ul * ((p.shared.cUL & PConstants.ALPHA_MASK) >>> 24) + p.shared.ll *
10103 …((p.shared.cLL & PConstants.ALPHA_MASK) >>> 24) + p.shared.ur * ((p.shared.cUR & PConstants.ALPHA_…
10104p.shared.lr * ((p.shared.cLR & PConstants.ALPHA_MASK) >>> 24)) << PConstants.PREC_ALPHA_SHIFT) & P…
10105 return p.shared.a | p.shared.r | p.shared.g | p.shared.b;
10108 p.blit_resize = function blit_resize(img, srcX1, srcY1, srcX2, srcY2, destPixels,
10138 p.shared.srcXOffset = Math.floor(destX1 < 0 ? -destX1 * dx : srcX1 * PConstants.PRECISIONF);
10139 p.shared.srcYOffset = Math.floor(destY1 < 0 ? -destY1 * dy : srcY1 * PConstants.PRECISIONF);
10153 p.shared.srcBuffer = img.imageData.data;
10156 p.shared.iw = img.width;
10157 p.shared.iw1 = img.width - 1;
10158 p.shared.ih1 = img.height - 1;
10162 p.filter_new_scanline();
10165 destColor = p.color.toInt(destPixels[(destOffset + x) * 4],
10169 destColor = p.color.toArray(p.modes.blend(destColor, p.filter_bilinear()));
10175 p.shared.sX += dx;
10178 p.shared.srcYOffset += dy;
10183 p.filter_new_scanline();
10186 destColor = p.color.toInt(destPixels[(destOffset + x) * 4],
10190 destColor = p.color.toArray(p.modes.add(destColor, p.filter_bilinear()));
10191 destColor = p.color.toArray(p.modes.add(destColor, p.filter_bilinear()));
10197 p.shared.sX += dx;
10200 p.shared.srcYOffset += dy;
10205 p.filter_new_scanline();
10208 destColor = p.color.toInt(destPixels[(destOffset + x) * 4],
10212 destColor = p.color.toArray(p.modes.subtract(destColor, p.filter_bilinear()));
10218 p.shared.sX += dx;
10221 p.shared.srcYOffset += dy;
10226 p.filter_new_scanline();
10229 destColor = p.color.toInt(destPixels[(destOffset + x) * 4],
10233 destColor = p.color.toArray(p.modes.lightest(destColor, p.filter_bilinear()));
10239 p.shared.sX += dx;
10242 p.shared.srcYOffset += dy;
10247 p.filter_new_scanline();
10250 destColor = p.color.toInt(destPixels[(destOffset + x) * 4],
10254 destColor = p.color.toArray(p.modes.darkest(destColor, p.filter_bilinear()));
10260 p.shared.sX += dx;
10263 p.shared.srcYOffset += dy;
10268 p.filter_new_scanline();
10271 destColor = p.color.toInt(destPixels[(destOffset + x) * 4],
10275 destColor = p.color.toArray(p.filter_bilinear());
10281 p.shared.sX += dx;
10284 p.shared.srcYOffset += dy;
10289 p.filter_new_scanline();
10292 destColor = p.color.toInt(destPixels[(destOffset + x) * 4],
10296 destColor = p.color.toArray(p.modes.difference(destColor, p.filter_bilinear()));
10302 p.shared.sX += dx;
10305 p.shared.srcYOffset += dy;
10310 p.filter_new_scanline();
10313 destColor = p.color.toInt(destPixels[(destOffset + x) * 4],
10317 destColor = p.color.toArray(p.modes.exclusion(destColor, p.filter_bilinear()));
10323 p.shared.sX += dx;
10326 p.shared.srcYOffset += dy;
10331 p.filter_new_scanline();
10334 destColor = p.color.toInt(destPixels[(destOffset + x) * 4],
10338 destColor = p.color.toArray(p.modes.multiply(destColor, p.filter_bilinear()));
10344 p.shared.sX += dx;
10347 p.shared.srcYOffset += dy;
10352 p.filter_new_scanline();
10355 destColor = p.color.toInt(destPixels[(destOffset + x) * 4],
10359 destColor = p.color.toArray(p.modes.screen(destColor, p.filter_bilinear()));
10365 p.shared.sX += dx;
10368 p.shared.srcYOffset += dy;
10373 p.filter_new_scanline();
10376 destColor = p.color.toInt(destPixels[(destOffset + x) * 4],
10380 destColor = p.color.toArray(p.modes.overlay(destColor, p.filter_bilinear()));
10386 p.shared.sX += dx;
10389 p.shared.srcYOffset += dy;
10394 p.filter_new_scanline();
10397 destColor = p.color.toInt(destPixels[(destOffset + x) * 4],
10401 destColor = p.color.toArray(p.modes.hard_light(destColor, p.filter_bilinear()));
10407 p.shared.sX += dx;
10410 p.shared.srcYOffset += dy;
10415 p.filter_new_scanline();
10418 destColor = p.color.toInt(destPixels[(destOffset + x) * 4],
10422 destColor = p.color.toArray(p.modes.soft_light(destColor, p.filter_bilinear()));
10428 p.shared.sX += dx;
10431 p.shared.srcYOffset += dy;
10436 p.filter_new_scanline();
10439 destColor = p.color.toInt(destPixels[(destOffset + x) * 4],
10443 destColor = p.color.toArray(p.modes.dodge(destColor, p.filter_bilinear()));
10449 p.shared.sX += dx;
10452 p.shared.srcYOffset += dy;
10457 p.filter_new_scanline();
10460 destColor = p.color.toInt(destPixels[(destOffset + x) * 4],
10464 destColor = p.color.toArray(p.modes.burn(destColor, p.filter_bilinear()));
10470 p.shared.sX += dx;
10473 p.shared.srcYOffset += dy;
10485 p.loadFont = function loadFont(name) {
10502 var font = p.loadGlyphs(name);
10516 width += parseFloat(p.glyphLook(p.glyphTable[name], str[i]).horiz_adv_x);
10522 return width / p.glyphTable[name].units_per_em;
10528 p.createFont = function(name, size, smooth, charset) {
10530 p.textSize(size);
10531 return p.loadFont(name);
10534 p.textSize(size);
10535 return p.loadFont(name);
10538 p.textSize(size);
10539 return p.loadFont(name);
10546 p.textFont = function textFont(name, size) {
10548 p.textSize(size);
10552 p.textSize = function textSize(size) {
10558 p.textAlign = function textAlign() {
10567 p.textWidth = function textWidth(str) {
10568 if (p.use3DContext) {
10592 p.textAscent = (function() {
10606 colour = p.color(0),
10615 graphics = p.createGraphics(curTextSize, curTextSize);
10648 p.textDescent = (function() {
10662 colour = p.color(0),
10671 graphics = p.createGraphics(curTextSize, curTextSize);
10705 p.glyphLook = function glyphLook(font, chr) {
10811 return p.nf(obj, 0, 3);
10829 curContext.fillStyle = p.color.toString(currentFillColor);
10859 var font = p.glyphTable[curTextFont.name];
10882 p.glyphLook(font, str[i]).draw();
10960 var lineFunction = p.use3DContext ? text$line$3d : text$line;
11049 var lineFunction = p.use3DContext ? text$line$3d : text$line;
11077 p.text = function text() {
11079 p.pushMatrix();
11080 p.resetMatrix();
11081 var asc = p.textAscent();
11082 var des = p.textDescent();
11083 var tWidth = p.textWidth(arguments[0]);
11085 var font = p.loadFont(curTextFont.origName);
11086 var hud = p.createGraphics(tWidth, tHeight);
11096 p.image(hud, arguments[1], arguments[2]-asc, arguments[3], arguments[4]);
11098 p.image(hud, arguments[1], arguments[2]-asc);
11100 p.popMatrix();
11117 p.textMode = function textMode(mode){
11122 p.loadGlyphs = function loadGlyph(url) {
11238 p.glyphTable[url].horiz_adv_x = font[0].getAttribute("horiz-adv-x");
11241 p.glyphTable[url].units_per_em = parseFloat(font_face.getAttribute("units-per-em"));
11242 p.glyphTable[url].ascent = parseFloat(font_face.getAttribute("ascent"));
11243 p.glyphTable[url].descent = parseFloat(font_face.getAttribute("descent"));
11255 horiz_adv_x = p.glyphTable[url].horiz_adv_x;
11263 p.glyphTable[url][name] = {
11306 p.glyphTable[url] = {};
11312 return p.glyphTable[url];
11319 p.extendClass = function extendClass(subClass, baseClass) {
11321 p.defineProperty(subClass, propertyName, {
11342 p.addMethod = function addMethod(object, name, fn, superAccessor) {
11375 p.pmouseX = p.mouseX;
11376 p.pmouseY = p.mouseY;
11394 p.mouseX = e.pageX - offsetX;
11395 p.mouseY = e.pageY - offsetY;
11397 if (typeof p.mouseMoved === "function" && !p.__mousePressed) {
11398 p.mouseMoved();
11400 if (typeof p.mouseDragged === "function" && p.__mousePressed) {
11401 p.mouseDragged();
11402 p.mouseDragging = true;
11410 p.__mousePressed = true;
11411 p.mouseDragging = false;
11414 p.mouseButton = PConstants.LEFT;
11417 p.mouseButton = PConstants.CENTER;
11420 p.mouseButton = PConstants.RIGHT;
11424 if (typeof p.mousePressed === "function") {
11425 p.mousePressed();
11430 p.__mousePressed = false;
11432 if (typeof p.mouseClicked === "function" && !p.mouseDragging) {
11433 p.mouseClicked();
11436 if (typeof p.mouseReleased === "function") {
11437 p.mouseReleased();
11453 p.mouseScroll = delta;
11455 if (delta && typeof p.mouseScrolled === 'function') {
11456 p.mouseScrolled();
11511 p.keyCode = code;
11555 p.__keyPressed = true;
11556 p.keyCode = null;
11557 p.key = keyCodeMap(e.keyCode, e.shiftKey);
11559 if (typeof p.keyPressed === "function") {
11560 p.keyPressed();
11565 p.keyCode = null;
11566 p.key = keyCodeMap(e.keyCode, e.shiftKey);
11569 p.__keyPressed = false;
11571 if (typeof p.keyReleased === "function") {
11572 p.keyReleased();
11584 if (p.keyTyped) {
11585 p.keyTyped();
11611 p.externals.sketch = curSketch;
11613 p.use3DContext = curSketch.use3DContext;
11621 p.externals.onfocus = function() {
11623 p.loop();
11627 p.externals.onblur = function() {
11629 p.noLoop();
11640 p.externals.context = curContext;
11651 p.stroke(0);
11652 p.fill(255);
11653 p.noSmooth();
11654 p.disableContextMenu();
11692 executeSketch(p);
12455 function getScopeLevel(p) { argument
12457 while(p) {
12459 p=p.scope;