aboutsummaryrefslogtreecommitdiff
path: root/static/js/wpaint/test
diff options
context:
space:
mode:
Diffstat (limited to 'static/js/wpaint/test')
-rw-r--r--static/js/wpaint/test/dev.html123
-rw-r--r--static/js/wpaint/test/fullscreen.html79
-rw-r--r--static/js/wpaint/test/upload.php11
-rw-r--r--static/js/wpaint/test/uploads/test1.pngbin0 -> 432 bytes
-rw-r--r--static/js/wpaint/test/uploads/test2.pngbin0 -> 462 bytes
-rw-r--r--static/js/wpaint/test/uploads/test3.pngbin0 -> 454 bytes
-rw-r--r--static/js/wpaint/test/uploads/wPaint.pngbin0 -> 3096 bytes
7 files changed, 213 insertions, 0 deletions
diff --git a/static/js/wpaint/test/dev.html b/static/js/wpaint/test/dev.html
new file mode 100644
index 0000000..b9cd1bf
--- /dev/null
+++ b/static/js/wpaint/test/dev.html
@@ -0,0 +1,123 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width" />
+
+ <title>Websanova :: wPaint</title>
+
+ <link rel="icon" type="image/vnd.microsoft.icon" href="./demo/img/favicon.ico" />
+ <script type="text/javascript" src="../lib/jquery.1.10.2.min.js"></script>
+</head>
+<body>
+
+ <!-- jQuery UI -->
+ <script type="text/javascript" src="../lib/jquery.ui.core.1.10.3.min.js"></script>
+ <script type="text/javascript" src="../lib/jquery.ui.widget.1.10.3.min.js"></script>
+ <script type="text/javascript" src="../lib/jquery.ui.mouse.1.10.3.min.js"></script>
+ <script type="text/javascript" src="../lib/jquery.ui.draggable.1.10.3.min.js"></script>
+
+ <!-- wColorPicker -->
+ <link rel="Stylesheet" type="text/css" href="../lib/wColorPicker.min.css" />
+ <script type="text/javascript" src="../lib/wColorPicker.min.js"></script>
+
+ <!-- wPaint -->
+ <link rel="Stylesheet" type="text/css" href="../src/wPaint.css" />
+ <script type="text/javascript" src="../src/wPaint.utils.js"></script>
+ <script type="text/javascript" src="../src/wPaint.js"></script>
+
+ <!-- wPaint main -->
+ <script type="text/javascript" src="../plugins/main/src/fillArea.min.js"></script>
+ <script type="text/javascript" src="../plugins/main/src/wPaint.menu.main.js"></script>
+
+ <!-- wPaint text -->
+ <script type="text/javascript" src="../plugins/text/src/wPaint.menu.text.js"></script>
+
+ <!-- wPaint shapes -->
+ <script type="text/javascript" src="../plugins/shapes/src/shapes.min.js"></script>
+ <script type="text/javascript" src="../plugins/shapes/src/wPaint.menu.main.shapes.js"></script>
+
+ <!-- wPaint file -->
+ <script type="text/javascript" src="../plugins/file/src/wPaint.menu.main.file.js"></script>
+
+ <div id="wPaint-demo1" style="position:relative; width:500px; height:200px; background-color:#7a7a7a; margin:70px auto 20px auto;"></div>
+
+ <center style="margin-bottom: 50px;">
+ <input type="button" value="toggle menu" onclick="console.log($('#wPaint-demo1').wPaint('menuOrientation')); $('#wPaint-demo1').wPaint('menuOrientation', $('#wPaint-demo1').wPaint('menuOrientation') === 'vertical' ? 'horizontal' : 'vertical');"/>
+ </center>
+
+ <center id="wPaint-img"></center>
+
+ <script type="text/javascript">
+ var images = [
+ '/test/uploads/wPaint.png',
+ ];
+
+ function saveImg(image) {
+ var _this = this;
+
+ $.ajax({
+ type: 'POST',
+ url: '/test/upload.php',
+ data: {image: image},
+ success: function (resp) {
+
+ // internal function for displaying status messages in the canvas
+ _this._displayStatus('Image saved successfully');
+
+ // doesn't have to be json, can be anything
+ // returned from server after upload as long
+ // as it contains the path to the image url
+ // or a base64 encoded png, either will work
+ resp = $.parseJSON(resp);
+
+ // update images array / object or whatever
+ // is being used to keep track of the images
+ // can store path or base64 here (but path is better since it's much smaller)
+ images.push(resp.img);
+
+ // do something with the image
+ $('#wPaint-img').append($('<img/>').attr('src', image));
+ }
+ });
+ }
+
+ function loadImgBg () {
+
+ // internal function for displaying background images modal
+ // where images is an array of images (base64 or url path)
+ // NOTE: that if you can't see the bg image changing it's probably
+ // becasue the foregroud image is not transparent.
+ this._showFileModal('bg', images);
+ }
+
+ function loadImgFg () {
+
+ // internal function for displaying foreground images modal
+ // where images is an array of images (base64 or url path)
+ this._showFileModal('fg', images);
+ }
+
+ function createCallback(cbName) {
+ return function() {
+ if (console) {
+ console.log(cbName, arguments);
+ }
+ }
+ }
+
+ // init wPaint
+ $('#wPaint-demo1').wPaint({
+ menuOffsetLeft: -35,
+ menuOffsetTop: -50,
+ saveImg: saveImg,
+ loadImgBg: loadImgBg,
+ loadImgFg: loadImgFg,
+ onShapeDown: createCallback('onShapeDown'),
+ onShapeUp: createCallback('onShapeUp'),
+ onShapeMove: createCallback('onShapeDMove')
+ });
+ </script>
+
+</body>
+</html> \ No newline at end of file
diff --git a/static/js/wpaint/test/fullscreen.html b/static/js/wpaint/test/fullscreen.html
new file mode 100644
index 0000000..91b3e15
--- /dev/null
+++ b/static/js/wpaint/test/fullscreen.html
@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width" />
+
+ <title>Websanova :: Paint</title>
+
+ <script type="text/javascript" src="../lib/jquery.1.10.2.min.js"></script>
+</head>
+<body>
+ <!-- jQuery UI -->
+ <script type="text/javascript" src="../lib/jquery.ui.core.1.10.3.min.js"></script>
+ <script type="text/javascript" src="../lib/jquery.ui.widget.1.10.3.min.js"></script>
+ <script type="text/javascript" src="../lib/jquery.ui.mouse.1.10.3.min.js"></script>
+ <script type="text/javascript" src="../lib/jquery.ui.draggable.1.10.3.min.js"></script>
+
+ <!-- wColorPicker -->
+ <link rel="Stylesheet" type="text/css" href="../lib/wColorPicker.min.css" />
+ <script type="text/javascript" src="../lib/wColorPicker.min.js"></script>
+
+ <!-- wPaint -->
+ <link rel="Stylesheet" type="text/css" href="../src/wPaint.css" />
+ <script type="text/javascript" src="../src/wPaint.utils.js"></script>
+ <script type="text/javascript" src="../src/wPaint.js"></script>
+
+ <!-- wPaint main -->
+ <script type="text/javascript" src="../plugins/main/src/fillArea.min.js"></script>
+ <script type="text/javascript" src="../plugins/main/src/wPaint.menu.main.js"></script>
+
+ <!-- wPaint text -->
+ <script type="text/javascript" src="../plugins/text/src/wPaint.menu.text.js"></script>
+
+ <!-- wPaint shapes -->
+ <script type="text/javascript" src="../plugins/shapes/src/shapes.min.js"></script>
+ <script type="text/javascript" src="../plugins/shapes/src/wPaint.menu.main.shapes.js"></script>
+
+ <!-- wPaint file -->
+ <script type="text/javascript" src="../plugins/file/src/wPaint.menu.main.file.js"></script>
+
+ <div id="wPaint" style="position:relative; width:200px; height:200px; background:#CACACA;"></div>
+
+ <style>
+ body, html {
+ margin: 0px;
+ overflow: hidden;
+ }
+ </style>
+
+ <script type="text/javascript">
+
+ // update elements dimensions
+ // call wPaint('resize')
+ $(window).resize(function () {
+ $('#wPaint').css({
+ width: $(window).width(),
+ height: $(window).height()
+ })
+ .wPaint('resize');
+ })
+
+ // init size based on browser dimensions
+ $(window).resize();
+
+ // set test image
+ // get from tapping enter below
+ $('#wPaint').wPaint({
+ image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABAYAAAErCAYAAABNUIGWAAARs0lEQVR4nO3dzY4dV7UH8PUkvMh9CXgC9yATBr5vgMSAGSNGSJdRELN7lUQRwys5EoMgpCsEkWywxFWIMCDHOI4SN273x2LgOnT1PlWnz8euj3Pq95OOlNh99l51Plpe/9q1KwIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA4V/ilvYw30ZUiAAAAABJRU5ErkJggg=='
+ });
+
+ // get an image for testing (just tap enter key)
+ $(document).keypress(function (e) {
+ if (e.keyCode === 13) {
+ console.log($('#wPaint').wPaint('image'));
+ }
+ });
+ </script>
+</body>
+</html> \ No newline at end of file
diff --git a/static/js/wpaint/test/upload.php b/static/js/wpaint/test/upload.php
new file mode 100644
index 0000000..f0187b5
--- /dev/null
+++ b/static/js/wpaint/test/upload.php
@@ -0,0 +1,11 @@
+<?php
+
+$image = imagecreatefrompng($_POST['image']);
+$id = uniqid();
+
+imagealphablending($image, false);
+imagesavealpha($image, true);
+imagepng($image, 'uploads/wPaint-' . $id . '.png');
+
+// return image path
+echo '{"img": "/test/uploads/wPaint-' . $id . '.png"}';
diff --git a/static/js/wpaint/test/uploads/test1.png b/static/js/wpaint/test/uploads/test1.png
new file mode 100644
index 0000000..a0c6511
--- /dev/null
+++ b/static/js/wpaint/test/uploads/test1.png
Binary files differ
diff --git a/static/js/wpaint/test/uploads/test2.png b/static/js/wpaint/test/uploads/test2.png
new file mode 100644
index 0000000..68c25e0
--- /dev/null
+++ b/static/js/wpaint/test/uploads/test2.png
Binary files differ
diff --git a/static/js/wpaint/test/uploads/test3.png b/static/js/wpaint/test/uploads/test3.png
new file mode 100644
index 0000000..c92d3cc
--- /dev/null
+++ b/static/js/wpaint/test/uploads/test3.png
Binary files differ
diff --git a/static/js/wpaint/test/uploads/wPaint.png b/static/js/wpaint/test/uploads/wPaint.png
new file mode 100644
index 0000000..c19ab7f
--- /dev/null
+++ b/static/js/wpaint/test/uploads/wPaint.png
Binary files differ