Community
Participate
Working Groups
Currently GC is rendered in RAP using VML in IE and HTML5-Canvas in all other browser. It would be relatively easy to support SVG instead of/in addition to Canvas. Arguments for using SVG: - Much more similar to VML (to which there is no alternative in ie7/8), dropping canvas would therefore make further development on GC simpler. - Would allow for simple fix for Bug 317437 - [GC] support for lines styles. - Would allow for propper drawText implementation, which is currently very limited and can only be drawn on top of everyting else. - Would allow for enhanced features not present on SWT, like the ability to delete/replace previoulsy drawn shapes. I tried this with the VML-version, where it dramatically improved performance for my usecase. Arguments against using SVG: - A bit slower than Canvas. (But still MUCH faster than VML). - IE9 supports Canvas (and SVG), therefore VML might be less of a problem in the future. - Supporting both at the same time and use as needed would be possible, but make the code even more complex. - clearRect could still not be supported, as its only possible in HTML5 canvas. The ability to change only parts of a canvas can be very important for improving overall performance, as it allows to reduce the amount of drawing operations that need to be transmitted to and executed on the client. Basically there are two ways to support this: Either propperly supporting clearRect or using the "undo/replace" feature i came up with after switching SVG. Since only canvas-based browser can support clearRect, and they are very fast already, this seems to be the less attractive option, unless we simply ignore ie7/8.
On correction: clearRect is not a feature of GC, but of HTML-Canvas. Clipping is the feature that can't be supported in VML (or SVG). Or, to be more precise, it could very well be supported, but my understanding would be that all newly drawn content is only covering the old contant, meaning the number of shapes in DOM would steadily increase, which espicially in IE impacts the performance very, very badly.
An alternative would be to allow/use several HTML-canvases/GCs per Canvas/Widget (which would not be SWT compatible, but probably a new RWT-only widget), so one can use different layers for different shapes. This would allow partial redrawing aswell.
With the new protocol using HTML-Canvas syntax, this becomes increasingly unpractical. It also seems that multiple HTML-canvases would not be signigicantly more expensive that SVG-shapes, so using these for a "layers" feature would be a good option.