I think full SVG like pathing and transforms are definitely something we should add at some point. I was originally going to add them, but its actually quite a bit of work to do them properly and you can do an awful lot of nice graphics without them. The problem is that a proper implementation should be mostly contained to gfx, but in reality we would probably want to call out to SWT/JS for some of the more complicated geometry aspects (or end up rewriting some complicated code).
Saving images to file is something we actually have a backdoor hook for in JS, not sure it is supported in SWT (if you know how please post).
go4Tue 30 Aug 2011
The new Graphics is called gfx2.The OpenGL binding is called fogl. Although they in one repository, fogl is no something to do with gfx2.
I don't know how to Save the Image in Js. But it is simple in SWT:
public void save(OutStream out, MimeType format)
{
ImageLoader loader = new ImageLoader();
loader.data = new ImageData[] { imageData };
OutputStream jout = Interop.toJava(out);
int swtFormat = SWT.IMAGE_PNG;
String subType = format.subType();
if (subType.equals("png")) swtFormat = SWT.IMAGE_PNG;
else if (subType.equals("gif")) swtFormat = SWT.IMAGE_GIF;
else if (subType.equals("jpeg")) swtFormat = SWT.IMAGE_JPEG;
else if (subType.equals("jpg")) swtFormat = SWT.IMAGE_JPEG;
else if (subType.equals("bmp")) swtFormat = SWT.IMAGE_BMP;
else if (subType.equals("tiff")) swtFormat = SWT.IMAGE_TIFF;
else if (subType.equals("ico")) swtFormat = SWT.IMAGE_ICO;
else throw UnsupportedErr.make("unsupported image type: "+subType);
loader.save(jout, swtFormat);
}
brianFri 2 Sep 2011
This is really gread @go4. Thanks for posting that SWT code. We already have a backdoor hook for JS image saves, so with that we can probably get that API working. I will put it on my todo list (have a couple things like this I wanted to get into 1.0.60, but just ran out of time before our US holiday and wanted to get the build posted).
go4Sat 24 Sep 2011
I get the gfx2 API working in AWT(Java2d) and Android(Skia). I think the AWT is good at service-side(multi-thread enviroment) than SWT.
But, there is a bit issue when change the paint engine. Fwt.java,line 59:
Actor.locals().add("gfx.env", FwtEnv.make());
I change it to:
Actor.locals().set("gfx.env", FwtEnv.make());
And it works well.
brianSat 24 Sep 2011
I pushed that that
go4Mon 26 Sep 2011
Thanks
tompalmerThu 29 Sep 2011
Happened to stop by again. The whole WebGL/LWJGL and Canvas/Java2D/SWT/Skia thing is very compelling.
go4 Sat 27 Aug 2011
I try to enhance the fwt graphics. The API like this:
Path:
Transfom:
Image:
There is more example code
brian Mon 29 Aug 2011
I think full SVG like pathing and transforms are definitely something we should add at some point. I was originally going to add them, but its actually quite a bit of work to do them properly and you can do an awful lot of nice graphics without them. The problem is that a proper implementation should be mostly contained to gfx, but in reality we would probably want to call out to SWT/JS for some of the more complicated geometry aspects (or end up rewriting some complicated code).
Saving images to file is something we actually have a backdoor hook for in JS, not sure it is supported in SWT (if you know how please post).
go4 Tue 30 Aug 2011
The new Graphics is called
gfx2
.The OpenGL binding is calledfogl
. Although they in one repository, fogl is no something to do with gfx2.fan3d
The fan3d contains the following pod:
Status
gfx2 works both SWT and JS, but need some more test.
fogl all most at here. Most OpenGL/WebGL API mapped to Fantom.
Runing
There are lots of example code in jsTest/fan/jsFan/.
setting LWJGE:
If you want to run on the WebGl, need get a new browser.
@Brian
I don't know how to Save the Image in Js. But it is simple in SWT:
brian Fri 2 Sep 2011
This is really gread @go4. Thanks for posting that SWT code. We already have a backdoor hook for JS image saves, so with that we can probably get that API working. I will put it on my todo list (have a couple things like this I wanted to get into 1.0.60, but just ran out of time before our US holiday and wanted to get the build posted).
go4 Sat 24 Sep 2011
I get the gfx2 API working in AWT(Java2d) and Android(Skia). I think the AWT is good at service-side(multi-thread enviroment) than SWT.
But, there is a bit issue when change the paint engine. Fwt.java,line 59:
I change it to:
And it works well.
brian Sat 24 Sep 2011
I pushed that that
go4 Mon 26 Sep 2011
Thanks
tompalmer Thu 29 Sep 2011
Happened to stop by again. The whole WebGL/LWJGL and Canvas/Java2D/SWT/Skia thing is very compelling.