Platform/GFX/Moz2D: Difference between revisions

From MozillaWiki
< Platform‎ | GFX
Jump to navigation Jump to search
(Initial skeleton of combined Moz2D page)
Line 8: Line 8:
== Current status ==
== Current status ==


Further resources:
The Gecko graphics API preceding Moz2D was [http://blog.vlad1.com/2007/12/11/graphics-in-mozilla/ Thebes] which consists of a C++ wrapper around Cairo, some Gecko-specific utility code, and a text API that uses platform text handling. Currently both the Thebes API and Moz2D API are in use. A Thebes wrapper around Moz2D allows code that still uses the Thebes API to run on top of Moz2D. Over time this code will be migrated to using the Moz2D API directly (see [[Platform/GFX/AzureConversion|Azure Conversion]]).
 
Once the Azure project is completed&mdash;that is, all the backends have been implemented and all the calling code converted to use the new Moz2D API&mdash;the old Thebes API will be removed.
 
''Side note:'' For historical reasons, there are some classes with &ldquo;Thebes&rdquo; in the name which will be surviving this process as they're not actually part of the graphics API. They may get renamed eventually, to reduce the number of magical words you need to know about, but be warned that just because some code has &ldquo;Thebes&rdquo; in the name, it does not mean that the code is on its way out!
 
See also:
* [http://www.basschouten.com/blog1.php/progress-on-moz2d Progress on Moz2D] - July 2013 update
* [http://www.basschouten.com/blog1.php/progress-on-moz2d Progress on Moz2D] - July 2013 update
* [[Platform/GFX/AzureConversion|Azure Conversion]]


== Stateless vs stateful ==
== Stateless vs stateful ==

Revision as of 02:18, 14 August 2013

The Moz2D graphics API, part of the Azure project, is a cross-platform interface onto the various graphics backends that Gecko uses for rendering such as Direct2D (1.0 and 1.1), Skia, Quartz, and NV Path. Adding a new graphics platform to Gecko is accomplished by adding a backend to Moz2D (see #Implementing a new backend).

Some of the notable features of the API are:

  • Mostly stateless—better suited to CSS rendering and eliminates overhead
  • Floating-point—better suits platform APIs
  • API methods line up with HTML canvas

Current status

The Gecko graphics API preceding Moz2D was Thebes which consists of a C++ wrapper around Cairo, some Gecko-specific utility code, and a text API that uses platform text handling. Currently both the Thebes API and Moz2D API are in use. A Thebes wrapper around Moz2D allows code that still uses the Thebes API to run on top of Moz2D. Over time this code will be migrated to using the Moz2D API directly (see Azure Conversion).

Once the Azure project is completed—that is, all the backends have been implemented and all the calling code converted to use the new Moz2D API—the old Thebes API will be removed.

Side note: For historical reasons, there are some classes with “Thebes” in the name which will be surviving this process as they're not actually part of the graphics API. They may get renamed eventually, to reduce the number of magical words you need to know about, but be warned that just because some code has “Thebes” in the name, it does not mean that the code is on its way out!

See also:

Stateless vs stateful

Learning Moz2D: Introducing the API

Source surfaces

Draw targets

Developing Moz2D

Building Moz2D

Testing Moz2D: Player2D

Implementing a new backend

Further reading

The following resources describe the motivation for and goals of this API: