For the Italian Delphi Day 2011 last week I wrote a demo to highlight the fact it it worth updating to XE and migrating your code, to take advantage of many new featrues. The program translates a text (using Google Translate), creates some graphic out of it, posts it on Azure. The code shows JSON, Unicode, Azure, Anonymous threads, JPEG, and Direct2D in action in Delphi XE.
I wrote this to highlight a number of recent features of Delphi in a single, all-encompassing demo. The idea was to create a demo which would be extremely difficult to write in Delphi 2007, thus suggesting that upgrading to a recent version of Delphi really adds a lot to your code. The goal of the program is to take an input string, translate it to a different language using Google Translate, create a colorful bitmap with the translated string (using Direct2D), transform it to a JPEG, publish it on Azure, and copy the public image URL to the clipboard.
The program uses several recent features of Delphi:
- Unicode support (available since Delphi 2009)
- Anonymous threads (Delphi XE)
- JSON processing (Introduced in Delphi 2010 and updated in Delphi XE)
- Azure components (Delphi XE)
- Direct 2D support (Delphi 2010)
- JPEG conversion (Delphi 2009)
In the following image there a screen shot with a Hindi translation:
The same core image is visible on Azure (where I posted it) at the link http://marcocantu.blob.core.windows.net/translations/hi.jpg visible below:
After this rather long introduction, here is the actual video, showing the output of the program but also several portions of its code:
Ths full source code is available in the SVN repository for my books. You can browse it online at http://code.marcocantu.com/p/marcodelphibooks/source/tree/HEAD/delphixehandbook/epilogue/EverythingXEDemo or get it from subversion with the command:
svn co -r HEAD http://code.marcocantu.com/svn/marcocantu/marcodelphibooks/delphixehandbook/epilogue/EverythingXEDemo
Hope you like it. I'm waiting for feedback to figure out if I should record similar short videos for other examples in my (finally coming) short Delphi XE book.