{"id":120,"date":"2010-06-23T08:29:26","date_gmt":"2010-06-23T15:29:26","guid":{"rendered":"http:\/\/patternweaver.com\/blog\/?p=120"},"modified":"2010-07-01T06:36:13","modified_gmt":"2010-07-01T06:36:13","slug":"imagebooth-demo-2-html5-js-image-editor","status":"publish","type":"post","link":"http:\/\/patternweaver.com\/blog\/2010\/06\/imagebooth-demo-2-html5-js-image-editor\/","title":{"rendered":"ImageBooth Demo 2: HTML5 + JS Image Editor"},"content":{"rendered":"<p>After another week working on the ImageBooth JS port, I&#8217;ve had a number of successes so almost all the core interfaces are available, and there is now a brushing system which doesn&#8217;t exist on the PHP version. Go ahead and check out the <a href=\"http:\/\/patternweaver.com\/ImageBoothJS2\/\">demo<\/a>(works under webkit, slightly janky under FF, not working under IE).<\/p>\n<p>All of the GUI uses the internal ImageBooth Registry, so if you create your own component it just appears in the GUI. The base classes are as follows:<\/p>\n<pre><code>var ImBo_Brush = new Class({\r\n    name : function(){\r\n        return '';\r\n    },\r\n    \/\/ 5 x 5, fully opaque, square\r\n    brush : [\r\n        [255]\r\n    ],\r\n    getBrush : function(){\r\n        return this.brush;\r\n    }\r\n});\r\n\r\nvar ImBo_Tool = new Class({\r\n    name : function(){\r\n        return '';\r\n    },\r\n    paint: function(brush, pixels, x, y){\r\n    },\r\n    getToolIcon : function(){\r\n        return 'Graphics\/Tools\/missing.png';\r\n    }\r\n});\r\n\r\nvar ImBo_Operation = new Class({\r\n    name : function(){\r\n        return '';\r\n    },\r\n    operate: function(pixels, controls){\r\n        \/\/this is the key method to override\r\n    },\r\n    getControls : function(){\r\n        return [];\r\n    },\r\n    getLabel : function(){\r\n        return this.name();\r\n    }\r\n});\r\n\r\nvar ImBo_Filter = new Class({\r\n    name : function(){\r\n        return '';\r\n    },\r\n    filter: function(layer, controls){\r\n        \/\/this is the key method to override\r\n    },\r\n    getControls : function(){\r\n        return [];\r\n    },\r\n    getLabel : function(){\r\n        return this.name();\r\n    }\r\n});<\/code><\/pre>\n<p>A particular brush looks like:<\/p>\n<pre><code>var ImBo_5px_Square_Brush = new Class({\r\n    Extends : ImBo_Brush,\r\n    name : function(){\r\n        return '5px_square';\r\n    },\r\n    brush : [\r\n        [255, 255, 255, 255, 255],\r\n        [255, 255, 255, 255, 255],\r\n        [255, 255, 255, 255, 255],\r\n        [255, 255, 255, 255, 255],\r\n        [255, 255, 255, 255, 255],\r\n    ]\r\n});<\/code><\/pre>\n<p>Then, to make the brush available:<\/p>\n<p><code>ImageBooth.registerBrush(new ImBo_5px_Square_Brush());<\/code><\/p>\n<p>Should be simple enough, here is some output from it:\n\t\t\t<div id='gallery-120-1' class='gallery gallery-120'>\n\t\t\t\t<div class='gallery-row gallery-clear'>\n\t\t\t\t\t<dl class='gallery-item col-3'>\n\t\t\t\t\t\t<dt class='gallery-icon'><a href='http:\/\/patternweaver.com\/blog\/2010\/06\/imagebooth-demo-2-html5-js-image-editor\/http___localhost_datalus-js_-3\/'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/patternweaver.com\/blog\/wp-content\/uploads\/2010\/06\/http___localhost_Datalus.js_-31-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a><\/dt>\n\t\t\t\t\t<\/dl>\n\t\t\t\t\t<dl class='gallery-item col-3'>\n\t\t\t\t\t\t<dt class='gallery-icon'><a href='http:\/\/patternweaver.com\/blog\/2010\/06\/imagebooth-demo-2-html5-js-image-editor\/http___localhost_datalus-js_-1\/'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/patternweaver.com\/blog\/wp-content\/uploads\/2010\/06\/http___localhost_Datalus.js_-11-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a><\/dt>\n\t\t\t\t\t<\/dl>\n\t\t\t\t\t<dl class='gallery-item col-3'>\n\t\t\t\t\t\t<dt class='gallery-icon'><a href='http:\/\/patternweaver.com\/blog\/2010\/06\/imagebooth-demo-2-html5-js-image-editor\/http___localhost_datalus-js_-4\/'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/patternweaver.com\/blog\/wp-content\/uploads\/2010\/06\/http___localhost_Datalus.js_-41-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a><\/dt>\n\t\t\t\t\t<\/dl>\n\t\t\t\t<\/div>\n\t\t\t\t<div class='gallery-row gallery-clear'>\n\t\t\t\t\t<dl class='gallery-item col-3'>\n\t\t\t\t\t\t<dt class='gallery-icon'><a href='http:\/\/patternweaver.com\/blog\/2010\/06\/imagebooth-demo-2-html5-js-image-editor\/http___localhost_datalus-js_\/'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/patternweaver.com\/blog\/wp-content\/uploads\/2010\/06\/http___localhost_Datalus.js_1-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a><\/dt>\n\t\t\t\t\t<\/dl>\n\t\t\t\t\t<dl class='gallery-item col-3'>\n\t\t\t\t\t\t<dt class='gallery-icon'><a href='http:\/\/patternweaver.com\/blog\/2010\/06\/imagebooth-demo-2-html5-js-image-editor\/http___patternweaver-com_imageboothjs_-2\/'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/patternweaver.com\/blog\/wp-content\/uploads\/2010\/06\/http___patternweaver.com_ImageBoothJS_-22-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a><\/dt>\n\t\t\t\t\t<\/dl>\n\t\t\t\t\t<dl class='gallery-item col-3'>\n\t\t\t\t\t\t<dt class='gallery-icon'><a href='http:\/\/patternweaver.com\/blog\/2010\/06\/imagebooth-demo-2-html5-js-image-editor\/http___localhost_datalus-js_-2\/'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/patternweaver.com\/blog\/wp-content\/uploads\/2010\/06\/http___localhost_Datalus.js_-21-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a><\/dt>\n\t\t\t\t\t<\/dl>\n\t\t\t\t<\/div>\n\t\t\t<\/div><!-- .gallery -->\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After another week working on the ImageBooth JS port, I&#8217;ve had a number of successes so almost all the core interfaces are available, and there is now a brushing system which doesn&#8217;t exist on the PHP version. Go ahead and check out the demo(works under webkit, slightly janky under FF, not working under IE). All [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-120","post","type-post","status-publish","format-standard","hentry","category-datalus"],"_links":{"self":[{"href":"http:\/\/patternweaver.com\/blog\/wp-json\/wp\/v2\/posts\/120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/patternweaver.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/patternweaver.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/patternweaver.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/patternweaver.com\/blog\/wp-json\/wp\/v2\/comments?post=120"}],"version-history":[{"count":0,"href":"http:\/\/patternweaver.com\/blog\/wp-json\/wp\/v2\/posts\/120\/revisions"}],"wp:attachment":[{"href":"http:\/\/patternweaver.com\/blog\/wp-json\/wp\/v2\/media?parent=120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/patternweaver.com\/blog\/wp-json\/wp\/v2\/categories?post=120"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/patternweaver.com\/blog\/wp-json\/wp\/v2\/tags?post=120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}