June 13, 2011

Everything (Delphi) XE Demo

A demo showcasing many new features of recent versions of Delphi. The program translated a text, 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.

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.




Everything Delphi XE Demo 

"translate it to a different language using Google

Did Embi buy in Google's translator or do you have to
have an internet connection?
Comment by DelfiPhan on June 14, 08:08

Everything Delphi XE Demo 

If you can compile your demo under Windows x64, Mac
and Linux I buy Delphi again.

Comment by Erwin van den Bosch on June 14, 08:43

Everything Delphi XE Demo 


  No you need an Internet connection... also for using 


  you should be able to compile that demo for Win64 in a 
few months... and you might also soon be able to compile 
for Mac and Linux, but not that demo based on Windows 

  so you might like and buy Delphi again soon...
Comment by Marco Cantu [http://www.marcocantu.com] on June 14, 08:49

Everything Delphi XE Demo 

The Google Translate API is soon to be deprecated and
will stop working on 1 december 2011:


It seems it was abused quite a lot.
Comment by Jan Derk on June 14, 14:37

Everything Delphi XE Demo 

  I know about Google Translate, although they alter 
announced they might change their position and made it a 
paid service. We'll see. it is going to work for now... 
Comment by Marco Cantu [http://www.marcocantu.com] on June 14, 14:49

Everything Delphi XE Demo -- New Location for Code 

See the link in signature 
Comment by Marco Cantu [http://code.marcocantu.com/trac/marcocantu_marco-delphi-books/browser/delphixehandbook/epilogue/EverythingXEDemo] on July 11, 21:36

Everything Delphi XE Demo 

How can I run this demo in rad studio xe8
Comment by johnson simpson on May 26, 16:48

Post Your Comment

Click here for posting your feedback to this blog.

There are currently 0 pending (unapproved) messages.