TheDesk Riina (ver.3)

This commit is contained in:
cutls
2018-02-19 02:41:25 +09:00
parent 0ada3a03b0
commit 7a1c6ea17c
997 changed files with 161887 additions and 34 deletions

2
app/node_modules/jimp/browser/.editorconfig generated vendored Normal file
View File

@@ -0,0 +1,2 @@
# Exclude this directory
root = true

71
app/node_modules/jimp/browser/README.md generated vendored Normal file
View File

@@ -0,0 +1,71 @@
# Jimp ... in a browser #
Browser support for Jimp was added by Phil Seaton. This enabled Jimp to be used in [Electron](http://electron.atom.io/) applications as well as web browsers.
Example usage:
```html
<script src="jimp.min.js"></script>
<script>
Jimp.read("lenna.png").then(function (lenna) {
lenna.resize(256, 256) // resize
.quality(60) // set JPEG quality
.greyscale() // set greyscale
.getBase64(Jimp.MIME_JPEG, function (err, src) {
var img = document.createElement("img");
img.setAttribute("src", src);
document.body.appendChild(img);
});
}).catch(function (err) {
console.error(err);
});
</script>
```
See the [main documentation](https://github.com/oliver-moran/jimp) for the full API documenatinon.
## WebWorkers ##
For better performance, it recommended that Jimp methods are run on a separate thread using [`WebWorkers`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers). The following shows how using two files (`index.html` and `jimp-worker.js`):
```js
// index.html
var worker = new Worker("jimp-worker.js");
worker.onmessage = function (e) {
// append a new img element using the base 64 image
var img = document.createElement("img");
img.setAttribute("src", e.data);
document.body.appendChild(img);
};
worker.postMessage("lenna.png"); // message the worker thread
```
```js
// jimp-worker.js
importScripts("jimp.min.js");
self.addEventListener("message", function(e) {
Jimp.read(e.data).then(function (lenna) {
lenna.resize(256, 256) // resize
.quality(60) // set JPEG quality
.greyscale() // set greyscale
.getBase64(Jimp.MIME_JPEG, function (err, src) {
self.postMessage(src); // message the main thread
});
});
});
```
## CDN ##
CDN access to the minified library is available through the [RawGit CDN](https://rawgit.com/):
```html
<script src="https://cdn.rawgit.com/oliver-moran/jimp/v0.2.28/browser/lib/jimp.min.js"></script>
```
## License ##
Jimp is licensed under the MIT license.

47
app/node_modules/jimp/browser/browserify-build.sh generated vendored Normal file
View File

@@ -0,0 +1,47 @@
#!/bin/sh
# This mechanism could offer simple variations on the build.
# Features could be productively grouped for smaller file size
# eg: I/O, Affine Transforms, Bitmap Operations, Gamma Curves, and Layers
# Initial Build includes everything except file IO, which is browser-incompatible
cd ${0%/*}
echo "Browserifying index.js..."
ENVIRONMENT=BROWSER \
browserify --ignore-missing Buffer -t envify -t uglifyify ../index.js > tmp1.js
echo "Translating for ES5..."
babel tmp1.js -o tmp.js --presets es2015,stage-0
# A TRUE hack. Use strict at the top seems to cause problems for ie10 interpreting this line from bmp-js:
# https://github.com/shaozilee/bmp-js/blob/master/lib/decoder.js
# module.exports = decode = function(bmpData) { ...
# For some reason, babeljs misses this "error" but IE can parse the code fine without strict mode.
echo "Removing Strict Mode."
sed -E "s/^\"use strict\";|ret=Z_BUF_ERROR;//" tmp.js > tmp-nostrict.js
echo "Adding Web Worker wrapper functions..."
cat tmp-nostrict.js src/jimp-wrapper.js > tmp.jimp.js
echo "Minifying browser/jimp.min.js..."
# uglifyjs tmp.jimp.js --compress warnings=false --mangle -o tmp.jimp.min.js
npm run-script minify-jimp
echo "Including the License and version number in the jimp.js and jimp.min.js"
PACKAGE_VERSION=$(cat ../package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[", ]//g')
{ echo "/*";
echo "Jimp v$PACKAGE_VERSION";
echo "https://github.com/oliver-moran/jimp";
echo "Ported for the Web by Phil Seaton";
echo "";
cat ../LICENSE;
echo "*/";
echo ""; } > tmp.web_license.txt
(cat tmp.web_license.txt ; echo "var window = window || self;" ; cat tmp.jimp.js; ) > lib/jimp.js
(cat tmp.web_license.txt ; echo "var window = window || self;" ; cat tmp.jimp.min.js; ) > lib/jimp.min.js
echo "Updating package version in README.md"
sed -i.bak "s/v[0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*/v$PACKAGE_VERSION/g" README.md; rm README.md.bak
echo "Cleaning up...."
rm tmp*

BIN
app/node_modules/jimp/browser/examples/dice.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

24
app/node_modules/jimp/browser/examples/example1.html generated vendored Normal file
View File

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<title>Jimp browser example 1</title>
</head>
<body>
<!-- Demonstrates loading a local file using Jimp on the main thread -->
<script src="../lib/jimp.min.js"></script>
<script>
Jimp.read("https://upload.wikimedia.org/wikipedia/commons/0/01/Bot-Test.jpg").then(function (lenna) {
lenna.resize(256, Jimp.AUTO) // resize
.quality(60) // set JPEG quality
.greyscale() // set greyscale
.getBase64(Jimp.AUTO, function (err, src) {
var img = document.createElement("img");
img.setAttribute("src", src);
document.body.appendChild(img);
});
});
</script>
</body>
</html>

20
app/node_modules/jimp/browser/examples/example2.html generated vendored Normal file
View File

@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<title>Jimp browser example 2</title>
</head>
<body>
<!-- Demonstrates loading a relative file using Jimp on a WebWorker thread -->
<script>
var worker = new Worker("jimp-worker.js");
worker.onmessage = function (e) {
var img = document.createElement("img");
img.setAttribute("src", e.data);
document.body.appendChild(img);
};
worker.postMessage("lenna.png");
</script>
</body>
</html>

35
app/node_modules/jimp/browser/examples/example3.html generated vendored Normal file
View File

@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<title>Jimp browser example 3</title>
</head>
<body>
<!-- Demonstrates loading a local file using Jimp on a WebWorker thread -->
<p><input type="file" onchange="newFiles(this);" /></p>
<script>
function newFiles(element){
for (var i=0; i<element.files.length; i++) {
readFileAndProcess(element.files[i]);
}
function readFileAndProcess(readfile){
var reader = new FileReader();
reader.addEventListener("load", function(){
var worker = new Worker("jimp-worker.js");
worker.onmessage = function (e) {
var img = document.createElement("img");
img.setAttribute("src", e.data);
document.body.appendChild(img);
};
worker.postMessage(this.result);
});
reader.readAsArrayBuffer(readfile);
}
}
</script>
</body>
</html>

13
app/node_modules/jimp/browser/examples/jimp-worker.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
importScripts("../lib/jimp.min.js");
self.addEventListener("message", function(e) {
Jimp.read(e.data).then(function (lenna) {
lenna.resize(256, Jimp.AUTO) // resize
.quality(60) // set JPEG quality
.greyscale() // set greyscale
.getBase64(Jimp.AUTO, function (err, src) {
self.postMessage(src);
self.close();
});
});
});

BIN
app/node_modules/jimp/browser/examples/lenna.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 KiB

43
app/node_modules/jimp/browser/examples/test.html generated vendored Normal file
View File

@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<title>Jimp browser example 1</title>
</head>
<body>
<!-- Demonstrates loading a local file using Jimp on the main thread -->
<script src="../lib/jimp.min.js"></script>
<script>
function dropShadow(x, y, b, a) {
var img = new Jimp(this.bitmap.width + Math.abs(x*2) + (b*2), this.bitmap.height + Math.abs(y*2) + (b*2));
var orig = this.clone();
this.scan(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
this.bitmap.data[ idx + 0 ] = 0;
this.bitmap.data[ idx + 1 ] = 0;
this.bitmap.data[ idx + 2 ] = 0;
this.bitmap.data[ idx + 3 ] = this.bitmap.data[ idx + 3 ] * a;
});
// this.resize(this.bitmap.width + Math.abs(x) + b, this.bitmap.height + Math.abs(y) + b);
var x1 = Math.max(x * -1, 0) + b;
var y1 = Math.max(y * -1, 0) + b;
img.composite(this, x1, y1);
img.blur(b);
img.composite(orig, x1 - x, y1 - y);
//img.autocrop();
return img;
}
Jimp.read("dice.png").then(function (img) {
console.log(img.getMIME(), img.getExtension());
var img = dropShadow.call(img, 20, 20, 20, 0.3)
img.getBase64(Jimp.AUTO, function (err, src) {
var img = document.createElement("img");
img.setAttribute("src", src);
document.body.appendChild(img);
});
});
</script>
</body>
</html>

128
app/node_modules/jimp/browser/lib/jimp.js generated vendored Normal file
View File

@@ -0,0 +1,128 @@
/*
Jimp v0.2.28
https://github.com/oliver-moran/jimp
Ported for the Web by Phil Seaton
The MIT License (MIT)
Copyright (c) 2014 Oliver Moran
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
var window = window || self;
// The MIT License (MIT)
//
// Copyright (c) 2015 Phil Seaton
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
if (!self.Buffer && !window.Buffer){
throw new Error("Node's Buffer() not available");
} else if (!self.Jimp && !window.Jimp) {
throw new Error("Could not Jimp object");
}
(function(){
function fetchImageDataFromUrl(url, cb) {
// Fetch image data via xhr. Note that this will not work
// without cross-domain allow-origin headers because of CORS restrictions
var xhr = new XMLHttpRequest();
xhr.open( "GET", url, true );
xhr.responseType = "arraybuffer";
xhr.onload = function() {
if (xhr.status < 400) cb(this.response,null);
else cb(null,"HTTP Status " + xhr.status + " for url "+url);
};
xhr.onerror = function(e){
cb(null,e);
};
xhr.send();
};
function bufferFromArrayBuffer(arrayBuffer) {
// Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion,
// But this function is not useful when running in node directly
var buffer = new Buffer(arrayBuffer.byteLength);
var view = new Uint8Array(arrayBuffer);
for (var i = 0; i < buffer.length; ++i) {
buffer[i] = view[i];
}
return buffer;
}
function isArrayBuffer(test) {
return Object.prototype.toString.call(test).toLowerCase().indexOf("arraybuffer") > -1;
}
// delete the write method
delete Jimp.prototype.write;
// Override the nodejs implementation of Jimp.read()
delete Jimp.read;
Jimp.read = function(src, cb) {
return new Promise(function(resolve, reject) {
cb = cb || function(err, image) {
if (err) reject(err);
else resolve(image);
};
if ("string" == typeof src) {
// Download via xhr
fetchImageDataFromUrl(src,function(arrayBuffer,error){
if (arrayBuffer) {
if (!isArrayBuffer(arrayBuffer)) {
cb(new Error("Unrecognized data received for " + src));
} else {
new Jimp(bufferFromArrayBuffer(arrayBuffer),cb);
}
} else if (error) {
cb(error);
}
});
} else if (isArrayBuffer(src)) {
// src is an ArrayBuffer already
new Jimp(bufferFromArrayBuffer(src), cb);
} else {
// src is not a string or ArrayBuffer
cb(new Error("Jimp expects a single ArrayBuffer or image URL"));
}
});
}
})();

30
app/node_modules/jimp/browser/lib/jimp.min.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
/*
Jimp v0.2.28
https://github.com/oliver-moran/jimp
Ported for the Web by Phil Seaton
The MIT License (MIT)
Copyright (c) 2014 Oliver Moran
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
var window = window || self;
if(!self.Buffer&&!window.Buffer)throw new Error("Node's Buffer() not available");if(!self.Jimp&&!window.Jimp)throw new Error("Could not Jimp object");!function(){function e(e,r){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){n.status<400?r(this.response,null):r(null,"HTTP Status "+n.status+" for url "+e)},n.onerror=function(e){r(null,e)},n.send()}function r(e){for(var r=new Buffer(e.byteLength),n=new Uint8Array(e),t=0;t<r.length;++t)r[t]=n[t];return r}function n(e){return Object.prototype.toString.call(e).toLowerCase().indexOf("arraybuffer")>-1}delete Jimp.prototype.write,delete Jimp.read,Jimp.read=function(t,o){return new Promise(function(i,f){o=o||function(e,r){e?f(e):i(r)},"string"==typeof t?e(t,function(e,i){e?n(e)?new Jimp(r(e),o):o(new Error("Unrecognized data received for "+t)):i&&o(i)}):n(t)?new Jimp(r(t),o):o(new Error("Jimp expects a single ArrayBuffer or image URL"))})}}();

99
app/node_modules/jimp/browser/src/jimp-wrapper.js generated vendored Normal file
View File

@@ -0,0 +1,99 @@
// The MIT License (MIT)
//
// Copyright (c) 2015 Phil Seaton
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
if (!self.Buffer && !window.Buffer){
throw new Error("Node's Buffer() not available");
} else if (!self.Jimp && !window.Jimp) {
throw new Error("Could not Jimp object");
}
(function(){
function fetchImageDataFromUrl(url, cb) {
// Fetch image data via xhr. Note that this will not work
// without cross-domain allow-origin headers because of CORS restrictions
var xhr = new XMLHttpRequest();
xhr.open( "GET", url, true );
xhr.responseType = "arraybuffer";
xhr.onload = function() {
if (xhr.status < 400) cb(this.response,null);
else cb(null,"HTTP Status " + xhr.status + " for url "+url);
};
xhr.onerror = function(e){
cb(null,e);
};
xhr.send();
};
function bufferFromArrayBuffer(arrayBuffer) {
// Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion,
// But this function is not useful when running in node directly
var buffer = new Buffer(arrayBuffer.byteLength);
var view = new Uint8Array(arrayBuffer);
for (var i = 0; i < buffer.length; ++i) {
buffer[i] = view[i];
}
return buffer;
}
function isArrayBuffer(test) {
return Object.prototype.toString.call(test).toLowerCase().indexOf("arraybuffer") > -1;
}
// delete the write method
delete Jimp.prototype.write;
// Override the nodejs implementation of Jimp.read()
delete Jimp.read;
Jimp.read = function(src, cb) {
return new Promise(function(resolve, reject) {
cb = cb || function(err, image) {
if (err) reject(err);
else resolve(image);
};
if ("string" == typeof src) {
// Download via xhr
fetchImageDataFromUrl(src,function(arrayBuffer,error){
if (arrayBuffer) {
if (!isArrayBuffer(arrayBuffer)) {
cb(new Error("Unrecognized data received for " + src));
} else {
new Jimp(bufferFromArrayBuffer(arrayBuffer),cb);
}
} else if (error) {
cb(error);
}
});
} else if (isArrayBuffer(src)) {
// src is an ArrayBuffer already
new Jimp(bufferFromArrayBuffer(src), cb);
} else {
// src is not a string or ArrayBuffer
cb(new Error("Jimp expects a single ArrayBuffer or image URL"));
}
});
}
})();