blog
Jozef Chúťka's blog — blog.yoz.sk/page/5/
November 10, 2010
image lanczos LanczosBitmapDataResizer resample resize
Lanczos Resampling With ActionScript

It has been a while since I worked on some interesting library. But the day has come :-) and here it is. Let me introduce you LanczosBitmapDataResizer class. Lanczos resampling is an interpolation method used to compute new values for sampled data. In resampling (resizing) images it is considered to be one of the best algorithms at all. Lanczos is a convolution filters. That means a filter that for each output value moves the convolution functions point of origin to be centered on the output and then multiplies all the values in the input with the value of the convolution function (kernel) at that location and adds them together.
October 28, 2010
AIR loadPolicyFile Security URLRequest
Quick Tip: AIR 2.5 & Security.loadPolicyFile()
After switching my AIR application into new AIR 2.5 SDK, boom! Every single URLRequest threw an IOErrorEvent. No other exception thrown. So I started digging in in order to find the cause and it appeared to be Security.loadPolicyFile() execution (I am reusing some libs containing these lines) that blocked it all quietly. First I tried to do try-catch block over it, but with no success. Than I just removed the lines for AIR project and voilà, everything back to normal again. URLRequests works again. It seems like AIR does not need loadPolicyFile() for URLRequests at all. Interesting that these loadPolicyFile() were targeting total different domain and were able to break any other requests.
October 25, 2010
BitmapData ByteArray compress imagecolorallocate imagesetpixel unpack
Processing BitmapData.getPixels() With PHP
Have you ever worked with BitmapData.getPixels() method? This method generates a byte array from a rectangular region of pixel data. Writes an unsigned integer (a 32-bit unmultiplied pixel value) for each pixel into the byte array. Thats sounds good, but what is it good for to have a ByteArray full of integers? There is not even a decoder for this format on my backend?!… Well, this format is so cool, and easy to access that you do are able to write your own decoder e.g. in PHP.
The resulting bytes are 32-bit unsigned integers for each pixel represented by AARRGGBB format, followed by another pixels and so on e.g.:
AA RR GG BB:
-- -- -- --
FF FF 00 00
00 00 FF 00October 20, 2010
Quick Tip: stage.mouseX on Android
When working with AIR on Android, I felt into an issue with stage.mouseX (stage.mouseY) returning value 107374182. It seems I am not the only one who experience that, but also Michael Ritchie and Lex Talkington did. This happens after you release touch screen. You may expect that Event.MOUSE_LEAVE would be fired in the right moment, but that sometimes just does not (sometime it does). I did not found any better solution than testing returned values against the static number, so I came up with this piece of code:
if(stage && (int(Math.abs(stage.mouseX)) == 107374182
|| int(Math.abs(stage.mouseY)) == 107374182))
return;October 19, 2010
adb AIR apk certificate debug emulator install
Debug & Deploy Flash on Android

It is now a few weeks after I started experimenting with AIR for Android. While watching all the great tutorials about how to make things work (AIR for Android – Part 1, Part 2) and how to debug application running on device (Debug AIR apps on Android with Flash Builder 4, another in french and Flash), I have decided to attach some of my own findings and practices to build, deploy and debug apps.
To start, it is a good practice to setup your environment variable path to Android sdk and AIR sdk:
PATH: ...;C:/Users/Yoz/Work/Android/SDK/2.2;C:\Program Files\Adobe\Adobe Flash Builder 4\sdks\4.1.0.16076-AIR2.5\binNext, the whole certificate thing does not make sense to me because you can/have to create one by yourself. The cert need to be valid for 25 years else Android Market will not accept your application (bye bye real signed certificate from PGP TrustCenter :-( )
October 13, 2010
AIR Android Facebook FacebookOAuthGraph StageWebView
Authorizing Facebook Applications in Android

Hold on, this is going to be fast and smooth! I am playing with an Android Emluator for a few days now. One of the challenges was to mount FacebookOAuthGraph lib into Android. It turned out to be 1 hour task. Thanks to Flash-Core article and sHTiF and StageWebView. Long live AIR for Android! :-) Follow the article for codes:
October 11, 2010
Quick Tip: AIR Application Without Flex Framework
This may be pretty known thing, but I would like to share it. When creating a new AIR project in flash builder (File / New / Flex Project / … Desktop – AIR), and you do not require flex framework, just rename the “Main application file” to whatever.as (instead of whatever.mxml) in the last step of creation wizard (screenshot attached). Or, if your project already exists with main app.mxml file, just create new file with the same name app.as and remove the old one (app.mxml). Make sure your main application class extends Sprite.
October 11, 2010
Superfast 3D Scene Without 3D Engine

Based on my previous post about z-sorting indices, I have created a superfast 3DDM version using drawTriangles(). The following example renders 100×100 segments = 10201 vertices = 20000 triangles (faces) per frame. Just to imagine how much that is, see the main image fullsize. There is no 3D engine used at all, everything is handled by native flash classes and functions. Z-sorting is not calculated on every frame (however it could be, because the sort algorythm is pretty fast), but it is pre-cached for some rotation. Feel free to run the example in new window in order to see the real speed (there is more flash content around here on my blog template). I can go up to 12 fps with the best flash quality for the first image in demo, how much can you?
October 8, 2010
3d 3ddm drawTriangles Matrix3D PerspectiveProjection Triangles Utils3D Vector3D
Z-sorting Indices For drawTriangles()

While constantly improving 3DDM (drawTriangles() version soon to be released), I was looking for the fastest possible solution to render simple 3D object. It soon appeared to be drawTriangles() – the native ActionScript 3 method, that let you make illusion of 3D object based on deforming your texture. In fact native ActionScript contains a lot of useful and fast classes to work with 3D like: Utils3D, Vector3D, Matrix3D, PerspectiveProjection… so you do not need to create your own basic 3D engine tools. One thing that it does not contain is z-sorting. Z-sorting is very tricky job, that is why modern 3D engines let you decide which sorting method to use with your scenes (faster vs. precise). For my needs it is enough to use simpliest z-sort possible, based on projected max z coordinate of face (3 vertices).
Before continue reading, make sure you understand the basics of Using triangles for 3D effects, Transforming bitmaps, UV mapping and Culling. Everything is very good described by Adobe.
September 24, 2010
AIR AppUp certificate Marketplace Melrose
Adobe Melrose – The Place To Sell Your Apps
This post is about Adobe Melrose – the new Lab project from Adobe, and my first contact with it. I hope to be able to continuously update this article so you can get perfect view of what is going on when you decide to use Melrose. Lets begin with public static const MELROSE: :-)
Melrose (codename) enables developers and publishers to distribute and make money with Adobe® AIR® applications through application stores. Melrose provides a repository that distributes applications to multiple application stores so that publishers can reach millions of users. Intel AppUp Center and the Adobe AIR Marketplace are the first two storefronts available in Melrose. Melrose also provides analytics that let publishers measure success of their applications.