<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>SnippetRepoBrowser</title>
    <link>http://snippet.gnstudio.com/snippetrepobrowser/index</link>    
    <description>RSS Feed of SnippetRepoBrowser (Global RSS)</description>    
    <language>en-us</language>
    <pubDate>Fri, 18 May 2012 14:25:48 +0200</pubDate>
    <docs>SnippetRepoBrowser/index</docs>
    <generator>SnippetRepoBrowser Feed Generator</generator>
    <item>
      <title><![CDATA[Center image content]]></title>
      <link>http://snippet.gnstudio.com/viewtopic/20</link>
      <description><![CDATA[If you get a bitmap data as source of an image component and you want to center it you have to create a new bitmap, create a new matrix, apply a transformation (in the snippet the translation is done accordingly to the component with) and then use again the BitmapData class to draw the new data accordingly to the transoformation<br />]]><![CDATA[<div class="divcode"><pre class="prettyprint">var imageData:BitmapData = BitmapData(someRawBitmapData);<br />					<br />var bmp:Bitmap =  new Bitmap(imageData);<br />					<br />var matrix:Matrix = new Matrix();<br />matrix.translate(-((imageData.width - this.width) / 2), -((imageData.height - this.height) / 2));<br /><br />var matriximage:BitmapData = new BitmapData(bmp.height, bmp.width, false, 0x00000000);<br />matriximage.draw(bmp, matrix);<br />					<br />// Suppose imgThumbnail	is the ID of your component			<br />imgThumbnail.source = new Bitmap(matriximage);<br />					</pre></div><br /><br />]]></description>
      <author>Giorgio Natili</author>
      <pubDate>Tue, 29 Sep 2009 11:27:25 +0200</pubDate>
      <category>Flex 3.x</category>
      <guid>http://snippet.gnstudio.com/viewtopic/20</guid>
   </item>
  </channel>
</rss>
