{"id":346,"date":"2009-07-15T18:32:25","date_gmt":"2009-07-16T01:32:25","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=1763"},"modified":"2009-07-15T18:32:25","modified_gmt":"2009-07-16T01:32:25","slug":"blendmodes-blur","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=346","title":{"rendered":"BlendModes &#038; Blur"},"content":{"rendered":"<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\n&#x5B;SWF(width = 750, height = 750)]\r\nvar canvas:BitmapData = new BitmapData(750,1000,false, 0x000000);\r\naddChild(new Bitmap(canvas));\r\n\r\nvar loader:Loader = new Loader();\r\nloader.load(new URLRequest(&quot;https:\/\/actionsnippet.com\/imgs\/paint.jpg&quot;));\r\nloader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);\r\nvar bit:BitmapData\r\nvar blurred:BitmapData;\r\nfunction onLoaded(evt:Event):void{\r\n\tbit = Bitmap(evt.target.content).bitmapData;\r\n\tblurred = bit.clone();\r\n\tblurred.applyFilter(blurred, blurred.rect, new Point(0,0), new BlurFilter(4, 4, 6));\r\n\tvar blends:Array = &#x5B;BlendMode.NORMAL,BlendMode.ADD, BlendMode.DARKEN,BlendMode.HARDLIGHT,BlendMode.LIGHTEN, BlendMode.MULTIPLY, BlendMode.OVERLAY,BlendMode.SCREEN, BlendMode.DIFFERENCE];\r\n\tvar m:Matrix = new Matrix();\r\n\tfor (var i:int = 0; i&lt;blends.length; i++){\r\n\t\tm.tx = i % 3 * 250;\r\n\t\tm.ty = int(i \/ 3) * 250;\r\n\t\tcanvas.draw(bit, m);\r\n\t\tif (i &gt; 0){\r\n\t    canvas.draw(blurred, m, null, blends&#x5B;i]);\r\n\t\t}\r\n\t}\r\n}\r\n<\/pre>\n<p>When I used to use photoshop for more than just the most basic of things, I would use a simple technique that employed layer modes (blend modes in flash) and blur. Sometimes, if I had a low quality image that I wanted to make look a little better, or just wanted to give an image a subtle effect, I would duplicate the layer the image was on, blur it and then go through all the layer modes on that duplicate layer until I found something I liked. <\/p>\n<p>This snippet does the same thing with a few select blend modes:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.actionsnippet.com\/imgs\/blendblur.jpg\" \/><\/p>\n<p>This isn&#8217;t the greatest image to illustrate the effect, but I didn&#8217;t feel like digging something better up. Two notable swatches are the upper right (darken) and the lower middle (screen).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#x5B;SWF(width = 750, height = 750)] var canvas:BitmapData = new BitmapData(750,1000,false, 0x000000); addChild(new Bitmap(canvas)); var loader:Loader = new Loader(); loader.load(new URLRequest(&quot;https:\/\/actionsnippet.com\/imgs\/paint.jpg&quot;)); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded); var bit:BitmapData var blurred:BitmapData; function onLoaded(evt:Event):void{ bit = Bitmap(evt.target.content).bitmapData; blurred = bit.clone(); blurred.applyFilter(blurred, blurred.rect, new Point(0,0), new BlurFilter(4, 4, 6)); var blends:Array = &#x5B;BlendMode.NORMAL,BlendMode.ADD, BlendMode.DARKEN,BlendMode.HARDLIGHT,BlendMode.LIGHTEN, BlendMode.MULTIPLY, BlendMode.OVERLAY,BlendMode.SCREEN, BlendMode.DIFFERENCE]; var m:Matrix = new [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24,94],"tags":[99,14,4],"class_list":["post-346","post","type-post","status-publish","format-standard","hentry","category-bitmapdata","category-misc","tag-actionsnippet","tag-as3","tag-flash"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/346","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=346"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/346\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}