Re:IE9 beta's HTML5 support isn't there yet: 3 big canvas go...
by kenjackson on Thursday January 13, 2011 @08:26PM
(#2102118)
Direct2D is an odd API, which I'm not an expert on. So maybe it's great, but I can't tell from messing with it.
But with that said, it is built on Direct3D, which can do this type of compositing, at the very least with shaders. I'm sure they could add that support into D2D, or IE can go directly to D3D to do it.
I'm kind of surprised IE didn't just use D3D for most of canvas anyways (and D2D for some things like text rendering).
Re:IE9 beta's HTML5 support isn't there yet: 3 big canvas go...
by barake on Thursday January 13, 2011 @08:38PM
(#2102146)
Sorry to deviate from the topic at hand, but in what ways do you think WPF is a "dead-end"? I've been mucking about with it in preparation for my first desktop app in a few years. It seems to work well enough but maybe I'm not deep enough yet.
Re:IE9 beta's HTML5 support isn't there yet: 3 big canvas go...
by stwe on Friday January 14, 2011 @05:12AM
(#2103083)
Many globalCompositeOperation modes are also broken in WebKit based browsers: https://bugs.webkit.org/show_bug.cgi?id=39177
But sadly nobody seems to care too much about that.
Re:IE9 beta's HTML5 support isn't there yet: 3 big canvas go...
by pavlov on Friday January 14, 2011 @05:24AM
(#2103104)
IMHO, most of the Porter-Duff compositing operations are fairly useless. There is a nice mathematical purity to the model from which these operations are derived, but that's also their weakness: they are based on an ultra-simplistic abstraction instead of real world use cases. Punching out alpha mattes in various ways just isn't very interesting in practice.
Porter and Duff can be forgiven because the "real world" didn't exist when they designed this model in the early '80s. At the time, a frame buffer add-on to a computer could cost as much as a car...!
When designing a modern graphics API, I think it would be more useful to look at the operations that people are actually familiar with, e.g. Photoshop blending modes, and design the interface to match those expectations.
It seems to come down to the limitations of Direct2D, which doesn't seem to support any other compositing operations except source-over, a.k.a. "normal alpha blending". This is fairly surprising when taking into account that Direct2D is a very new graphics API (it shipped in Windows 7)...
I think the root cause is that Microsoft's graphics APIs have long evolved in a different direction compared to everyone else. Make no mistake, Microsoft is a very important force in graphics because they control Direct3D, and that has placed them at the vanguard of high-performance accelerated 3D graphics.
Direct2D seems to mostly take design influence from Direct3D. One of its explicit goals is to provide 2D utility graphics for Direct3D games -- stuff like HUD displays for games. The traditional "Porter-Duff" compositing operators (i.e. the blending modes missing from Direct2D) are not very useful in this environment, so instead Direct2D concentrates on "game-like" stuff like high-level geometry objects.
In contrast, the other major browsers use graphics APIs that fundamentally derive from the Adobe school of print-oriented graphics, where an image is built from low-level immediate mode operators. Think PostScript and PDF.
The original Canvas JavaScript implementation shipped in Mac OS X 10.4 to support Dashboard widgets. Canvas was just a paper-thin wrapper over Apple's Quartz API, which in turn was essentially a royalty-free implementation of the PDF graphics model (before Quartz, Apple/NeXT were licensing Display PostScript from Adobe).
I think Mozilla's Canvas implementation uses Cairo, which is an open-source library heavily modelled after PDF and Quartz. Chrome uses their home-grown Skia, which is also very similar.
Poor Microsoft. If they had taken the opportunity in 2004, they could have easily dictated a simple web graphics standard that would have played to the strengths of the accelerated graphics API that they control. But instead they were busy building giant fortresses of proprietary APIs like the dead-end Windows Presentation Foundation, and now they're having trouble implementing something as superficially simple as Canvas.