
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Duplicate a DisplayObject as a BitMap</title>
	<atom:link href="http://blog.nobien.net/2008/05/14/duplicate-a-displayobject-as-a-bitmap/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nobien.net/2008/05/14/duplicate-a-displayobject-as-a-bitmap/</link>
	<description>A nerd blog about nerdy things by ... nerdy guys?</description>
	<lastBuildDate>Tue, 11 Oct 2011 21:59:52 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
	<item>
		<title>By: Sebelious</title>
		<link>http://blog.nobien.net/2008/05/14/duplicate-a-displayobject-as-a-bitmap/comment-page-1/#comment-5312</link>
		<dc:creator>Sebelious</dc:creator>
		<pubDate>Wed, 16 Mar 2011 13:46:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nobien.net/?p=63#comment-5312</guid>
		<description>Legend, this has been giving me a headache all morning. 

It&#039;s people like you that make the internet great! 

Cheers</description>
		<content:encoded><![CDATA[<p>Legend, this has been giving me a headache all morning. </p>
<p>It&#8217;s people like you that make the internet great! </p>
<p>Cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitri</title>
		<link>http://blog.nobien.net/2008/05/14/duplicate-a-displayobject-as-a-bitmap/comment-page-1/#comment-5306</link>
		<dc:creator>Dmitri</dc:creator>
		<pubDate>Fri, 04 Mar 2011 08:58:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nobien.net/?p=63#comment-5306</guid>
		<description>Here&#039;s what I came up with, based on your approach. This function duplicates displayObject no matter of where his registration point is (so that it doesn&#039;t clip).

	

public static function duplicateAsBitmap(displayObj:DisplayObject):Sprite{
			if(displayObj.width &gt; 2880 &#124;&#124; displayObj.height &gt; 2880){
				throw new Error(&quot;The size of display object exceeds 2880 px and cannot be rendered as bitmap&quot;);
				return;
			}
			else{
				var btmpData:BitmapData = new BitmapData(displayObj.width, displayObj.height, true, 0xffffff);
				var btmp:Bitmap = new Bitmap();
				var m:Matrix = new Matrix();
				var bounds:Rectangle = displayObj.getBounds(displayObj);
				var sprite:Sprite = new Sprite();
				m.translate(-bounds.x, -bounds.y);
				btmpData.draw(displayObj, m);
				btmp.bitmapData = btmpData;
				btmp.smoothing = true;
				btmp.transform = displayObj.transform;
				btmp.x += bounds.x;
				btmp.y += bounds.y;
				sprite.addChild(btmp);
			}
			return sprite;
		}</description>
		<content:encoded><![CDATA[<p>Here&#8217;s what I came up with, based on your approach. This function duplicates displayObject no matter of where his registration point is (so that it doesn&#8217;t clip).</p>
<p>public static function duplicateAsBitmap(displayObj:DisplayObject):Sprite{<br />
			if(displayObj.width &gt; 2880 || displayObj.height &gt; 2880){<br />
				throw new Error(&#8220;The size of display object exceeds 2880 px and cannot be rendered as bitmap&#8221;);<br />
				return;<br />
			}<br />
			else{<br />
				var btmpData:BitmapData = new BitmapData(displayObj.width, displayObj.height, true, 0xffffff);<br />
				var btmp:Bitmap = new Bitmap();<br />
				var m:Matrix = new Matrix();<br />
				var bounds:Rectangle = displayObj.getBounds(displayObj);<br />
				var sprite:Sprite = new Sprite();<br />
				m.translate(-bounds.x, -bounds.y);<br />
				btmpData.draw(displayObj, m);<br />
				btmp.bitmapData = btmpData;<br />
				btmp.smoothing = true;<br />
				btmp.transform = displayObj.transform;<br />
				btmp.x += bounds.x;<br />
				btmp.y += bounds.y;<br />
				sprite.addChild(btmp);<br />
			}<br />
			return sprite;<br />
		}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitri</title>
		<link>http://blog.nobien.net/2008/05/14/duplicate-a-displayobject-as-a-bitmap/comment-page-1/#comment-5305</link>
		<dc:creator>Dmitri</dc:creator>
		<pubDate>Fri, 04 Mar 2011 07:49:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nobien.net/?p=63#comment-5305</guid>
		<description>Thanks for a good idea! I have to add though, that it&#039;s better clone the transform property of a display object too, so that its bitmap clone possesed all the transformation applied to it.</description>
		<content:encoded><![CDATA[<p>Thanks for a good idea! I have to add though, that it&#8217;s better clone the transform property of a display object too, so that its bitmap clone possesed all the transformation applied to it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ibex</title>
		<link>http://blog.nobien.net/2008/05/14/duplicate-a-displayobject-as-a-bitmap/comment-page-1/#comment-5290</link>
		<dc:creator>ibex</dc:creator>
		<pubDate>Mon, 10 Jan 2011 02:32:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nobien.net/?p=63#comment-5290</guid>
		<description>Good stuff mate!
Really helped me
thnaks!</description>
		<content:encoded><![CDATA[<p>Good stuff mate!<br />
Really helped me<br />
thnaks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Duplicating a display object as a bitmap &#171; eyebrow creative</title>
		<link>http://blog.nobien.net/2008/05/14/duplicate-a-displayobject-as-a-bitmap/comment-page-1/#comment-5287</link>
		<dc:creator>Duplicating a display object as a bitmap &#171; eyebrow creative</dc:creator>
		<pubDate>Wed, 22 Dec 2010 19:46:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nobien.net/?p=63#comment-5287</guid>
		<description>[...] and paste it as a new instance. Tried clone(),draw(), etc. but kept getting errors. Finally found this post. The author wrote it as a class, but the basic method is to use the &#8220;as&#8221; command: var [...]</description>
		<content:encoded><![CDATA[<p>[...] and paste it as a new instance. Tried clone(),draw(), etc. but kept getting errors. Finally found this post. The author wrote it as a class, but the basic method is to use the &#8220;as&#8221; command: var [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: truwer</title>
		<link>http://blog.nobien.net/2008/05/14/duplicate-a-displayobject-as-a-bitmap/comment-page-1/#comment-4889</link>
		<dc:creator>truwer</dc:creator>
		<pubDate>Mon, 16 Aug 2010 08:54:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nobien.net/?p=63#comment-4889</guid>
		<description>Thanks!!! Very simple and good</description>
		<content:encoded><![CDATA[<p>Thanks!!! Very simple and good</p>
]]></content:encoded>
	</item>
</channel>
</rss>

