<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: &#8230; wider range for displacementMapFilter</title>
	<atom:link href="http://pixelero.wordpress.com/2008/02/18/extending-displacementmapfilter/feed/" rel="self" type="application/rss+xml" />
	<link>http://pixelero.wordpress.com/2008/02/18/extending-displacementmapfilter/</link>
	<description>Just another Flash/actionscript/whatever weblog</description>
	<lastBuildDate>Sat, 14 Nov 2009 14:34:11 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Alberto</title>
		<link>http://pixelero.wordpress.com/2008/02/18/extending-displacementmapfilter/#comment-47</link>
		<dc:creator>Alberto</dc:creator>
		<pubDate>Tue, 03 Jun 2008 22:00:18 +0000</pubDate>
		<guid isPermaLink="false">http://pixelero.wordpress.com/?p=3#comment-47</guid>
		<description>Yes, this way is a lot easier, but I have an image editor and -for project limitations- I need to use BitmapFilters.

I was thinking into extending the DisplacementMap filter or to create a whole new one but sincerely I don&#039;t know how to begin.

Anyway thanks for your time and effort</description>
		<content:encoded><![CDATA[<p>Yes, this way is a lot easier, but I have an image editor and -for project limitations- I need to use BitmapFilters.</p>
<p>I was thinking into extending the DisplacementMap filter or to create a whole new one but sincerely I don&#8217;t know how to begin.</p>
<p>Anyway thanks for your time and effort</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pixelero</title>
		<link>http://pixelero.wordpress.com/2008/02/18/extending-displacementmapfilter/#comment-46</link>
		<dc:creator>pixelero</dc:creator>
		<pubDate>Tue, 03 Jun 2008 19:06:50 +0000</pubDate>
		<guid isPermaLink="false">http://pixelero.wordpress.com/?p=3#comment-46</guid>
		<description>Yes, having only 128 or 256 levels does cause the bands.
Btw, why does it have to be DisplacementMapFilter ?
If it&#039;s only mirroring the stage, aren&#039;t there some other ways of doing that, maybe BitmapData.draw(stage)?

var w:int = stage.stageWidth;
var h2:int = stage.stageHeight/2;

var reflectMap:BitmapData = new BitmapData(w,h2, true, 0x00); // half size again
// reflectMap.draw(stage); // or addEventListener...

var reflectBmp:Bitmap = new Bitmap(reflectMap);
reflectBmp.y = stage.stageHeight;
reflectBmp.scaleY = -1.0;
addChild(reflectBmp);

addEventListener(Event.ENTER_FRAME, enterFrame);

function enterFrame(e:Event):void {
	reflectMap.fillRect(reflectMap.rect, 0x00); // this line is necesserly if animated with transparent parts
	
	reflectMap.draw(stage);
}</description>
		<content:encoded><![CDATA[<p>Yes, having only 128 or 256 levels does cause the bands.<br />
Btw, why does it have to be DisplacementMapFilter ?<br />
If it&#8217;s only mirroring the stage, aren&#8217;t there some other ways of doing that, maybe BitmapData.draw(stage)?</p>
<p>var w:int = stage.stageWidth;<br />
var h2:int = stage.stageHeight/2;</p>
<p>var reflectMap:BitmapData = new BitmapData(w,h2, true, 0&#215;00); // half size again<br />
// reflectMap.draw(stage); // or addEventListener&#8230;</p>
<p>var reflectBmp:Bitmap = new Bitmap(reflectMap);<br />
reflectBmp.y = stage.stageHeight;<br />
reflectBmp.scaleY = -1.0;<br />
addChild(reflectBmp);</p>
<p>addEventListener(Event.ENTER_FRAME, enterFrame);</p>
<p>function enterFrame(e:Event):void {<br />
	reflectMap.fillRect(reflectMap.rect, 0&#215;00); // this line is necesserly if animated with transparent parts</p>
<p>	reflectMap.draw(stage);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alberto</title>
		<link>http://pixelero.wordpress.com/2008/02/18/extending-displacementmapfilter/#comment-45</link>
		<dc:creator>Alberto</dc:creator>
		<pubDate>Mon, 02 Jun 2008 19:02:41 +0000</pubDate>
		<guid isPermaLink="false">http://pixelero.wordpress.com/?p=3#comment-45</guid>
		<description>In this example you use two displacementMaps for the same reason, isn&#039;t it? But I&#039;m using a class that (for project requirements) has to return a single BitmapFilter, so I can&#039;t do an approach like yours...

Oh, i&#039;m getting desperate right now...</description>
		<content:encoded><![CDATA[<p>In this example you use two displacementMaps for the same reason, isn&#8217;t it? But I&#8217;m using a class that (for project requirements) has to return a single BitmapFilter, so I can&#8217;t do an approach like yours&#8230;</p>
<p>Oh, i&#8217;m getting desperate right now&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alberto</title>
		<link>http://pixelero.wordpress.com/2008/02/18/extending-displacementmapfilter/#comment-44</link>
		<dc:creator>Alberto</dc:creator>
		<pubDate>Mon, 02 Jun 2008 18:47:58 +0000</pubDate>
		<guid isPermaLink="false">http://pixelero.wordpress.com/?p=3#comment-44</guid>
		<description>Hi again,
I&#039;ve tested the code and the result is the same as I could get; the image appears flipped but I think that only works for images smaller than 255. For bigger ones I see &quot;bands&quot; that aren&#039;t flipped. 

I&#039;ve upload a sample:
http://www.theklue.com/test.png

I suppose that the problem is that we can&#039;t detect more than 255 levels of the same color...

Have any clue?

Thanks again!</description>
		<content:encoded><![CDATA[<p>Hi again,<br />
I&#8217;ve tested the code and the result is the same as I could get; the image appears flipped but I think that only works for images smaller than 255. For bigger ones I see &#8220;bands&#8221; that aren&#8217;t flipped. </p>
<p>I&#8217;ve upload a sample:<br />
<a href="http://www.theklue.com/test.png" rel="nofollow">http://www.theklue.com/test.png</a></p>
<p>I suppose that the problem is that we can&#8217;t detect more than 255 levels of the same color&#8230;</p>
<p>Have any clue?</p>
<p>Thanks again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alberto</title>
		<link>http://pixelero.wordpress.com/2008/02/18/extending-displacementmapfilter/#comment-43</link>
		<dc:creator>Alberto</dc:creator>
		<pubDate>Mon, 02 Jun 2008 07:26:50 +0000</pubDate>
		<guid isPermaLink="false">http://pixelero.wordpress.com/?p=3#comment-43</guid>
		<description>Lots of thanks pixelero! I will try it later.

I agree; with PixelBender this will a lot easier, but the problem is that I can&#039;t use it in my project (I must use a BitmapFilter and, as you said , is very annoying - to say the least - to configure a displacementFilter to work &quot;exactly&quot;).

Will post the results.

Lots of thanks!!

Alberto</description>
		<content:encoded><![CDATA[<p>Lots of thanks pixelero! I will try it later.</p>
<p>I agree; with PixelBender this will a lot easier, but the problem is that I can&#8217;t use it in my project (I must use a BitmapFilter and, as you said , is very annoying &#8211; to say the least &#8211; to configure a displacementFilter to work &#8220;exactly&#8221;).</p>
<p>Will post the results.</p>
<p>Lots of thanks!!</p>
<p>Alberto</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pixelero</title>
		<link>http://pixelero.wordpress.com/2008/02/18/extending-displacementmapfilter/#comment-42</link>
		<dc:creator>pixelero</dc:creator>
		<pubDate>Sun, 01 Jun 2008 19:44:19 +0000</pubDate>
		<guid isPermaLink="false">http://pixelero.wordpress.com/?p=3#comment-42</guid>
		<description>Ok, thanks for your comment. 

Hint 1:
... as an example some code for reflecting upper half of the stage, MainTimeline, frame1:
&lt;code&gt;
// actionscript 3.0, code example
// anything for drawing something on the stage
addChild(something);


// dimensions of the stage
var w:int = stage.stageWidth;
var h2:int = stage.stageHeight/2; // half the stage height

// matrix for a vertical gradient
var gratrix:Matrix = new Matrix();
gratrix.createGradientBox(w, h2, // width,half the height,
						  Math.PI/2, // rad for 90 degrees
						  0, 0); // translate, in this case start from origin point

// temporary sprite for drawing the fill
var gradSprite:Sprite = new Sprite();
gradSprite.graphics.beginGradientFill(GradientType.LINEAR, 
								[0x807F, 0x8000], // green constantly 0x80 - no replacement, blue transfers from 127 - the above pixel - to zero, 
								[1, 1], // alphas, not significant
								[0x00, 0xFF], // ratios, linear fill
								gratrix );  
gradSprite.graphics.drawRect(0,0,w, h2); // fill, half the stage size
gradSprite.graphics.endFill();
	
var displaceBmp:BitmapData = new BitmapData(w,h2,false); // half the stage, no alpha channel
displaceBmp.draw(gradSprite); // copy gradient fill to bitmapdata

var displacer:DisplacementMapFilter = new DisplacementMapFilter(
		displaceBmp,
		new Point(0,h2), // locates this filter below the horizontal middleline
		BitmapDataChannel.GREEN, // displacement in x-direction
		BitmapDataChannel.BLUE,	// displacement in y-direction
		0.0,4*h2); // scales, in this case only the blue component matters

this.filters = [displacer];
&lt;/code&gt;

Hint 2:
I guess with PixelBender lots like this will be a whole lot easier: Adjusting displacementFilter for precise result can be a bit annoying, this tube view came out surprisingly well, but when I tried like a fish-lens or spherical effect, it did look good at all.</description>
		<content:encoded><![CDATA[<p>Ok, thanks for your comment. </p>
<p>Hint 1:<br />
&#8230; as an example some code for reflecting upper half of the stage, MainTimeline, frame1:<br />
<code><br />
// actionscript 3.0, code example<br />
// anything for drawing something on the stage<br />
addChild(something);</p>
<p>// dimensions of the stage<br />
var w:int = stage.stageWidth;<br />
var h2:int = stage.stageHeight/2; // half the stage height</p>
<p>// matrix for a vertical gradient<br />
var gratrix:Matrix = new Matrix();<br />
gratrix.createGradientBox(w, h2, // width,half the height,<br />
						  Math.PI/2, // rad for 90 degrees<br />
						  0, 0); // translate, in this case start from origin point</p>
<p>// temporary sprite for drawing the fill<br />
var gradSprite:Sprite = new Sprite();<br />
gradSprite.graphics.beginGradientFill(GradientType.LINEAR,<br />
								[0x807F, 0x8000], // green constantly 0x80 - no replacement, blue transfers from 127 - the above pixel - to zero,<br />
								[1, 1], // alphas, not significant<br />
								[0x00, 0xFF], // ratios, linear fill<br />
								gratrix );<br />
gradSprite.graphics.drawRect(0,0,w, h2); // fill, half the stage size<br />
gradSprite.graphics.endFill();</p>
<p>var displaceBmp:BitmapData = new BitmapData(w,h2,false); // half the stage, no alpha channel<br />
displaceBmp.draw(gradSprite); // copy gradient fill to bitmapdata</p>
<p>var displacer:DisplacementMapFilter = new DisplacementMapFilter(<br />
		displaceBmp,<br />
		new Point(0,h2), // locates this filter below the horizontal middleline<br />
		BitmapDataChannel.GREEN, // displacement in x-direction<br />
		BitmapDataChannel.BLUE,	// displacement in y-direction<br />
		0.0,4*h2); // scales, in this case only the blue component matters</p>
<p>this.filters = [displacer];<br />
</code></p>
<p>Hint 2:<br />
I guess with PixelBender lots like this will be a whole lot easier: Adjusting displacementFilter for precise result can be a bit annoying, this tube view came out surprisingly well, but when I tried like a fish-lens or spherical effect, it did look good at all.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alberto</title>
		<link>http://pixelero.wordpress.com/2008/02/18/extending-displacementmapfilter/#comment-41</link>
		<dc:creator>Alberto</dc:creator>
		<pubDate>Sat, 31 May 2008 19:30:22 +0000</pubDate>
		<guid isPermaLink="false">http://pixelero.wordpress.com/?p=3#comment-41</guid>
		<description>So interesting.... Thanks for this sample.

I&#039;m trying to achieve a simple horizontal flip with the displacementmap filter but with no success. Basically I&#039;m using a white-to-black gradient but I can&#039;t get the flipped image. Can you give me any hint?

Lots of thanks in advanced.

Alberto</description>
		<content:encoded><![CDATA[<p>So interesting&#8230;. Thanks for this sample.</p>
<p>I&#8217;m trying to achieve a simple horizontal flip with the displacementmap filter but with no success. Basically I&#8217;m using a white-to-black gradient but I can&#8217;t get the flipped image. Can you give me any hint?</p>
<p>Lots of thanks in advanced.</p>
<p>Alberto</p>
]]></content:encoded>
	</item>
</channel>
</rss>
