With all the new activity with jUploadr I decided to go ahead and implement image rotation. When I looked at the SWT javadocs, I was pleased to see that they added a Transform object for 3.1. Now rotating objects will be as simple as
Transform tx = new Transform(event.display);
tx.rotate(90);
gc.setTransform(tx);
// draw the image
tx.dispose();
…and it was. The transforms really simplify image manipulation, and I thank the SWT guys (and girls) for implementing this.
The problem arises when you actually go to deploy this code. You see, in Linux, the transforms rely on having the Cairo graphics engine, which is only included on the most bleeding edge systems. Thankfully, it worked on my system, having upgraded to the Cairo capable Fedora Core 4 only a week before. Had I tried this prior to the upgrade, jUploadr would have crashed. Similarly, the transforms require GDI+ on windows. As far as I know, GDI+ is only included by default on WindowsXP and Server 2003.
So, I was faced with a dilemma, either I use the SWT transforms and drastically reduce the number of people that could use jUploadr, or write my own transforms and maintain compatibility. For me, it’s not really a good choice, so I went ahead and wrote my own rotation code.
I don’t know why the SWT people bound their transforms to such cutting edge graphics libraries, but that decision severely limits their use. It’s kind of baffling as well that they don’t have some sort of fallback mechanism. I’m really disappointed that instead of gracefully degrading (perhaps sacrificing speed or image quality) they just blow up if the library isn’t there. As I demonstrated, the transforms can be implemented rather easily in Java, so there’s really no excuse for this.
However, I am happy that their API allowed for me to implement the transformations on my own, and in the end, this means that jUploadr users will just get another useful feature, even if I had to work a little harder to give it to them.
September 28th, 2005 at 11:11 am
now that yahoo bought the site …will this change the way you deal with jUploader
September 29th, 2005 at 4:57 am
Not really. They just switched Authentication APIs; I’m not sure if that was due to Yahoo’s acquisition or not, but it caused quite a bit of work on my end.
November 13th, 2005 at 1:45 am
sounds like j2me!
November 13th, 2005 at 7:30 pm
I’m interested to hear that you run Fedora Core 4 - I do too. However, I’m having trouble installing jUploadr. I get this output:
Starting JUploadr…
Java exec found in PATH. Verifying…
Suitable java version found [java = 1.4.2]
Configuring environment…
java -cp
GCJ is an incompatible version of java
Download the official version at http://java.sun.com