<?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: World360 update, now with PNG bug!</title>
	<atom:link href="http://nocreativity.com/blog/world360-update-now-with-png-bug/feed" rel="self" type="application/rss+xml" />
	<link>http://nocreativity.com/blog/world360-update-now-with-png-bug</link>
	<description>The life and discoveries of a new media artist</description>
	<lastBuildDate>Sun, 25 Jul 2010 13:14:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ronny</title>
		<link>http://nocreativity.com/blog/world360-update-now-with-png-bug/comment-page-1#comment-4158</link>
		<dc:creator>Ronny</dc:creator>
		<pubDate>Mon, 16 Feb 2009 19:44:36 +0000</pubDate>
		<guid isPermaLink="false">http://nocreativity.com/blog/?p=383#comment-4158</guid>
		<description>I see where you are going with this, and I really understand the problem right now. 

I think I figured out the solution to this problem too. 
Thanks for helping me out!

I&#039;ll keep you posted!</description>
		<content:encoded><![CDATA[<p>I see where you are going with this, and I really understand the problem right now. </p>
<p>I think I figured out the solution to this problem too.<br />
Thanks for helping me out!</p>
<p>I&#8217;ll keep you posted!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erwin Verdonk</title>
		<link>http://nocreativity.com/blog/world360-update-now-with-png-bug/comment-page-1#comment-4156</link>
		<dc:creator>Erwin Verdonk</dc:creator>
		<pubDate>Mon, 16 Feb 2009 19:10:08 +0000</pubDate>
		<guid isPermaLink="false">http://nocreativity.com/blog/?p=383#comment-4156</guid>
		<description>The rest of the problem is not caused by premultiplied alphas. It is caused by overlapping as well. On line #217 you are drawing into a bitmap data object. But you keep drawing over everything already drawn. Which results in multiple transparencies on top of each other, which results in less transparency. When you have one bitmap with transparency 50% and put another over it with 50% the result will be 25% transparency. You do this a total of 360 times!

This is caused by the Tweener stroke alpha/scale animation, because it has a delay before it removes the strokes again from &#039;holder&#039;. So had to disable the Tweener stroke alpha/scale animation to make it work without overlapping. You can find the adjusted Tien.as here: http://blog.erwinverdonk.com/babyc/Tien.as (search for [TheDutch] in code)

For the animation you have to think of something else. But first I suggest you clean up the code and make it work smooth and well without stroke alpha/scale animation. Then it is time to think about how to work with a delayed removal of the strokes and stroke alpha/scale animation :).

- Erwin</description>
		<content:encoded><![CDATA[<p>The rest of the problem is not caused by premultiplied alphas. It is caused by overlapping as well. On line #217 you are drawing into a bitmap data object. But you keep drawing over everything already drawn. Which results in multiple transparencies on top of each other, which results in less transparency. When you have one bitmap with transparency 50% and put another over it with 50% the result will be 25% transparency. You do this a total of 360 times!</p>
<p>This is caused by the Tweener stroke alpha/scale animation, because it has a delay before it removes the strokes again from &#8216;holder&#8217;. So had to disable the Tweener stroke alpha/scale animation to make it work without overlapping. You can find the adjusted Tien.as here: <a href="http://blog.erwinverdonk.com/babyc/Tien.as" rel="nofollow" target="_blank">http://blog.erwinverdonk.com/babyc/Tien.as</a> (search for [TheDutch] in code)</p>
<p>For the animation you have to think of something else. But first I suggest you clean up the code and make it work smooth and well without stroke alpha/scale animation. Then it is time to think about how to work with a delayed removal of the strokes and stroke alpha/scale animation <img src='http://nocreativity.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>- Erwin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kris</title>
		<link>http://nocreativity.com/blog/world360-update-now-with-png-bug/comment-page-1#comment-4152</link>
		<dc:creator>Kris</dc:creator>
		<pubDate>Mon, 16 Feb 2009 16:29:48 +0000</pubDate>
		<guid isPermaLink="false">http://nocreativity.com/blog/?p=383#comment-4152</guid>
		<description>Interesting and strange problem.
My &#039;solution&#039;: use the new drawing API, very fast, no problems with alpha channels :)

a basic example:
http://www.neuroproductions.be/uploads/ff/eazvoorbeeld/
source: http://www.neuroproductions.be/uploads/ff/eazvoorbeeld/srcview/</description>
		<content:encoded><![CDATA[<p>Interesting and strange problem.<br />
My &#8217;solution&#8217;: use the new drawing API, very fast, no problems with alpha channels <img src='http://nocreativity.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>a basic example:<br />
<a href="http://www.neuroproductions.be/uploads/ff/eazvoorbeeld/" rel="nofollow" target="_blank">http://www.neuroproductions.be/uploads/ff/eazvoorbeeld/</a><br />
source: <a href="http://www.neuroproductions.be/uploads/ff/eazvoorbeeld/srcview/" rel="nofollow" target="_blank">http://www.neuroproductions.be/uploads/ff/eazvoorbeeld/srcview/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erwin Verdonk</title>
		<link>http://nocreativity.com/blog/world360-update-now-with-png-bug/comment-page-1#comment-4150</link>
		<dc:creator>Erwin Verdonk</dc:creator>
		<pubDate>Mon, 16 Feb 2009 15:30:32 +0000</pubDate>
		<guid isPermaLink="false">http://nocreativity.com/blog/?p=383#comment-4150</guid>
		<description>Can you email me your latest project? Also the slower one (before all the changes), so I can see what it should look like? e.verdonk at google mail :).</description>
		<content:encoded><![CDATA[<p>Can you email me your latest project? Also the slower one (before all the changes), so I can see what it should look like? e.verdonk at google mail <img src='http://nocreativity.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ronny</title>
		<link>http://nocreativity.com/blog/world360-update-now-with-png-bug/comment-page-1#comment-4148</link>
		<dc:creator>Ronny</dc:creator>
		<pubDate>Mon, 16 Feb 2009 15:22:05 +0000</pubDate>
		<guid isPermaLink="false">http://nocreativity.com/blog/?p=383#comment-4148</guid>
		<description>You are definitely right about the mess in the code...
However when using another PNG image (with more different alpha values, i still see the black border (way less, but it&#039;s still there))

http://shots.nocreativity.com/231fb72484c32977b7db8eb3e6ab79e5.jpg

That still seems to look like a result of that premultiplied alpha problem...</description>
		<content:encoded><![CDATA[<p>You are definitely right about the mess in the code&#8230;<br />
However when using another PNG image (with more different alpha values, i still see the black border (way less, but it&#8217;s still there))</p>
<p><a href="http://shots.nocreativity.com/231fb72484c32977b7db8eb3e6ab79e5.jpg" rel="nofollow">http://shots.nocreativity.com/231fb72484c32977b7db8eb3e6ab79e5.jpg</a></p>
<p>That still seems to look like a result of that premultiplied alpha problem&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erwin Verdonk</title>
		<link>http://nocreativity.com/blog/world360-update-now-with-png-bug/comment-page-1#comment-4147</link>
		<dc:creator>Erwin Verdonk</dc:creator>
		<pubDate>Mon, 16 Feb 2009 15:11:50 +0000</pubDate>
		<guid isPermaLink="false">http://nocreativity.com/blog/?p=383#comment-4147</guid>
		<description>You&#039;re welcome! However here there are absolutely no back spots visible, just as it should be. I&#039;m home now and had time to test it a little more. This is what you&#039;re doing and what causes the problem:

1. Load image
2. Make bitmap data of loaded image.
3. Make bitmap from bitmap data of loaded image.
4. Add bitmap as child to &#039;holder&#039;.
5. [...] some other non important executions.
6. Create another bitmap of the bitmap data of the bitmap of the loaded image, by copying pixels within an enter frame handler (I didnt make this up, its your code).
7. Next in that enter frame handler you add this other bitmap to &#039;holder&#039; and so overlap the loaded image you added at point #4 of this list.
8. Now you draw the content of &#039;holder&#039; into a bitmap data, later on at this bitmap data to the bitmap &#039;animator&#039; and add it to the stage.

In short you&#039;re overlapping within the &#039;holder&#039; before you&#039;re copying it to bitmap data and use it. That way what is transparent lets the loaded image a level deeper shine through which made it appear there was a black border.

I can only give you one piece of advice here; clean up your code before starting to debug or never make such a mess in the first place. This mess is what is causing these kind of mistakes and are very easy to prevent when keeping it more clean. Nothing to feel ashamed about, just something to keep in mind ;).

- Erwin</description>
		<content:encoded><![CDATA[<p>You&#8217;re welcome! However here there are absolutely no back spots visible, just as it should be. I&#8217;m home now and had time to test it a little more. This is what you&#8217;re doing and what causes the problem:</p>
<p>1. Load image<br />
2. Make bitmap data of loaded image.<br />
3. Make bitmap from bitmap data of loaded image.<br />
4. Add bitmap as child to &#8216;holder&#8217;.<br />
5. [...] some other non important executions.<br />
6. Create another bitmap of the bitmap data of the bitmap of the loaded image, by copying pixels within an enter frame handler (I didnt make this up, its your code).<br />
7. Next in that enter frame handler you add this other bitmap to &#8216;holder&#8217; and so overlap the loaded image you added at point #4 of this list.<br />
8. Now you draw the content of &#8216;holder&#8217; into a bitmap data, later on at this bitmap data to the bitmap &#8216;animator&#8217; and add it to the stage.</p>
<p>In short you&#8217;re overlapping within the &#8216;holder&#8217; before you&#8217;re copying it to bitmap data and use it. That way what is transparent lets the loaded image a level deeper shine through which made it appear there was a black border.</p>
<p>I can only give you one piece of advice here; clean up your code before starting to debug or never make such a mess in the first place. This mess is what is causing these kind of mistakes and are very easy to prevent when keeping it more clean. Nothing to feel ashamed about, just something to keep in mind <img src='http://nocreativity.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>- Erwin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ronny</title>
		<link>http://nocreativity.com/blog/world360-update-now-with-png-bug/comment-page-1#comment-4145</link>
		<dc:creator>Ronny</dc:creator>
		<pubDate>Mon, 16 Feb 2009 14:01:34 +0000</pubDate>
		<guid isPermaLink="false">http://nocreativity.com/blog/?p=383#comment-4145</guid>
		<description>Hi Erwin

You&#039;re right!
The black stroke SEEMS to be gone. It still is visible in some spots, but it&#039;s mostly gone!

Thanks. I&#039;m a bit confused though what was happening now. I&#039;ll take a closer look at it tonight. Thanks a lot for your help!

I really appreciate that!</description>
		<content:encoded><![CDATA[<p>Hi Erwin</p>
<p>You&#8217;re right!<br />
The black stroke SEEMS to be gone. It still is visible in some spots, but it&#8217;s mostly gone!</p>
<p>Thanks. I&#8217;m a bit confused though what was happening now. I&#8217;ll take a closer look at it tonight. Thanks a lot for your help!</p>
<p>I really appreciate that!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erwin Verdonk</title>
		<link>http://nocreativity.com/blog/world360-update-now-with-png-bug/comment-page-1#comment-4143</link>
		<dc:creator>Erwin Verdonk</dc:creator>
		<pubDate>Mon, 16 Feb 2009 13:20:24 +0000</pubDate>
		<guid isPermaLink="false">http://nocreativity.com/blog/?p=383#comment-4143</guid>
		<description>I&#039;m not talking about the stroke-mask. Please do not think I follow-up on Mario, Peter, or Ralph. I got it working here without black borders, so I think I indeed did fix the problem.

A simple test: Remove line #132 that says &quot;holder.addChild(historybm);&quot;.

When this solved your problem, please read my other reply more carefully. It explains why it happens and how to solve it :).</description>
		<content:encoded><![CDATA[<p>I&#8217;m not talking about the stroke-mask. Please do not think I follow-up on Mario, Peter, or Ralph. I got it working here without black borders, so I think I indeed did fix the problem.</p>
<p>A simple test: Remove line #132 that says &#8220;holder.addChild(historybm);&#8221;.</p>
<p>When this solved your problem, please read my other reply more carefully. It explains why it happens and how to solve it <img src='http://nocreativity.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ronny</title>
		<link>http://nocreativity.com/blog/world360-update-now-with-png-bug/comment-page-1#comment-4141</link>
		<dc:creator>Ronny</dc:creator>
		<pubDate>Mon, 16 Feb 2009 12:14:23 +0000</pubDate>
		<guid isPermaLink="false">http://nocreativity.com/blog/?p=383#comment-4141</guid>
		<description>Hey Erwin,

the stroke-mask isn&#039;t the real problem. Even when completely removing that thing the black borders still remain.

The real problem is described in Mario&#039;s article on premultiplied alpha ( http://www.quasimondo.com/archives/000665.php ).
I posted it here too btw ;) ( http://flashfocus.nl/forum/showthread.php?t=50892 )</description>
		<content:encoded><![CDATA[<p>Hey Erwin,</p>
<p>the stroke-mask isn&#8217;t the real problem. Even when completely removing that thing the black borders still remain.</p>
<p>The real problem is described in Mario&#8217;s article on premultiplied alpha ( <a href="http://www.quasimondo.com/archives/000665.php" rel="nofollow" target="_blank">http://www.quasimondo.com/archives/000665.php</a> ).<br />
I posted it here too btw <img src='http://nocreativity.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ( <a href="http://flashfocus.nl/forum/showthread.php?t=50892" rel="nofollow" target="_blank">http://flashfocus.nl/forum/showthread.php?t=50892</a> )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erwin Verdonk</title>
		<link>http://nocreativity.com/blog/world360-update-now-with-png-bug/comment-page-1#comment-4135</link>
		<dc:creator>Erwin Verdonk</dc:creator>
		<pubDate>Mon, 16 Feb 2009 06:55:38 +0000</pubDate>
		<guid isPermaLink="false">http://nocreativity.com/blog/?p=383#comment-4135</guid>
		<description>On line #132 you are adding the &#039;historybm&#039; bitmap to the &#039;holder&#039; sprite. Then you draw the &#039;holder&#039; into a bitmap data object. Later you add the strokes to that same &#039;holder&#039; sprite, while the original bitmap is still in there. That way they overlap and so create what what looks like a black border. 

To solve this you should remove all children from &#039;holder&#039; or make it a reference to a whole new sprite before you are going to add the strokes. I guess a good place would be on line #140 above the handler assignment for the &#039;enter frame&#039; event.

- Erwin</description>
		<content:encoded><![CDATA[<p>On line #132 you are adding the &#8216;historybm&#8217; bitmap to the &#8216;holder&#8217; sprite. Then you draw the &#8216;holder&#8217; into a bitmap data object. Later you add the strokes to that same &#8216;holder&#8217; sprite, while the original bitmap is still in there. That way they overlap and so create what what looks like a black border. </p>
<p>To solve this you should remove all children from &#8216;holder&#8217; or make it a reference to a whole new sprite before you are going to add the strokes. I guess a good place would be on line #140 above the handler assignment for the &#8216;enter frame&#8217; event.</p>
<p>- Erwin</p>
]]></content:encoded>
	</item>
</channel>
</rss>
