Feels like home

Jun 01

How to dump a Zest graph into an Image

If you are developing an Eclipse plug-in or RCP application which has something to do with graphs chances are you are using Zest. At one time you might want to add feature of exporting graph as an image. The one pattern I’ve found to do it (from Eclipse bugs) looks something like this:

// g is a zest graph object
Point size = new Point(g.getContents().getSize().width, g.getContents().getSize().height);
final Image image = new Image(null, size.x, size.y);
GC gc = new GC(image);
SWTGraphics swtGraphics = new SWTGraphics(gc);
g.getContents().paint(swtGraphics);
gc.copyArea(image, 0, 0);
gc.dispose();

This code works almost ok, but first of all has unnecessary call to gc.copyArea(). What hurts more is that it will dump only the part of graph that has positive coordinates. To get whole graph you have to move coordinate system of image.

Bounds size = g.getContents().getBounds();
final Image image = new Image(null, size.width, size.height);
GC gc = new GC(image);
SWTGraphics swtGraphics = new SWTGraphics(gc);
// moving coords system for the image.
swtGraphics.translate(-1 * size.x, -1 * size.y);
g.getContents().paint(swtGraphics);
gc.dispose();

May 14

Anatomy of a Mashup: Definitive Daft Punk visualised -

Mashup of Daft Punk’s songs. The amazing part is pure-HTML (minus audio, which goes through flash) visualization.

Dec 24

usersillusions:

“I fight for the user”

usersillusions:

“I fight for the user”

Dec 11

Ten Great Years by Maxim Dalton

via thisisnthappiness

Ten Great Years by Maxim Dalton

via thisisnthappiness

(Source: vizualize, via usersillusions)

Oct 05

Wierd bug in Safari + Flash

While posting amazing videos I’ve found on Vimeo to Twitter I’ve come across a very strange bug.

Somehow text rendering in safari can be affected by flash plugin running on the site. I do not say it always does, in fact it almost never does. But compare the two images:

This is standard Twitter stream: Twitter stream without Vimeo plugin

And this is the very same stream but with Vimeo plugin running in 2nd pane. Twitter stream with Vimeo plugin

When the flash player loades all rendering of text is affected. Looks like antialiasing is thinking text is rendered on a darker background and messes with edges. Particularly damaging to small sizes.

I know I should check other browsers and other flash plugins, but it’s late and tomorrow’s a work day.