Monthly Archive for: ‘March, 2013’

Experiments with GEF4 Graphics and JavaFX

6

Inspired by a phone call with Alexander Nyssen and a Forum post by Tom Schindl I started playing around with a GEF4 AbstractGraphics implementation using a JavaFX 2.2 canvas. GEF4 nicely separates the presentation model from the UI toolkit responsible for the actual rendering, so it was pretty straight forward to develop a JavaFX based implementation. Currently GEF4 provides Java2D (AWT) and SWT renderers. The results using my small JavaFX based renderer look quite nice so far. Here is the “Simple Example” rendered with SWT and JavaFX:

simple-example-1

When you click on the above image to see it in original size you will notice the the red lines look not as crisp in JavaFX compared to SWT. That is because in JavaFX all coordinates are expressed as double values and the shapes are positioned computing the exact middle position of the edges by default. In practice that means that a red line with thickness 1 drawn from (10:10) to (20:10) would be rendered as pink line with a line width of 2 pixels. A workaround is to take the line thicknesses into account and draw the line from (10:9.5) to (20:9.5). Then the line will be painted crisp. Actually the HTML5 canvas implementation does exactly the same. In the demo, I just had to add javaFxGraphics.translate(0.5, 0.5); at the beginning of the demo, then the result looks like:

simple-example-2

Again, click on the image to see the original sizes. The FillModesDemo looks almost the same when you compare the SWT with the JavaFX version:

fill-modes

Currently I am trying to get the JavaFX clipping working in a canvas, don’t know yet why it is not working out of the box… For me it would be great to see graphical editors in e4 and JavaFX based apps in the future. In the next weeks I will polish my implementation and contribute it to GEF4, if there is any interest.

Stay tuned

Kai

You find me on Twitter and Google+.
Interested in Eclipse 4 Application Platform trainings?

Old Computers

Found a great Web site with all kinds of old computers, see http://oldcomputers.net/. Here is a list of all the old computers had owned and still love:

– Sinclair ZX 81: http://oldcomputers.net/zx81.html
– Sinclair ZX Spectrum: http://oldcomputers.net/zx-spectrum.html
– Atari 520 ST: http://oldcomputers.net/atari520st.html

I used to write games in assembler for the Sinclairs. One game for the ZX Spectrum still runs as a Java Applet on my web site (http://www.toedter.com/en/delon/mazeofdelon.html).

I always have nostalgic feelings when I remember all the fun a had with the above old computers.

Sigh…

Which old computers did you own?