Help - Search - Members - Calendar
Full Version: Java Swt Image Export
BleepingComputer.com > Software > Programming
   
petocities
Hi guys.
I'm doing a lil project with Java SWT, and it was fine, until I reached a dead end:
I need to export an image contained by a canvas...

I already have an algorithm that can export an image contained by a canvas, but for an AWT canvas, not SWT. So, my question is: Can i transform that SWT canvas to AWT?

Anyhow, if anyone knows a way to export that image right away from the SWT canvas, that would be really helpful. It needs to be a well known format, like jpeg, jpg, gif, etc., but I still can't found a way (specially because I don't know SWT very well yet).

Thx for your time guys. Im lookin forward for good news (plz! lol)
groovicus
I geuss I am a little puzzled as to what you are trying to do. The image contained in your frame has to come from somewhere, whether it be from a file on your computer, or an image downloaded from the net. Can you just export that image?

Unless of course you are creating your own custom drawing program, in which case that is a different matter altogether. Can you fill us in a bit?
petocities
Yeh, sorry I sdidn't put in many details, I tend to commit that mistake.
I am creating a program that generates diagrams from code inputs given by the user (similar to xml, but less complex. It creates entities and relations between them).

The image is generated through a rendering algorithm a friend made, and stored into the swt canvas. But the rendering algorithm doesn't arrange the elements, it just throw 'em all over each other, and the user has to rearrange the image. When he finishes that process, he should be able to export that image to a known format file, like jpg.

The problem I bumped into is that the image generated is stored into a swt canvas, and I managed to make an awt algorithm to get it, but they are not complatible, so I am kinda stuck again. I tried using swt methods, but it seems I am not able to understand how it works very much, so I am unable to make it using only swt.

If anyone knows a way to export the image stored in a swt canvas, or to transform the canvas to swt, or a way to get the content, it would be great.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.