<?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"
	>
<channel>
	<title>Comments on: bitmapdata resize quality in Flex and Air</title>
	<atom:link href="http://www.cafesilencio.net/blog/bitmapdata-resize-quality-in-flex-and-air/feed" rel="self" type="application/rss+xml" />
	<link>http://www.cafesilencio.net/blog/bitmapdata-resize-quality-in-flex-and-air</link>
	<description>Adventures In Developing Rich Internet Applications</description>
	<pubDate>Sat, 31 Jul 2010 08:39:47 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Ken</title>
		<link>http://www.cafesilencio.net/blog/bitmapdata-resize-quality-in-flex-and-air#comment-265</link>
		<dc:creator>Ken</dc:creator>
		<pubDate>Wed, 09 Dec 2009 20:40:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.cafesilencio.net/blog/?p=104#comment-265</guid>
		<description>Forgot to add this in the last post for the bicubic... necessary helper function:

			/**
			   Support function for bicubic interpolation.
			 */
			private static function A(x:Number):Number
			{
				var p0:Number = ((x + 2) &#62; 0) ? (x + 2) : 0
				var p1:Number = ((x + 1) &#62; 0) ? (x + 1) : 0
				var p2:Number = (x &#62; 0) ? x : 0
				var p3:Number = ((x - 1) &#62; 0) ? (x - 1) : 0

				return (1 / 6) * (p0 * p0 * p0 - 4 * (p1 * p1 * p1) + 6 * (p2 * p2 * p2) -
					4 * (p3 * p3 * p3));
			}</description>
		<content:encoded><![CDATA[<p>Forgot to add this in the last post for the bicubic&#8230; necessary helper function:</p>
<p>			/**<br />
			   Support function for bicubic interpolation.<br />
			 */<br />
			private static function A(x:Number):Number<br />
			{<br />
				var p0:Number = ((x + 2) &gt; 0) ? (x + 2) : 0<br />
				var p1:Number = ((x + 1) &gt; 0) ? (x + 1) : 0<br />
				var p2:Number = (x &gt; 0) ? x : 0<br />
				var p3:Number = ((x - 1) &gt; 0) ? (x - 1) : 0</p>
<p>				return (1 / 6) * (p0 * p0 * p0 - 4 * (p1 * p1 * p1) + 6 * (p2 * p2 * p2) -<br />
					4 * (p3 * p3 * p3));<br />
			}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ken</title>
		<link>http://www.cafesilencio.net/blog/bitmapdata-resize-quality-in-flex-and-air#comment-264</link>
		<dc:creator>Ken</dc:creator>
		<pubDate>Wed, 09 Dec 2009 20:34:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.cafesilencio.net/blog/?p=104#comment-264</guid>
		<description>Thanks, if anyone wants to try out the bicubic resize, here's a similarly adapted function


			/**
			   Computes the value of a pixel that is not on a pixel boundary.

			   @param x The sub-pixel precision x-coordinate.
			   @param y The sub-pixel precision y-coordinate.
			 */
			private static function getPixelBicubic(bmd:BitmapData, x:Number, y:Number):Number
			{
				var i:int = (int)(x);
				var j:int = (int)(y);

				if (((i - 1) &#60; 0) &#124;&#124; ((j - 1) = bmd.width) &#124;&#124; ((i + 2) &#62;= bmd.width) &#124;&#124;
					((j + 1) &#62;= bmd.height) &#124;&#124; ((j + 2) &#62;= bmd.height))
					return bmd.getPixel(i, j);

				var dx:Number = x - i;
				var dy:Number = y - j;
				var rsum:Number = 0;
				var gsum:Number = 0;
				var bsum:Number = 0;

				var Rmdx:Array = new Array(4);
				var Rdyn:Array = new Array(4);
				for (var m:int = -1; m &#60;= 2; ++m)
					Rmdx[m + 1] = A(m - dx);
				for (var n:int = -1; n &#60;= 2; ++n)
					Rdyn[n + 1] = A(dy - n);

				for (m = -1; m &#60;= 2; ++m)
				{
					for (n = -1; n &#62; 16) &#38; 0x0FF;
						var g:int = (rgb &#62;&#62; 8) &#38; 0x0FF;
						var b:int = (rgb &#62;&#62; 0) &#38; 0x0FF;

						var Rres:Number = Rmdx[m + 1] * Rdyn[n + 1];
						rsum += r * Rres;
						gsum += g * Rres;
						bsum += b * Rres;
					}
				}

				var red:int = (int)(rsum + 0.5);
				if (red  255)
					red = 255;
				var green:int = (int)(gsum + 0.5);
				if (green  255)
					green = 255;
				var blue:int = (int)(bsum + 0.5);
				if (blue  255)
					blue = 255;

				return (red &#60;&#60; 16) &#124; (green &#60;&#60; 8) &#124; (blue &#60;&#60; 0);
			}</description>
		<content:encoded><![CDATA[<p>Thanks, if anyone wants to try out the bicubic resize, here&#8217;s a similarly adapted function</p>
<p>			/**<br />
			   Computes the value of a pixel that is not on a pixel boundary.</p>
<p>			   @param x The sub-pixel precision x-coordinate.<br />
			   @param y The sub-pixel precision y-coordinate.<br />
			 */<br />
			private static function getPixelBicubic(bmd:BitmapData, x:Number, y:Number):Number<br />
			{<br />
				var i:int = (int)(x);<br />
				var j:int = (int)(y);</p>
<p>				if (((i - 1) &lt; 0) || ((j - 1) = bmd.width) || ((i + 2) &gt;= bmd.width) ||<br />
					((j + 1) &gt;= bmd.height) || ((j + 2) &gt;= bmd.height))<br />
					return bmd.getPixel(i, j);</p>
<p>				var dx:Number = x - i;<br />
				var dy:Number = y - j;<br />
				var rsum:Number = 0;<br />
				var gsum:Number = 0;<br />
				var bsum:Number = 0;</p>
<p>				var Rmdx:Array = new Array(4);<br />
				var Rdyn:Array = new Array(4);<br />
				for (var m:int = -1; m &lt;= 2; ++m)<br />
					Rmdx[m + 1] = A(m - dx);<br />
				for (var n:int = -1; n &lt;= 2; ++n)<br />
					Rdyn[n + 1] = A(dy - n);</p>
<p>				for (m = -1; m &lt;= 2; ++m)<br />
				{<br />
					for (n = -1; n &gt; 16) &amp; 0&#215;0FF;<br />
						var g:int = (rgb &gt;&gt; <img src='http://www.cafesilencio.net/blog/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> &amp; 0&#215;0FF;<br />
						var b:int = (rgb &gt;&gt; 0) &amp; 0&#215;0FF;</p>
<p>						var Rres:Number = Rmdx[m + 1] * Rdyn[n + 1];<br />
						rsum += r * Rres;<br />
						gsum += g * Rres;<br />
						bsum += b * Rres;<br />
					}<br />
				}</p>
<p>				var red:int = (int)(rsum + 0.5);<br />
				if (red  255)<br />
					red = 255;<br />
				var green:int = (int)(gsum + 0.5);<br />
				if (green  255)<br />
					green = 255;<br />
				var blue:int = (int)(bsum + 0.5);<br />
				if (blue  255)<br />
					blue = 255;</p>
<p>				return (red &lt;&lt; 16) | (green &lt;&lt; <img src='http://www.cafesilencio.net/blog/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> | (blue &lt;&lt; 0);<br />
			}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob Kunkle</title>
		<link>http://www.cafesilencio.net/blog/bitmapdata-resize-quality-in-flex-and-air#comment-241</link>
		<dc:creator>Rob Kunkle</dc:creator>
		<pubDate>Tue, 07 Apr 2009 21:42:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.cafesilencio.net/blog/?p=104#comment-241</guid>
		<description>@janos thanks for the tip...bluring the original before resizing had better results for images than any of the other techniques I've tried!</description>
		<content:encoded><![CDATA[<p>@janos thanks for the tip&#8230;bluring the original before resizing had better results for images than any of the other techniques I&#8217;ve tried!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Janos</title>
		<link>http://www.cafesilencio.net/blog/bitmapdata-resize-quality-in-flex-and-air#comment-49</link>
		<dc:creator>Janos</dc:creator>
		<pubDate>Mon, 09 Mar 2009 12:58:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.cafesilencio.net/blog/?p=104#comment-49</guid>
		<description>Hi Seth,

I worked around the issue and found an interesting solution. It seams, if you apply a blur on the original image and then resize, the quality of the resized image will be much nicer. Check out my post here http://kun-janos.ro/blog/?p=107</description>
		<content:encoded><![CDATA[<p>Hi Seth,</p>
<p>I worked around the issue and found an interesting solution. It seams, if you apply a blur on the original image and then resize, the quality of the resized image will be much nicer. Check out my post here <a href="http://kun-janos.ro/blog/?p=107" rel="nofollow">http://kun-janos.ro/blog/?p=107</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: seth</title>
		<link>http://www.cafesilencio.net/blog/bitmapdata-resize-quality-in-flex-and-air#comment-34</link>
		<dc:creator>seth</dc:creator>
		<pubDate>Fri, 06 Mar 2009 13:46:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.cafesilencio.net/blog/?p=104#comment-34</guid>
		<description>While the image quality isn't perfect I think the clevr algorithm produces better results then the results achieved by using the default resizing in the Flex API.  Hopefully Adobe will provide better image resizing algorithms in the future.</description>
		<content:encoded><![CDATA[<p>While the image quality isn&#8217;t perfect I think the clevr algorithm produces better results then the results achieved by using the default resizing in the Flex API.  Hopefully Adobe will provide better image resizing algorithms in the future.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Janos</title>
		<link>http://www.cafesilencio.net/blog/bitmapdata-resize-quality-in-flex-and-air#comment-33</link>
		<dc:creator>Janos</dc:creator>
		<pubDate>Fri, 06 Mar 2009 12:43:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.cafesilencio.net/blog/?p=104#comment-33</guid>
		<description>Tried your code for resizing an image, but the result was a poor quality image. Unfortunately :(</description>
		<content:encoded><![CDATA[<p>Tried your code for resizing an image, but the result was a poor quality image. Unfortunately <img src='http://www.cafesilencio.net/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
</channel>
</rss>
