Showing posts with label iPhone. Show all posts
Showing posts with label iPhone. Show all posts

KDrawSprite: Get GPU power without cacheAsBitmapMatrix on AIR for iOS

KDrawSprite is an ActionScript library for mobile AIR applications using Packager for iPhone, AIR for iOS and AIR for Android to get more power of GPU. My iPhone app Korean Alphabet 1.2.2 is using this to get more than 30 fps on older devices, ex. iPod Touch 1st gen. A4 chip powered latest devices, such as iPad and iPhone 4, will performs 100 fps over with KDrawSprite.

Source on github:
https://github.com/kawanet/as3kawalib/raw/master/src/net/kawa/display/KDrawSprite.as
Document:
http://www.kawa.net/works/as/as3kawalib/docs/net/kawa/display/KDrawSprite.html


KDrawSprite draws your vector image onto a bitmap image. You don't need to manipulate cacheAsBitmapMatrix and cacheAsBitmap properties. These are powerful, however, sometimes make our app crashed erratically. You need take more care for iPad which has larger screen but has less memory.

How To Use This

Simply call KDrawSprite.getSprite() instead of setting cacheAsBitmapMatrix and cacheAsBitmap properties.
var sprite:Sprite = new Sprite();
sprite.graphics.beginFill(0x336699);
sprite.graphics.drawCircle(50, 50, 50);

// sprite.cacheAsBitmapMatrix = new Matrix(); // BEFORE
// sprite.cacheAsBitmap = true;


sprite = KDrawSprite.getSprite(sprite);       // AFTER

addChild(sprite);
sprite.x = 100;
sprite.y = 100;
sprite.scaleX = 0.5;
sprite.height = 50;
sprite.rotation = 1;
Bitmap operations such as moving, scaling and rotation will be GPU enabled.
KDrawSprite will also free memory of image rendered when it comes out of the Stage.

You need call getSprite() or draw() method whenever you make changes on the vector source image. This also means any other needless re-rendering will not be invoked. Learn more on document.

Super Sampling Anti-Aliasing (2x SSAA)

KDrawSprite supports 2x SSAA, super sampling anti-aliasing, in addition to NoAA per default.

Note

To get better performance and rendering quality, you MUST set stage.quality as StageQuality.LOW. Also use 2x SSAA when needed.
stage.quality = StageQuality.LOW; // must

* Japanese version of this post is here.

Cantonese Alphabet - iPhone app for traveling in Hong Kong

The Canotonese Alphabet mobile application is now available on iTunes App Store. This helps you to read Cantonese, spoken in Southern China including Hong Kong. It's just US$1.99. But this now!


To enter Cantonese phrases, use iOS's built-in Traditional Chinese hand-writing keyboard. The app also have online translation feature. This means you can translate English to Cantonese to read them in Cantonese.

The Last Piece


This was the latest member of the series of my Asian Alphabet applications.


Complete all five apps for Korean (Hangul), Chinese (Simplified and Traditional), Japanese and Cantonese!

Related Posts

Japanese Alphabet - iPhone App for Kanji and Kana

The Japanese Alphabet mobile application for iPhone / iPod Touch is now on sale at App Store. This helps you to read Japanese phrases when you come to Japan, study Japanese, order something at Japanese restaurants, etc. It's just USD $1.99. Buy this now!


This allows you to enter Japanese in serveral ways. First, Hiaragana software keyboard. Originally iOS doesn't have the feature but the app has.


Second, Katakana software keyboard. Again, you can easily select a Kana character you want to enter by clicking it from the list.


You can also use iOS's built-in Traditional Chinese character hand-writing keyboard. Note that most of Kanjis used in Japan are same to Kanjis used in Taiwan. Differences are intelligently corrected by the app.


At last, you can call Google Translate from the app. Entering English phrases, you will get Japanese phrases translated and see how to read them.

Related Posts

Bookmarklet Viewer Bookmarklet for #iPhone and #iPad

The bookmarklet helps you get JavaScript source code of bookmarklets on your iPhone and iPad. Mobile Safari for iPhone/iPad cannot save bookmarklets which have a link to javascript: scheme. Don't give up. Use the bookmarklet below.

Bookmarklet Viewer Bookmarklet

How to save the Bookmarklet Viewer itself

1. Click above to get the source of Bookmarklet Viewer

2. Long-press on the textarea and push [Select All] button

3. Push [Copy] button to copy the source

4. Push Safari's [+] button then [Add Bookmark] button

5. Enter the name of the bookmarklet

6. URL cannot be modified at the first time

7. Push [Save] button to save the bookmark

8. Push Safari's book button then [Edit] button

9. Open the bookmark saved, long-press on Address area then push [Paste] button

10. Close the bookmark

Save other bookmarklets using the Bookmarklet Viewer

Now you're ready to get the bookmarklet with the Bookmarklet Viewer bookmarklet :)

delicious (Extra bookmarklets is recommended)
http://delicious.com/help/bookmarklets

bit.ly
http://bit.ly/pages/tools

fr - a bookmarklet to get a link to flickr
http://kawanet.blogspot.com/2010/05/fr-bookmarklet-to-get-link-to-flickr.html

3D Bookmarklet (why don't you use the Web in 3D?)
http://svn.coderepos.org/share/lang/javascript/3D/3d-bookmarklet.html

* Japanese version of this post is here.