diff options
author | Kushal K S V S <kkushal32@gmail.com> | 2017-08-24 04:08:34 -0700 |
---|---|---|
committer | Kushal K S V S <kkushal32@gmail.com> | 2017-08-24 04:08:34 -0700 |
commit | 088c73bb9d5ac52e08311f74ff49f74c0f91105c (patch) | |
tree | 4b785171cca8dafe36efdb4487ecbbcdc54df1fe /tests/make_png/html/scripts/top.js | |
parent | 3223dc41552c21dd2f1a7769f3c557db63c080f8 (diff) | |
download | freetype2-kushal-work.tar.gz |
Generating Pages and Sprite animation [Testing]kushal-work
Diffstat (limited to 'tests/make_png/html/scripts/top.js')
-rw-r--r-- | tests/make_png/html/scripts/top.js | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/tests/make_png/html/scripts/top.js b/tests/make_png/html/scripts/top.js new file mode 100644 index 000000000..a7d833731 --- /dev/null +++ b/tests/make_png/html/scripts/top.js @@ -0,0 +1,82 @@ +function change() { + var dpi = document.getElementById('dpi').value; + var font = document.getElementById('font').value; + var mode = document.getElementById('mode').value; + var size = document.getElementById('size').value; + var frame = document.getElementById('frame_1'); + var string = "pages/"+dpi+"/"+font+"/"+mode+"/"+size+"/index.html"; + frame.src = string; +} + +var people, asc1 = 1,asc2 = 1,asc3 = 1; + +function sort_t(tbody, col, asc){ + var rows = tbody.rows, rlen = rows.length, arr = new Array(), i, j, cells, clen; + // fill the array with values from the table + for(i = 0; i < rlen; i++){ + cells = rows[i].cells; + clen = cells.length; + arr[i] = new Array(); + for(j = 0; j < clen; j++){ + arr[i][j] = cells[j].innerHTML; + } + } + // sort the array by the specified column number (col) and order (asc) + arr.sort(function(a, b){ + return (a[col] == b[col]) ? 0 : ((a[col] > b[col]) ? asc : -1*asc); + }); + for(i = 0; i < rlen; i++){ + arr[i] = "<td>"+arr[i].join("</td><td>")+"</timaged>"; + } + tbody.innerHTML = "<tr>"+arr.join("</tr><tr>")+"</tr>"; +} + +function frame_2_source(image){ + var path = "url("+image.src+")"; + + var fr_2 = parent.frame_2.document; + + var div = fr_2.getElementById('animation'); + div.style.backgroundImage=path; +} + +function set_dim() { + + var imageSrc = document + .getElementById('animation') + .style + .backgroundImage + .replace(/url\((['"])?(.*?)\1\)/gi, '$2') + .split(',')[0]; + + var image = new Image(); + image.src = imageSrc; + + var src_w = image.width; + var src_h = image.height; + + var win_w = window.innerWidth; + var win_h = window.innerHeight-60; + + var r_w = (win_w/(src_w/4)).toString(); + r_w = parseInt(r_w); + + var r_h = (win_h/src_h).toString(); + r_h = parseInt(r_h); + + var div_w = 0; + var div_h = 0; + + if (r_w > r_h) + { + div_w = src_w * r_h; + div_h = src_h * r_h; + } else { + div_w = src_w * r_w; + div_h = src_h * r_w; + } + + document.getElementById('animation').style.width= div_w/4 + "px"; + + document.getElementById('animation').style.height= div_h + "px"; +}
\ No newline at end of file |