<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" 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:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Sephiroth.it</title>
	
	<link>http://blog.sephiroth.it</link>
	<description>programmer by pure chance</description>
	<lastBuildDate>Sat, 28 Jan 2012 19:11:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/sephiroth/blog" /><feedburner:info uri="sephiroth/blog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Android Wheel Widget</title>
		<link>http://feedproxy.google.com/~r/sephiroth/blog/~3/74Azs_JU2B4/</link>
		<comments>http://blog.sephiroth.it/2012/01/28/android-wheel-widget/#comments</comments>
		<pubDate>Sat, 28 Jan 2012 19:11:35 +0000</pubDate>
		<dc:creator>Alessandro Crugnola</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[widget]]></category>

		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1616</guid>
		<description><![CDATA[This is a simple widget I created as part of the Aviary Editor SDK for Android. It creates a wheel-like widet which can be scrolled in both directions. The idea was to replace the default slider widget and use a more &#8220;real world&#8221; component. Moreover if you&#8217;ll add the VIBRATE permission into your AndroidManifest.xml file [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><a href="http://blog.sephiroth.it/wp-content/uploads/2012/01/landing-phone-1.jpg" rel="shadowbox[sbpost-1616];player=img;"><img class="alignleft size-medium wp-image-1617" title="landing-phone-1" src="http://blog.sephiroth.it/wp-content/uploads/2012/01/landing-phone-1-170x300.jpg" alt="" width="170" height="300" /></a></p>
<p>This is a simple widget I created as part of the <a title="Aviary Editor SDK" href="http://www.aviary.com/android" target="_blank">Aviary Editor SDK</a> for Android. It creates a wheel-like widet which can be scrolled in both directions.<br />
The idea was to replace the default slider widget and use a more &#8220;real world&#8221; component.<br />
Moreover if you&#8217;ll add the VIBRATE permission into your AndroidManifest.xml file you&#8217;ll have also haptics feedback while the wheel is scrolling:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;uses-permission android:name=&quot;android.permission.VIBRATE&quot; /&gt;</div></td></tr></tbody></table></div>
<p>To include the wheel widget in the current layout, you should add in the layout xml this lines:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;it.sephiroth.android.wheel.view.Wheel<br />
android:id=&quot;@+id/wheel&quot;<br />
xmlns:sephiroth=&quot;http://schemas.android.com/apk/res/it.sephiroth.android.wheel&quot;<br />
android:layout_width=&quot;match_parent&quot;<br />
android:layout_height=&quot;match_parent&quot;<br />
sephiroth:numRotations=&quot;6&quot;<br />
sephiroth:ticks=&quot;28&quot; /&gt;</div></td></tr></tbody></table></div>
<p>Where <strong>numRotations</strong> is the max number of rotations the wheel can perform and <strong>ticks</strong> is the total number of ticks the wheel will display.</p>
<p>Then in your <a href="http://developer.android.com/reference/android/app/Activity.html">activity</a> you can add a <strong>OnScrollListener</strong> listener to the wheel widget, in this way:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mWheel = (Wheel) findViewById( R.id.wheel );<br />
mWheel.setOnScrollListener( new OnScrollListener() {<br />
<br />
@Override<br />
public void onScrollStarted( Wheel view, float value, int roundValue ) {<br />
}<br />
<br />
@Override<br />
public void onScrollFinished( Wheel view, float value, int roundValue ) {<br />
}<br />
<br />
@Override<br />
public void onScroll( Wheel view, float value, int roundValue ) {<br />
}<br />
} );</div></td></tr></tbody></table></div>
<p>You can download the source at the <a href="https://github.com/sephiroth74/AndroidWheel" target="_blank">gihub project page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sephiroth.it/2012/01/28/android-wheel-widget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.sephiroth.it/2012/01/28/android-wheel-widget/</feedburner:origLink></item>
		<item>
		<title>Android Workspace Widget</title>
		<link>http://feedproxy.google.com/~r/sephiroth/blog/~3/ewuIWbGyris/</link>
		<comments>http://blog.sephiroth.it/2011/11/01/android-workspace-widget/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 02:48:09 +0000</pubDate>
		<dc:creator>Alessandro Crugnola</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[widget]]></category>
		<category><![CDATA[workspace]]></category>

		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1592</guid>
		<description><![CDATA[&#160; I was looking for an android widget similar to the launcher workspace widget ( the one used in almost all launchers ), but a bit more customizable and with the possibility to use an Adapter as content provider. So at the end I mixed portion of code from the android launcher Workspace widget, the Gallery [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>&nbsp;</p>
<p><a href="http://blog.sephiroth.it/wp-content/uploads/2011/11/device-2011-10-31-220138.png" rel="shadowbox[sbpost-1592];player=img;"><img class="size-thumbnail wp-image-1598 alignright" title="workspace_thumb" src="http://blog.sephiroth.it/wp-content/uploads/2011/11/workspace_thumb-150x150.png" alt="" width="150" height="150" /></a>I was looking for an android widget similar to the launcher workspace widget ( the one used in almost all launchers ), but a bit more customizable and with the possibility to use an Adapter as content provider. So at the end I mixed portion of code from the android launcher <a href="http://www.google.com/codesearch/p?hl=en#cZwlSNS7aEw/packages/apps/Launcher2/src/com/android/launcher2/Workspace.java">Workspace</a> widget, the <a href="http://www.google.com/codesearch/p?hl=en#cZwlSNS7aEw/frameworks/base/core/java/android/widget/Gallery.java&amp;q=Gallery.java&amp;exact_package=android&amp;type=cs">Gallery</a> widget and the <a href="http://www.google.com/codesearch/p?hl=en#cZwlSNS7aEw/frameworks/base/core/java/android/widget/AbsListView.java&amp;q=AbsListView.java&amp;exact_package=android&amp;type=cs">AbsListView</a> widget.</p>
<p>Nothing particular tricky, just a combination of the 3 widgets in order to have the same sliding effect of the workspace ( using custom number of columns and rows ), but at the same time with an <strong>ArrayAdapter</strong> for creating views, and a little glow effect at start at the end of scrolling for creating the gingerbread style overscroll effect.</p>
<p>This is the source code: <strong><a href="http://blog.sephiroth.it/wp-content/uploads/2011/11/workspace.zip">workspace</a></strong></p>
<p>It&#8217;s just a first version, so it&#8217;s not really optimized&#8230;</p>
<p>The adapter used for creating this example looks like this:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:450px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">class WorkspaceAdapter extends ArrayAdapter&lt;applicationinfo&gt; {<br />
<br />
&nbsp; &nbsp;int screenId;<br />
&nbsp; &nbsp;PackageManager pm;<br />
&nbsp; &nbsp;private LayoutInflater mInflater;<br />
&nbsp; &nbsp;private int nCellsPerScreen = 4;<br />
<br />
&nbsp; &nbsp;public WorkspaceAdapter( Context context, int textViewResourceId, List&lt;/applicationinfo&gt;&lt;applicationinfo&gt; objects ) {<br />
&nbsp; &nbsp; &nbsp; super( context, textViewResourceId, objects );<br />
&nbsp; &nbsp; &nbsp; screenId = textViewResourceId;<br />
&nbsp; &nbsp; &nbsp; pm = context.getPackageManager();<br />
&nbsp; &nbsp; &nbsp; nCellsPerScreen = context.getResources().getInteger( R.integer.config_portraitCells ) * context.getResources().getInteger( R.integer.config_portraitRows );<br />
&nbsp; &nbsp; &nbsp; mInflater = (LayoutInflater) context.getSystemService( LAYOUT_INFLATER_SERVICE );<br />
&nbsp; &nbsp;}<br />
<br />
&nbsp; &nbsp;@Override<br />
&nbsp; &nbsp;public int getCount() {<br />
&nbsp; &nbsp; &nbsp; return (int) Math.ceil( (double) super.getCount() / nCellsPerScreen );<br />
&nbsp; &nbsp;}<br />
<br />
&nbsp; &nbsp;public int getRealCount() {<br />
&nbsp; &nbsp; &nbsp; return super.getCount();<br />
&nbsp; &nbsp;}<br />
<br />
&nbsp; &nbsp;@Override<br />
&nbsp; &nbsp;public View getView( int position, View convertView, ViewGroup parent ) {<br />
<br />
&nbsp; &nbsp; &nbsp; if ( convertView == null ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;convertView = mInflater.inflate( screenId, mWorkspace, false );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;((CellLayout)convertView).setNumCols( nCellsPerScreen );<br />
&nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; CellLayout cell = (CellLayout) convertView;<br />
<br />
&nbsp; &nbsp; &nbsp; int index = position * nCellsPerScreen;<br />
&nbsp; &nbsp; &nbsp; int realCount = getRealCount();<br />
<br />
&nbsp; &nbsp; &nbsp; for ( int i = 0; i &lt; nCellsPerScreen; i++ ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CellInfo cellInfo = cell.findVacantCell( 1, 1 );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TextView text;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ( cellInfo == null ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text = (TextView) cell.getChildAt( i );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} else {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text = (TextView) mInflater.inflate( R.layout.application_boxed, cell, false );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CellLayout.LayoutParams lp = new CellLayout.LayoutParams( cellInfo.cellX, cellInfo.cellY, cellInfo.spanH,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cellInfo.spanV );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cell.addView( text, i, lp );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ( index + i &lt; realCount ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ApplicationInfo appInfo = getItem( index + i );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CharSequence label = appInfo.loadLabel( pm );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Drawable bm = appInfo.loadIcon( pm );<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text.setCompoundDrawablesWithIntrinsicBounds( null, bm, null, null ); // new<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text.setText( label );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text.setClickable( true );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text.setFocusable( true );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text.setVisibility( View.VISIBLE );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} else {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text.setVisibility( View.INVISIBLE );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; return convertView;<br />
&nbsp; &nbsp;}<br />
}</div></td></tr></tbody></table></div>
<p>&nbsp;</p>
<p></applicationinfo></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sephiroth.it/2011/11/01/android-workspace-widget/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.sephiroth.it/2011/11/01/android-workspace-widget/</feedburner:origLink></item>
		<item>
		<title>Compile skia for android on Mac Lion</title>
		<link>http://feedproxy.google.com/~r/sephiroth/blog/~3/1DdbUx8UCSI/</link>
		<comments>http://blog.sephiroth.it/2011/10/17/compiling-android-source-on-mac-lion/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 00:23:28 +0000</pubDate>
		<dc:creator>Alessandro Crugnola</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[lion]]></category>
		<category><![CDATA[skia]]></category>

		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1575</guid>
		<description><![CDATA[Some time ago I started to look at skia as possible solution for graphics 2D editing for a native android project I was developing. Well, even if skia is part of the android system and it&#8217;s used everywhere by android itself, trying to include skia in my project was quite an hell.. Looking for resources [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Some time ago I started to look at <a title="skia on google code" href="http://code.google.com/p/skia/" target="_blank">skia</a> as possible solution for graphics 2D editing for a native android project I was developing.<br />
Well, even if skia is part of the android system and it&#8217;s used everywhere by android itself, trying to include skia in my project was quite an hell..<br />
Looking for resources I just found old examples and tips, and every try was just a failure.. but since android uses skia internally to do graphics operations I decided to look into the android project.</p>
<p>After downloading the skia module from the android git repository I just realized it couldn&#8217;t be compiled by itself because it has external dependencies. So next step was to download and compile the whole android source code. Easy task? not at all, at least if you&#8217;re on a mac running Lion!</p>
<p>At the end I managed to compile everything and build the skia module as static module, in this way now my project can link the skia library and include correctly the skia headers.</p>
<p>Ok, I don&#8217;t have the whole procedure step by step here, first of all because it depends on the android version you&#8217;re going to compiled, second and most important because I didn&#8217;t write down all the steps <img src='http://blog.sephiroth.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  So this is more a sort of list of notes about compiling android on Lion and a reminder for myself too. ( I was trying to compile android 2.2 using &#8220;generic-user&#8221; as lunch configuration )</p>
<p>Build Android: <a title="build android source" href="http://source.android.com/source/initializing.html" target="_blank">http://source.android.com/source/initializing.html</a></p>
<p>To get rid of clearsilver errors: <a href="http://code.google.com/p/android/issues/detail?id=993#c27" target="_blank">http://code.google.com/p/android/issues/detail?id=993#c27</a></p>
<p>Java 1.5 version complaining: <a href="http://wiki.oneswarm.org/index.php/OS_X_10.6_Snow_Leopard" target="_blank">http://wiki.oneswarm.org/index.php/OS_X_10.6_Snow_Leopard</a></p>
<p>Well, the first time you&#8217;ll try to &#8220;<strong>make</strong>&#8221; everything probably you&#8217;ll get this error:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">./external/elfutils/config-compat-darwin.h:42: error: static declaration of ‘strnlen’ follows non-static declaration</div></td></tr></tbody></table></div>
<p><strong>modify ./external/elfutils/config-compat-darwin.h.</strong><br />
replace:</p>
<div class="codecolorer-container c mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333;">static</span> <span style="color: #000000; font-weight: bold;">inline</span> <span style="color: #993333;">size_t</span> strnlen <span style="color: #009900;">&#40;</span><span style="color: #993333;">const</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>__string<span style="color: #339933;">,</span> <span style="color: #993333;">size_t</span> __maxlen<span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
<span style="color: #993333;">int</span> len <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>__maxlen<span style="color: #339933;">--</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">*</span>__string<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><br />
len<span style="color: #339933;">++;</span><br />
<span style="color: #b1b100;">return</span> len<span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>with:</p>
<div class="codecolorer-container c mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">#if 0</span><br />
<span style="color: #993333;">static</span> <span style="color: #000000; font-weight: bold;">inline</span> <span style="color: #993333;">size_t</span> strnlen <span style="color: #009900;">&#40;</span><span style="color: #993333;">const</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>__string<span style="color: #339933;">,</span> <span style="color: #993333;">size_t</span> __maxlen<span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
<span style="color: #993333;">int</span> len <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>__maxlen<span style="color: #339933;">--</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">*</span>__string<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><br />
len<span style="color: #339933;">++;</span><br />
<span style="color: #b1b100;">return</span> len<span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #339933;">#endif</span></div></td></tr></tbody></table></div>
<p>Well, at the end of the process I just edited the Android.mk makefile into external/skia adding a new entry for BUILD_STATIC_LIBRARY and the next command was simply:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mmm external/skia</div></td></tr></tbody></table></div>
<p>which produced the required libskia.a file to be linked in my project.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sephiroth.it/2011/10/17/compiling-android-source-on-mac-lion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.sephiroth.it/2011/10/17/compiling-android-source-on-mac-lion/</feedburner:origLink></item>
		<item>
		<title>Aviary is hiring!</title>
		<link>http://feedproxy.google.com/~r/sephiroth/blog/~3/W5McDUd1oe0/</link>
		<comments>http://blog.sephiroth.it/2011/09/16/aviary-is-hiring/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 20:13:53 +0000</pubDate>
		<dc:creator>Alessandro Crugnola</dc:creator>
				<category><![CDATA[aviary]]></category>
		<category><![CDATA[jobs]]></category>
		<category><![CDATA[nyc]]></category>

		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1577</guid>
		<description><![CDATA[Are you a ASP.NET developer in NYC? If so you may be interested: http://bit.ly/oPZxzE &#160;]]></description>
			<content:encoded><![CDATA[<p></p><p>Are you a ASP.NET developer in <strong>NYC</strong>?<br />
If so you may be interested: <a href="http://bit.ly/oPZxzE">http://bit.ly/oPZxzE</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sephiroth.it/2011/09/16/aviary-is-hiring/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://blog.sephiroth.it/2011/09/16/aviary-is-hiring/</feedburner:origLink></item>
		<item>
		<title>QuickActionView in Android</title>
		<link>http://feedproxy.google.com/~r/sephiroth/blog/~3/Iws3JLkbuvY/</link>
		<comments>http://blog.sephiroth.it/2011/07/09/quickactionview-in-android/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 19:24:41 +0000</pubDate>
		<dc:creator>Alessandro Crugnola</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[quickaction]]></category>
		<category><![CDATA[quickcontact badge]]></category>

		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1559</guid>
		<description><![CDATA[While I was searching for an custom implementation of the QuickContactBadge for Android, I went into this interesting post ( Lorenz’s Blog ), which had a custom widget called QuickAction. While it&#8217;s a very nice widget, it didn&#8217;t fit my needs because I had the necessity of create different action layouts ( horizontal, vertical, grid.. [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>While I was searching for an custom implementation of the <a href="http://developer.android.com/reference/android/widget/QuickContactBadge.html" target="_blank">QuickContactBadge</a> for Android, I went into this <a href="http://bit.ly/qU8vTQ" target="_blank">interesting post</a> ( <strong>Lorenz’s Blog</strong> ), which had a custom widget called <strong>QuickAction</strong>.<br />
While it&#8217;s a very nice widget, it didn&#8217;t fit my needs because I had the necessity of create different action layouts ( horizontal, vertical, grid.. ), so I made a very quick modification to the above code and I ended with this implementation.<br />
Basically I removed from the original Class the ActionItem list and set a <strong>BaseAdapter</strong> as content source. In this way it&#8217;s more simple and easy to add more and different views to the widget.<br />
Moreover I added the support for columns ( both fixed and automatic ).<br />
Here you can see a snippet code of the <strong>QuickActionView</strong> creation:</p>
<div class="codecolorer-container java mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:450px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onButtonClick<span style="color: #009900;">&#40;</span> <span style="color: #003399;">View</span> v <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp;<span style="color: #666666; font-style: italic;">// create the quick action view, passing the view anchor</span><br />
&nbsp; &nbsp;QuickActionView qa <span style="color: #339933;">=</span> QuickActionView.<span style="color: #006633;">Builder</span><span style="color: #009900;">&#40;</span> v <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp;<span style="color: #666666; font-style: italic;">// set the adapter</span><br />
&nbsp; &nbsp;qa.<span style="color: #006633;">setAdapter</span><span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> CustomAdapter<span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">this</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp;<span style="color: #666666; font-style: italic;">// set the number of columns ( setting -1 for auto )</span><br />
&nbsp; &nbsp;qa.<span style="color: #006633;">setNumColumns</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Math</span>.<span style="color: #006633;">random</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;qa.<span style="color: #006633;">setOnClickListener</span><span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> DialogInterface.<span style="color: #006633;">OnClickListener</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onClick<span style="color: #009900;">&#40;</span> DialogInterface dialog, <span style="color: #000066; font-weight: bold;">int</span> which <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dialog.<span style="color: #006633;">dismiss</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Toast.<span style="color: #006633;">makeText</span><span style="color: #009900;">&#40;</span> getBaseContext<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <span style="color: #0000ff;">&quot;Selected item: &quot;</span> <span style="color: #339933;">+</span> which, Toast.<span style="color: #006633;">LENGTH_SHORT</span> <span style="color: #009900;">&#41;</span>.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp;<span style="color: #666666; font-style: italic;">// finally show the view</span><br />
&nbsp; &nbsp;qa.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>Here some Screenshots:</p>

<a href='http://blog.sephiroth.it/wp-content/uploads/2011/07/device-2011-07-09-144935.png' rel='shadowbox[sbalbum-1559];player=img;' title='device-2011-07-09-144935'><img width="150" height="150" src="http://blog.sephiroth.it/wp-content/uploads/2011/07/device-2011-07-09-144935-150x150.png" class="attachment-thumbnail" alt="device-2011-07-09-144935" title="device-2011-07-09-144935" /></a>
<a href='http://blog.sephiroth.it/wp-content/uploads/2011/07/device-2011-07-09-144920.png' rel='shadowbox[sbalbum-1559];player=img;' title='device-2011-07-09-144920'><img width="150" height="150" src="http://blog.sephiroth.it/wp-content/uploads/2011/07/device-2011-07-09-144920-150x150.png" class="attachment-thumbnail" alt="device-2011-07-09-144920" title="device-2011-07-09-144920" /></a>
<a href='http://blog.sephiroth.it/wp-content/uploads/2011/07/device-2011-07-09-144859.png' rel='shadowbox[sbalbum-1559];player=img;' title='device-2011-07-09-144859'><img width="150" height="150" src="http://blog.sephiroth.it/wp-content/uploads/2011/07/device-2011-07-09-144859-150x150.png" class="attachment-thumbnail" alt="device-2011-07-09-144859" title="device-2011-07-09-144859" /></a>

<p>And here you can find the source code: <strong><a href="http://blog.sephiroth.it/wp-content/uploads/2011/07/quickactionviewdemo.zip">source code</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sephiroth.it/2011/07/09/quickactionview-in-android/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://blog.sephiroth.it/2011/07/09/quickactionview-in-android/</feedburner:origLink></item>
		<item>
		<title>FBTracer updated to Firefox 5</title>
		<link>http://feedproxy.google.com/~r/sephiroth/blog/~3/Td4DTAeWTc4/</link>
		<comments>http://blog.sephiroth.it/2011/07/02/fbtracer-updated-to-firefox-5/#comments</comments>
		<pubDate>Sat, 02 Jul 2011 18:29:23 +0000</pubDate>
		<dc:creator>Alessandro Crugnola</dc:creator>
				<category><![CDATA[firefox]]></category>
		<category><![CDATA[extensions]]></category>
		<category><![CDATA[fbtracer]]></category>

		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1554</guid>
		<description><![CDATA[FBTracer aka Flash Tracer has been just updated to version 0.1.3 ( also thanks to Daniel D. Vanzin ) which is now compatible with the new Firefox 5. If you already have the extension installed it&#8217;s just a matter of check updates from the addons firefox page, otherwise you can download the extension from this [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><em></p>
<div id="attachment_377" class="wp-caption alignleft" style="width: 150px">
	<a href="http://blog.sephiroth.it/wp-content/uploads/2010/03/screenshot_1.png" rel="shadowbox[sbpost-1554];player=img;"><img class="size-thumbnail wp-image-377" title="fbtracer" src="http://blog.sephiroth.it/wp-content/uploads/2010/03/screenshot_1-150x150.png" alt="" width="150" height="150" /></a>
	<p class="wp-caption-text">FBTracer in action</p>
</div>
<p></em><strong>FBTracer</strong> aka Flash Tracer has been just updated to version 0.1.3 ( also thanks to <em>Daniel D. Vanzin</em> ) which is now compatible with the new <a title="Download Firefox 5" href="http://www.mozilla.com/it/firefox/">Firefox 5</a>.</p>
<p>If you already have the extension installed it&#8217;s just a matter of check updates from the addons firefox page, otherwise you can download the extension from this page: <a title="Flash Tracer for Firefox download page" href="http://blog.sephiroth.it/firefox-extensions/flash-tracer-for-firebug/">http://blog.sephiroth.it/firefox-extensions/flash-tracer-for-firebug/</a></p>
<p><em>Note. After a fresh install or update of the plugin, sometimes the fbtracer panel doesn&#8217;t refresh itself&#8230; in that case a firefox restart will fix the problem.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sephiroth.it/2011/07/02/fbtracer-updated-to-firefox-5/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://blog.sephiroth.it/2011/07/02/fbtracer-updated-to-firefox-5/</feedburner:origLink></item>
		<item>
		<title>ImageView Zoom and Scroll</title>
		<link>http://feedproxy.google.com/~r/sephiroth/blog/~3/DI9i2gks1SM/</link>
		<comments>http://blog.sephiroth.it/2011/04/04/imageview-zoom-and-scroll/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 21:31:09 +0000</pubDate>
		<dc:creator>Alessandro Crugnola</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[ImageView]]></category>
		<category><![CDATA[scroll]]></category>
		<category><![CDATA[zoom]]></category>

		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1519</guid>
		<description><![CDATA[As long as Android doesn&#8217;t have a built-in ImageView widget with zoom and scroll capabilities I tries to create one by myself starting from the google repository. The result is pretty nice so I&#8217;m posting here the source code, if anyone is interested, or simply doesn&#8217;t want to waste the time creating a new one. [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><a href="http://blog.sephiroth.it/wp-content/uploads/2011/04/Screen-shot-2011-04-04-at-17.09.04.png" rel="shadowbox[sbpost-1519];player=img;"><img class="alignleft size-thumbnail wp-image-1530" style="margin: 5px;" title="Screen shot 2011-04-04 at 17.09.04" src="http://blog.sephiroth.it/wp-content/uploads/2011/04/Screen-shot-2011-04-04-at-17.09.04-150x150.png" alt="" width="150" height="150" /></a>As long as Android doesn&#8217;t have a built-in <a href="http://developer.android.com/reference/android/widget/ImageView.html">ImageView</a> widget with zoom and scroll capabilities I tries to create one by myself starting from the <a href="http://source.android.com/source/download.html">google repository</a>.</p>
<p>The result is pretty nice so I&#8217;m posting here the source code, if anyone is interested, or simply doesn&#8217;t want to waste the time creating a new one.</p>
<p>Here&#8217;s a sample code on how to use it in an Activity:</p>
<div class="codecolorer-container java mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:450px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">it.sephiroth.android.demo</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">it.sephiroth.android.library.imagezoom.ImageViewTouch</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.Activity</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.database.Cursor</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.graphics.Bitmap</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.net.Uri</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Bundle</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.provider.MediaStore.Images</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.Window</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.WindowManager</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.Toast</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ImageZoomActivity <span style="color: #000000; font-weight: bold;">extends</span> Activity <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">private</span> ImageViewTouch &nbsp;mImageView<span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp;@Override<br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> onCreate<span style="color: #009900;">&#40;</span> Bundle savedInstanceState <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreate</span><span style="color: #009900;">&#40;</span> savedInstanceState <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; requestWindowFeature<span style="color: #009900;">&#40;</span> <span style="color: #003399;">Window</span>.<span style="color: #006633;">FEATURE_NO_TITLE</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; setContentView<span style="color: #009900;">&#40;</span> R.<span style="color: #006633;">layout</span>.<span style="color: #006633;">main</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; getWindow<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">addFlags</span><span style="color: #009900;">&#40;</span> WindowManager.<span style="color: #006633;">LayoutParams</span>.<span style="color: #006633;">FLAG_FULLSCREEN</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; selectRandomImage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp;@Override<br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onContentChanged<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onContentChanged</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; mImageView <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>ImageViewTouch<span style="color: #009900;">&#41;</span>findViewById<span style="color: #009900;">&#40;</span> R.<span style="color: #006633;">id</span>.<span style="color: #006633;">imageView1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp;<span style="color: #008000; font-style: italic; font-weight: bold;">/**<br />
&nbsp; &nbsp; * pick a random image from your library<br />
&nbsp; &nbsp; * and display it<br />
&nbsp; &nbsp; */</span><br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> selectRandomImage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #003399;">Cursor</span> c <span style="color: #339933;">=</span> getContentResolver<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">query</span><span style="color: #009900;">&#40;</span> Images.<span style="color: #006633;">Media</span>.<span style="color: #006633;">EXTERNAL_CONTENT_URI</span>, <span style="color: #000066; font-weight: bold;">null</span>, <span style="color: #000066; font-weight: bold;">null</span>, <span style="color: #000066; font-weight: bold;">null</span>, <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> c <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066; font-weight: bold;">int</span> count <span style="color: #339933;">=</span> c.<span style="color: #006633;">getCount</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066; font-weight: bold;">int</span> position <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span> <span style="color: #003399;">Math</span>.<span style="color: #006633;">random</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> count <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> c.<span style="color: #006633;">moveToPosition</span><span style="color: #009900;">&#40;</span> position <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">long</span> id <span style="color: #339933;">=</span> c.<span style="color: #006633;">getLong</span><span style="color: #009900;">&#40;</span> c.<span style="color: #006633;">getColumnIndex</span><span style="color: #009900;">&#40;</span> Images.<span style="color: #006633;">Media</span>._ID <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> orientation <span style="color: #339933;">=</span> c.<span style="color: #006633;">getInt</span><span style="color: #009900;">&#40;</span> c.<span style="color: #006633;">getColumnIndex</span><span style="color: #009900;">&#40;</span> Images.<span style="color: #006633;">Media</span>.<span style="color: #006633;">ORIENTATION</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Uri imageUri <span style="color: #339933;">=</span> Uri.<span style="color: #006633;">parse</span><span style="color: #009900;">&#40;</span> Images.<span style="color: #006633;">Media</span>.<span style="color: #006633;">EXTERNAL_CONTENT_URI</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">+</span> id <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Bitmap bitmap<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bitmap <span style="color: #339933;">=</span> ImageLoader.<span style="color: #006633;">loadFromUri</span><span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">this</span>, imageUri.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <span style="color: #cc66cc;">1024</span>, <span style="color: #cc66cc;">1024</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mImageView.<span style="color: #006633;">setImageBitmapReset</span><span style="color: #009900;">&#40;</span> bitmap, orientation, <span style="color: #000066; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span> <span style="color: #003399;">IOException</span> e <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Toast.<span style="color: #006633;">makeText</span><span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">this</span>, e.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, Toast.<span style="color: #006633;">LENGTH_LONG</span> <span style="color: #009900;">&#41;</span>.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;c.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;c <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#125;</span>&nbsp; <br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Anyway, if you want to download the source, here is the eclipse source project:<br />
<a href="http://blog.sephiroth.it/wp-content/uploads/2011/04/ImageZoom.zip">http://blog.sephiroth.it/wp-&#8230;/ImageZoom.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sephiroth.it/2011/04/04/imageview-zoom-and-scroll/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		<feedburner:origLink>http://blog.sephiroth.it/2011/04/04/imageview-zoom-and-scroll/</feedburner:origLink></item>
		<item>
		<title>Widget: SlidingDrawer top to bottom</title>
		<link>http://feedproxy.google.com/~r/sephiroth/blog/~3/IaSALEKoxfw/</link>
		<comments>http://blog.sephiroth.it/2011/03/29/widget-slidingdrawer-top-to-bottom/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 16:36:59 +0000</pubDate>
		<dc:creator>Alessandro Crugnola</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[sliding drawer]]></category>
		<category><![CDATA[widget]]></category>

		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1511</guid>
		<description><![CDATA[My android experiments continue&#8230; In the last project I had to implement a SlidingDrawer which comes from top and left. The problem was that the default widget does not support all the directions, but only bottom to top and right to left. That&#8217;s why I grabbed the SlidingDrawer source code and modified it in order [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><a href="http://blog.sephiroth.it/wp-content/uploads/2011/03/device.png" rel="shadowbox[sbpost-1511];player=img;"><img class="size-thumbnail wp-image-1512 alignright" style="margin: 5px;" title="slidingdrawer screenshot" src="http://blog.sephiroth.it/wp-content/uploads/2011/03/device-150x150.png" alt="" width="150" height="150" /></a>My android experiments continue&#8230;<br />
In the last project I had to implement a <a href="http://developer.android.com/reference/android/widget/SlidingDrawer.html" target="_blank">SlidingDrawer</a> which comes from top and left. The problem was that the default widget does not support all the directions, but only bottom to top and right to left.</p>
<p>That&#8217;s why I grabbed the SlidingDrawer source code and modified it in order to allow any direction ( defined as styleable in attrs.xml ). The only problem using custom styleable xml is that if you want to use this widget as library you need to include in the main project also the attrs.xml file as well.. a bit frustrating.</p>
<p>Anyway this is just the sample xml how to include the widget:</p>
<div class="codecolorer-container xml mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;relativelayout</span> <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; <span style="color: #000066;">android:orientation</span>=<span style="color: #ff0000;">&quot;vertical&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;view</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;it.sephiroth.demo.slider.widget.MultiDirectionSlidingDrawer&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp;<span style="color: #000066;">xmlns:my</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/it.sephiroth.demo.slider&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/drawer&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp;<span style="color: #000066;">my:direction</span>=<span style="color: #ff0000;">&quot;topToBottom&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp;<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp;<span style="color: #000066;">my:handle</span>=<span style="color: #ff0000;">&quot;@+id/handle&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp;<span style="color: #000066;">my:content</span>=<span style="color: #ff0000;">&quot;@+id/content&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@id/content&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">layout</span>=<span style="color: #ff0000;">&quot;@layout/pen_content&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;imageview</span> <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@id/handle&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;40px&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">android:src</span>=<span style="color: #ff0000;">&quot;@drawable/sliding_drawer_handle_bottom&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/view<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/relativelayout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></td></tr></tbody></table></div>
<p>Btw If you&#8217;re interest, here you can find the full source code of the widget including a running application:</p>
<p><strong><a href="http://blog.sephiroth.it/wp-content/uploads/2011/03/SlidingDrawerDemo1.zip">SlidingDrawer Demo</a> </strong></p>
<p>* Updated the code thanks to <i>Maciej Ciemięga</i>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sephiroth.it/2011/03/29/widget-slidingdrawer-top-to-bottom/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		<feedburner:origLink>http://blog.sephiroth.it/2011/03/29/widget-slidingdrawer-top-to-bottom/</feedburner:origLink></item>
		<item>
		<title>Multipage TIF to PDF</title>
		<link>http://feedproxy.google.com/~r/sephiroth/blog/~3/H4Z2Yp1foOM/</link>
		<comments>http://blog.sephiroth.it/2011/02/17/multipage-tif-to-pdf/#comments</comments>
		<pubDate>Thu, 17 Feb 2011 19:00:06 +0000</pubDate>
		<dc:creator>Alessandro Crugnola</dc:creator>
				<category><![CDATA[purePDF]]></category>
		<category><![CDATA[multipage]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[tif]]></category>

		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1503</guid>
		<description><![CDATA[Recently I&#8217;ve continued the porting of iText adding the support for a new image type: multipage tif. The only problem with this update is that actually it&#8217;s really slow and probably with very complex image files it can hang the player for too long. Probably I should modify the ImageElement.getInstance method and make it asynchronous [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Recently I&#8217;ve continued the porting of iText adding the support for a new image type: <a href="http://en.wikipedia.org/wiki/Tagged_Image_File_Format" target="_blank">multipage tif</a>.</p>
<p>The only problem with this update is that actually it&#8217;s really slow and probably with very complex image files it can hang the player for too long. Probably I should modify the <strong>ImageElement.getInstance</strong> method and make it asynchronous in order to prevent flash player to freeze&#8230;</p>
<p>Anyway, the current trunk version of purePDF can handle TIF image and here a simple code example:</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:450px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br />86<br />87<br />88<br />89<br />90<br />91<br />92<br />93<br />94<br />95<br />96<br />97<br />98<br />99<br />100<br />101<br />102<br />103<br />104<br />105<br />106<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">package<br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">TimerEvent</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #006600;">FileReference</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">ByteArray</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">Timer</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">getQualifiedClassName</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">purepdf</span>.<span style="color: #006600;">elements</span>.<span style="color: #006600;">RectangleElement</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">purepdf</span>.<span style="color: #006600;">elements</span>.<span style="color: #006600;">images</span>.<span style="color: #006600;">ImageElement</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">purepdf</span>.<span style="color: #006600;">io</span>.<span style="color: #006600;">RandomAccessFileOrArray</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">purepdf</span>.<span style="color: #006600;">pdf</span>.<span style="color: #006600;">PageSize</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">purepdf</span>.<span style="color: #006600;">pdf</span>.<span style="color: #006600;">PdfDocument</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">purepdf</span>.<span style="color: #006600;">pdf</span>.<span style="color: #006600;">PdfViewPreferences</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">purepdf</span>.<span style="color: #006600;">pdf</span>.<span style="color: #006600;">PdfWriter</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">purepdf</span>.<span style="color: #006600;">pdf</span>.<span style="color: #006600;">codec</span>.<span style="color: #006600;">TiffImage</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TestTIF <span style="color: #0066CC;">extends</span> Sprite<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span> source=<span style="color: #ff0000;">&quot;assets/foxdog_multiplepages.tif&quot;</span>, mimeType=<span style="color: #ff0000;">&quot;application/octet-stream&quot;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> cls1: <span style="color: #000000; font-weight: bold;">Class</span>;<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> document: PdfDocument;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> writer: PdfWriter;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> buffer: ByteArray;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> filename: <span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">index</span>: <span style="color: #0066CC;">int</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> pages: <span style="color: #0066CC;">int</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> stream: RandomAccessFileOrArray;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> TestTIF<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;addEventListener<span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">ADDED_TO_STAGE</span>, onAdded <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onAdded<span style="color: #66cc66;">&#40;</span> event: Event <span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> MouseEvent.<span style="color: #006600;">CLICK</span>, onClick <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> createDocument<span style="color: #66cc66;">&#40;</span> subject: <span style="color: #0066CC;">String</span> = <span style="color: #000000; font-weight: bold;">null</span>, rect: RectangleElement = <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buffer = <span style="color: #000000; font-weight: bold;">new</span> ByteArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> rect == <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rect = PageSize.<span style="color: #006600;">A4</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; writer = PdfWriter.<span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span> buffer, rect <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document = writer.<span style="color: #006600;">pdfDocument</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.<span style="color: #006600;">addTitle</span><span style="color: #66cc66;">&#40;</span> getQualifiedClassName<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">this</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> subject <span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.<span style="color: #006600;">addSubject</span><span style="color: #66cc66;">&#40;</span> subject <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.<span style="color: #006600;">setViewerPreferences</span><span style="color: #66cc66;">&#40;</span> PdfViewPreferences.<span style="color: #006600;">FitWindow</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onClick<span style="color: #66cc66;">&#40;</span> event: Event <span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; filename = getQualifiedClassName<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">this</span> <span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;::&quot;</span> <span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">pop</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">&quot;.pdf&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> byte: ByteArray = <span style="color: #000000; font-weight: bold;">new</span> cls1<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stream = <span style="color: #000000; font-weight: bold;">new</span> RandomAccessFileOrArray<span style="color: #66cc66;">&#40;</span> byte <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> image: ImageElement = ImageElement.<span style="color: #006600;">getInstance</span><span style="color: #66cc66;">&#40;</span> byte <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createDocument<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;Multi page TIFF Image Example&quot;</span>, PageSize.<span style="color: #006600;">A4</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.<span style="color: #006600;">open</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// add the first page to the document</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span> image <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// get the total number of pages</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pages = TiffImage.<span style="color: #006600;">getNumberOfPages</span><span style="color: #66cc66;">&#40;</span> stream <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;number of pages: &quot;</span> + pages <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// next page index to add to document (first page is 1)</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">index</span> = <span style="color: #cc66cc;">2</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> timer: Timer = <span style="color: #000000; font-weight: bold;">new</span> Timer<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">100</span>, <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> TimerEvent.<span style="color: #006600;">TIMER</span>, onTimerComplete <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onComplete<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stream.<span style="color: #0066CC;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.<span style="color: #0066CC;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; save<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onTimerComplete<span style="color: #66cc66;">&#40;</span> event: TimerEvent <span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">index</span> <span style="color: #66cc66;">&gt;</span> pages <span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onComplete<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span> TiffImage.<span style="color: #006600;">getTiffImage</span><span style="color: #66cc66;">&#40;</span> stream, <span style="color: #0066CC;">index</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">index</span>++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Timer<span style="color: #66cc66;">&#40;</span> event.<span style="color: #0066CC;">target</span> <span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">reset</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Timer<span style="color: #66cc66;">&#40;</span> event.<span style="color: #0066CC;">target</span> <span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> save<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>: <span style="color: #66cc66;">*</span> = <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> f: FileReference = <span style="color: #000000; font-weight: bold;">new</span> FileReference<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f.<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span> buffer, filename <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div></td></tr></tbody></table></div>
<p><br class="spacer_" /></p>
<p>Here you can see the result <a href="http://blog.sephiroth.it/?attachment_id=1506">PDF file</a>.<br />
And here the input <a href="http://blog.sephiroth.it/?attachment_id=1507">TIF image</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sephiroth.it/2011/02/17/multipage-tif-to-pdf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.sephiroth.it/2011/02/17/multipage-tif-to-pdf/</feedburner:origLink></item>
		<item>
		<title>purePDF and transparent BitmapData</title>
		<link>http://feedproxy.google.com/~r/sephiroth/blog/~3/mp0SlXk3czk/</link>
		<comments>http://blog.sephiroth.it/2011/01/14/purepdf-and-transparent-bitmapdata/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 23:38:58 +0000</pubDate>
		<dc:creator>Alessandro Crugnola</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[purePDF]]></category>

		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1494</guid>
		<description><![CDATA[Recently I&#8217;ve updated purePDF to a new version fixing one bug which caused problems with PNG images. However when you&#8217;re trying to add BitmapData with transparency  to a pdf document you probably get black backgrounds to your images. This is because internaly purePDF converts bitmapdata into 24bit tiff images, so no alpha informations. This is [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Recently I&#8217;ve updated <a href="http://bit.ly/dFFH2v">purePDF</a> to a new version fixing one bug which caused problems with PNG images.<br />
 However when you&#8217;re trying to add BitmapData with transparency  to a pdf document you probably get black backgrounds to your images. This is because internaly purePDF converts bitmapdata into 24bit tiff images, so no alpha informations.</p>
<p>This is a script you can use to convert your BitmapData images into transparent pdf ImageElements:</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:450px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">/**<br />
&nbsp;* Create a transparent ImageElement<br />
&nbsp;* <br />
&nbsp;* An ImageElement with the input bitmapdata RGB informations will be<br />
&nbsp;* created and an ImageElement will be used as mask ( using the alpha info from the bitmapdata )<br />
&nbsp;* If the input bitmapdata is not transparent a regular ImageElement will be returned. <br />
&nbsp;*/</span><br />
protected <span style="color: #000000; font-weight: bold;">function</span> createTransparentImageElement<span style="color: #66cc66;">&#40;</span> bitmap: BitmapData <span style="color: #66cc66;">&#41;</span>: ImageElement<br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> output: ByteArray = <span style="color: #000000; font-weight: bold;">new</span> ByteArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> transparency: ByteArray = <span style="color: #000000; font-weight: bold;">new</span> ByteArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> input: ByteArray = bitmap.<span style="color: #006600;">getPixels</span><span style="color: #66cc66;">&#40;</span> bitmap.<span style="color: #006600;">rect</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; input.<span style="color: #0066CC;">position</span> = <span style="color: #cc66cc;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span> input.<span style="color: #006600;">bytesAvailable</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; const pixel: uint = input.<span style="color: #006600;">readInt</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// write the RGB informations</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; output.<span style="color: #006600;">writeByte</span><span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#40;</span>pixel <span style="color: #66cc66;">&gt;&gt;</span> <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&amp;</span> 0xff <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; output.<span style="color: #006600;">writeByte</span><span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#40;</span>pixel <span style="color: #66cc66;">&gt;&gt;</span> <span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&amp;</span> 0xff <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; output.<span style="color: #006600;">writeByte</span><span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#40;</span>pixel <span style="color: #66cc66;">&gt;&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&amp;</span> 0xff <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// write the alpha informations</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; transparency.<span style="color: #006600;">writeByte</span><span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#40;</span>pixel <span style="color: #66cc66;">&gt;&gt;</span> <span style="color: #cc66cc;">24</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&amp;</span> 0xff <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; output.<span style="color: #0066CC;">position</span> = <span style="color: #cc66cc;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; transparency.<span style="color: #0066CC;">position</span> = <span style="color: #cc66cc;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> mask: ImageElement = ImageElement.<span style="color: #006600;">getRawInstance</span><span style="color: #66cc66;">&#40;</span> bitmap.<span style="color: #0066CC;">width</span>, bitmap.<span style="color: #0066CC;">height</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">8</span>, transparency, <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> image: ImageElement = ImageElement.<span style="color: #006600;">getRawInstance</span><span style="color: #66cc66;">&#40;</span> bitmap.<span style="color: #0066CC;">width</span>, bitmap.<span style="color: #0066CC;">height</span>, <span style="color: #cc66cc;">3</span>, <span style="color: #cc66cc;">8</span>, output, <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> bitmap.<span style="color: #006600;">transparent</span> <span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mask.<span style="color: #006600;">makeMask</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image.<span style="color: #006600;">imageMask</span> = mask;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> image;<br />
<span style="color: #66cc66;">&#125;</span></div></td></tr></tbody></table></div>
<p>and here there&#8217;s a demo app: <a href="http://bit.ly/dOT2ob" target="_blank">http://bit.ly/dOT2ob</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sephiroth.it/2011/01/14/purepdf-and-transparent-bitmapdata/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.sephiroth.it/2011/01/14/purepdf-and-transparent-bitmapdata/</feedburner:origLink></item>
	</channel>
</rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: blog.sephiroth.it @ 2012-01-29 00:54:12 --><!-- W3 Total Cache: Page cache debug info:
Engine:             disk: enhanced
Cache key:          feed/_index.xml_gzip
Caching:            enabled
Status:             not cached
Creation Time:      1.687s
Header info:
X-Pingback:         http://blog.sephiroth.it/xmlrpc.php
ETag:               "dd80aea0fcc7ce78a6cb83d0d661114b"
Content-Type:       text/xml; charset=UTF-8
Last-Modified:      Sat, 28 Jan 2012 22:54:12 GMT
Vary:               Accept-Encoding, Cookie
X-Powered-By:       W3 Total Cache/0.9.2.4
Content-Encoding:   gzip
-->

