Aurigma Flash/Flex experiments

posted by Alex on 14 April 2009, 18:00

Recently we have decided to widen our experience (and maybe products line) and to investigate new Flash/Flex platform. The task was to create file-upload solution with some client-side image processing. This post contains a summary of our experiments. However, I'm a full newbie in Flash/Flex, so feel free to add your notes and comments.

The beginning was great - I have just opened FlexBuilder and found many cool things. Stable and fast visual forms designer, easy-to-learn syntax, all major OOP concepts and even compile-time type checks. Oh, and of course - shaders! Really amazing stuff. However, after few days my impressions were not so bright. Why? Here the whole list of reasons.

Security restrictions

It is really a problem number one. As I was interested in upload functionality, I started with URLLoader class. It cannot post anything to server if this action is not initiated by user directly. Very reasonable. So, each time when you call URLLoader.load() you should have something like button click handler higher in stack. It prevents malicious apps from stealing user data. But...

There is another thing about Flash/Flex which you should know. It is event-driven platform with many asynchronous calls. E.g. if you want to load file - you should call FileReference.load() and wait for "complete" event fired by this object. If you want to load SWF movie or JPEG image - you should create Loader object, ask it to start processing and just wait for the event. Very simple! If you are not going to upload an image you have, to go to fullscreen or do anything else from the list of restricted actions. But if you are - you are in a big trouble. By the reason of the fact that "complete" event fired from another thread - there is no UIA (user-initiated-action) handler in stack and, hence, you have no permission.

Adobe docs says - "you should show message and ask user again". You have to ask, even if a user just clicked "Do this" button just because you have asynchronous call in the middle of your operation. Really annoying. Actually, I don't understand why a bad guy cannot show message and ask user some innocent question? User will give him a permit (why not, if question is innocent?) - and he will do his dirty business...

And there is also another bug with URLLoader - it doesn't fire progress event while uploading data from binary buffer. It is a known issue and I even voted for it. I would recommend you to do the same if you experience a similar problem.

So, URLLoader was evidently not the best choice. Next thing I tried to use was Socket. Yeap, it is not so easy to use, however, from the other hand it gives much more flexibility. Nevertheless, a few hours later it was evident that Socket is not the option at all because even if you are going to make uploads to the same domain where you host your SWF file you should have special policy server installed on the server. You cannot obtain permission policy from your HTTP server, no, only via special policy server...

Threads & Asynchronous calls

As I mentioned before - Flash/Flex is an event-driven asynchronous platform. But it doesn't support multithreading. Sounds strange, yeap? As far as I understand from blogs and forums - all ActionScript code is executed in a single thread. And asynchronous calls are just enqueued in some internal dispatcher. What does that mean? That it is simple to develop, it is hard to make a hardly-debuggable synchronization error. And this means, that you cannot run anything in background. There are workarounds which emulate "background processing", but they were not applicable in my case. Oh, I forgot to mention that shaders engine works in another thread, so if your task can be expressed in shaders programming language - you will be able to do it asynchronously and very-very fast. ;) Unfortunately, it isn't my case as well.

Summary

What do we have at the end? A very strange feeling. Get me right, I like Flash/Flex - it provides a bunch of great features, it allows to develop really fast, it works in a stable way... But sometimes it stalemates you, and you cannot do anything. Users will have nothing to do than bear user interface freezing or answer useless questions shown because of security restrictions in Flash.

It would be great to have the following things in the future:

  • Signed SWFs or any other mechanism to use instead of UIA concept. Or some mechanism which will allow passing UIA-permission via event chains.
  • Multithreading or at least something like yield() method.
  • Ability to work via sockets. At least with native domain. Without any "special server on XXX port", because it is not usable in real world with hosting providers, firewalls, and proxies.

Graphics Mill 5.0 Press Release

posted by Max on 20 May 2008, 19:13

Standard vs. Pro

kick it on DotNetKicks.com

Aurigma Inc. announces an anniversary version of Graphics Mill for .NET, the popular SDK for the developers of image processing solutions. Version 5.0 marks a new milestone in the product life cycle: Graphics Mill is now offered in two flavors, Standard and Pro. This allows the developers to choose the optimal tool for precisely addressing the goals in an economically efficient manner.

Now the developers of basic imaging solutions do not need to pay for expert Pro version functionality, having the Standard package contain all necessary imaging features. Normally, Standard version proves sufficient for such solutions as image editing web applications, image viewers, photo galleries and catalogs, etc.

More demanding customers, however, would rather choose to buy the Pro version that includes all the expert features needed to develop such serious products as preprint preparation solutions, document management systems, satellite photo processing applications, etc. Graphics Mill Pro has native support for x64 platforms that allows for addressing more than 2 gigabytes of RAM per process for imaging needs.

Also the Pro version has enhanced support for multi-processor and multi-core systems, detecting the amount of CPUs/cores and accordingly optimizing imaging computations.

Other prominent Graphics Mill Pro features include support for Adobe Color Management Module and 16 bits per channel for images, real-time color space conversion, etc.

Graphics Mill code is native .NET (ASP.NET) which delivers valuable advantages for the developer.

One of the greatest improvements in version 5.0 is the introduction of Red-Eye Removal Add-on into Graphics Mill SDK. Therefore, there is no need now to purchase this add-on separately from Graphics Mill. Now the Graphics Mill SDK includes everything necessary to develop photo imaging solutions, including red-eye removal tool. Red-Eye Removal Add-on makes the entire process as easy as possible: it features a unique semi-automatic mode that only requires selecting the necessary face – and the natural eye tint is automatically restored. The process is split up into steps and features undo operation.

Other add-ons are included into Graphics Mill, depending on the package type: AVI Processor and Media Processor are available both with Graphics Mill Standard and Graphics Mill Pro, while Advanced PSD Add-on is only limited to Graphics Mill Pro.

Advanced PSD Add-on.

There is no doubt PSD format is immensely popular with artists engaged in graphic and web design. Very often a customer gets the final result (and sometimes even the mockups) in a PSD file. This allows for making minor changes without resorting to the designer expertise. However, sometimes there is a pressing need to streamline PSD file processing, inserting some custom content on-the-fly. The most typical example of such usage can be an online business card editor.

Objective: generate a business card from the person’s name and position input via a web form. Assets: business card PSD template that includes text and raster layers as well as the person name and position (and possibly a photo).

Solution: Advanced PSD Add-on reads the template and merges PSD graphics with custom personal data such as name and position (as rasterized text), personal photo, etc. The data can be input through a web form or be retrieved from a database – at developer discretion. The final image can be saved into a file for further printing.

More complex examples include discount cards, brochures and booklets with custom regional and cultural data, etc.

AVI Processor Add-on and Media Processor Add-on.

The advent of broadband connections brought video processing online. AVI Processor Add-on allows for AVI format manipulation: retrieving frames and soundtracks and saving them to files, adding frames and soundtracks from files and much more.

Providing metadata processing and multimedia format support, Media Processor Add-on makes a handy addition to AVI Processor.

Imaging Controls

To fully reveal Graphics Mill potential in web and desktop applications, a WinForms control set and an AJAX control set for ASP.NET 2.0 are included into the SDK.

WinForms controls include multilayer controls, containers for manipulating vector and raster objects, zoom and pan controls, thumbnail view control and many more.

AJAX controls for ASP.NET 2.0 are specifically intended for providing smooth online image editing experience even for slow Internet connections.

Graphics Mill is a comprehensive development tool for building imaging solutions of varying complexity. A more detailed Graphics Mill feature list is well beyond the limits of this brief article, while a complete understanding of Graphics Mill capabilities can be achieved by reading the extensive SDK documentation.

kick it on DotNetKicks.com