Blog Post

#2868 Build 1.0.78

brian Tue 26 Apr 2022

New Graphics API

We have added a new graphics::Graphics API for rendering 2D graphics. It is pretty similar to the old gfx::Graphics used by the FWT engine. This build includes two implementation of this API:

  • JavaScript canvas implementation accessed via dom::Elem.renderCanvas
  • Java2D implementation for desktop applications

You can run the testGraphics pod to see both implementations side-by-side. Note on OS X you must remove the -XstartOnFirstThread option from the bin/fanlaunch script.

This feature adds a bunch of new APIs to the graphics API:

New APIs

Misc new APIs:

Change Log

Build 1.0.78 (26 Apr 2022)

  • New graphics APIs: GraphicsEnv, Graphics, Image, Stroke, Paint
  • Canvas rendering via Elem.renderCanvas
  • New Java2D graphics implementation
  • Deprecate Font.metrics & DeviceContext in favor of Graphics.metrics
  • Deprecate Int/Float clip in favor of clamp
  • Duration.clamp
  • Str.eachWhile
  • WebOutStream.main
  • ConcurrentMap.getAndSet
  • dom: ResizeObserver

SlimerDude Tue 26 Apr 2022

Hooray! :)

LightDye Sat 14 May 2022

This is awesome Brian. Good job Fantom team. I'm liking the new additions, including the Graphics API.

Just wanted to mention that I downloaded it on my Mac using Firefox and I have had no issues. However, I tried to download it on a Windows PC where I have to use Chrome unfortunately, and it won't let me saying "fantom-1.0.78.zip is not commonly downloaded and may be dangerous". Of course any powerful tool can be dangerous if misused, but the way that's presented by Google Chrome may discourage people from downloading Fantom unfortunately. The reason given by Chrome is " Uncommon: You tried to download an unfamiliar and potentially dangerous piece of software."

I believe this only occurs when Chrome is set to use "Safe Browsing with enhanced protection", but still, I wonder if is there anything that could be done with Google to prevent Chrome from misleading people about Fantom.

brian Mon 16 May 2022

The reason given by Chrome is " Uncommon: You tried to download an unfamiliar and potentially dangerous piece of software."

I expect that is because there is a batch file in it. But the download is straight from github so I am not sure there anything we can do to mitigate that issue.

Login or Signup to reply.