{"id":262,"date":"2011-04-25T02:23:35","date_gmt":"2011-04-25T05:23:35","guid":{"rendered":"http:\/\/wahlers.com.br\/claus\/blog\/?p=262"},"modified":"2011-04-25T03:18:41","modified_gmt":"2011-04-25T06:18:41","slug":"as3-bitmap-tracer-vectorizer-as3potrace","status":"publish","type":"post","link":"https:\/\/wahlers.com.br\/claus\/blog\/as3-bitmap-tracer-vectorizer-as3potrace\/","title":{"rendered":"ActionScript 3 Bitmap Tracer (Vectorizer): as3potrace"},"content":{"rendered":"<p>Ever wanted to convert a bitmap to vector shapes, at runtime, in Flash? Look no further. Let me introduce you to <a href=\"https:\/\/github.com\/PowerflasherBR\/as3potrace\">as3potrace<\/a>, an ActionScript 3 library to trace bitmaps.<\/p>\n<p>As the name suggests, this is a port of the well known C library <a href=\"http:\/\/potrace.sourceforge.net\/\">potrace<\/a> by Peter Selinger. To be more exact, it is a AS3 port of <a href=\"http:\/\/www.drawing3d.de\/Downloads.aspx\">Vectorization<\/a>, a C# port of potrace 1.8 by Wolfgang Nagl.<\/p>\n<p>Like potrace, as3potrace is released under GPL. The SWC and source code are available on GitHub:<\/p>\n<p><a href=\"https:\/\/github.com\/PowerflasherBR\/as3potrace\">https:\/\/github.com\/PowerflasherBR\/as3potrace<\/a><\/p>\n<p><strong>Demo<\/strong><\/p>\n<p>[SWF]http:\/\/wahlers.com.br\/claus\/blog\/wp-content\/uploads\/POTrace.swf, 475, 475[\/SWF]<\/p>\n<p>Demo source code: <a href=\"https:\/\/gist.github.com\/940219\">https:\/\/gist.github.com\/940219<\/a> (Warning: ugly)<\/p>\n<p><strong>Usage example<\/strong><\/p>\n<p>A minimal example of how to trace a bitmap with as3potrace, and draw the result into a <code>Shape<\/code>:<\/p>\n<p><script src=\"https:\/\/gist.github.com\/940180.js?file=gistfile1.as\"><\/script><\/p>\n<p>Note that you can write your own backends to ease handling\/processing of generated shapes. The one backend that i already wrote, <code>GraphicsDataBackend<\/code>, produces <code>GraphicsData<\/code> structures that you can immediately draw using <code>Graphics.drawGraphicsData()<\/code>.<\/p>\n<p><strong>Alternatives<\/strong><\/p>\n<p>And as always, after i finished porting this little beauty, i found out that this has been done before by the amazing folks at LibSpark. Check out nitoyon&#8217;s <a href=\"http:\/\/www.libspark.org\/wiki\/nitoyon\/PotrAs\">PotrAs<\/a> (also GPL&#8217;ed).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ever wanted to convert a bitmap to vector shapes, at runtime, in Flash? Look no further. Let me introduce you to as3potrace, an ActionScript 3 library to trace bitmaps. As the name suggests, this is a port of the well &hellip; <a href=\"https:\/\/wahlers.com.br\/claus\/blog\/as3-bitmap-tracer-vectorizer-as3potrace\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,4],"tags":[],"class_list":["post-262","post","type-post","status-publish","format-standard","hentry","category-as3","category-flash"],"_links":{"self":[{"href":"https:\/\/wahlers.com.br\/claus\/blog\/wp-json\/wp\/v2\/posts\/262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wahlers.com.br\/claus\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wahlers.com.br\/claus\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wahlers.com.br\/claus\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wahlers.com.br\/claus\/blog\/wp-json\/wp\/v2\/comments?post=262"}],"version-history":[{"count":15,"href":"https:\/\/wahlers.com.br\/claus\/blog\/wp-json\/wp\/v2\/posts\/262\/revisions"}],"predecessor-version":[{"id":278,"href":"https:\/\/wahlers.com.br\/claus\/blog\/wp-json\/wp\/v2\/posts\/262\/revisions\/278"}],"wp:attachment":[{"href":"https:\/\/wahlers.com.br\/claus\/blog\/wp-json\/wp\/v2\/media?parent=262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wahlers.com.br\/claus\/blog\/wp-json\/wp\/v2\/categories?post=262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wahlers.com.br\/claus\/blog\/wp-json\/wp\/v2\/tags?post=262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}