Mac OS X Porting - Canvas
- Mox Soini: Mox
- Thorsten Behrens (thb)
The current rendering framework in OpenOffice.org (OOo) is VCL. It is very Windows-oriented API that is hard to port to other platforms. Despite this, there are several ports available, including Unix/X11, Windows and Native Mac OS X port using Cocoa. Another big problem of VCL is that also the internals of the VCL are used from many places in the OOo code.
The future rendering framework in OOo is UNO XCanvas rendering framework. The benefits include a better designed API (easier to port and use) and a stronger isolation of the API from the rest of OOo.
Currently, the XCanvas implementation has been jump-started by directing text rendering back to VCL.
XCanvas is part of bigger module in OOo, called Drawing Layer. There is initiative to improve the whole module: Drawing Layer/Drawing Primitives
Of the OOo applications using VCL, currently (September 2006) OOo Impress slideshow has been converted to XCanvas, with prototypes working in Draw and Impress. Future work will include converting Calc and Writer.
Roadmap for Canvas in Mac OS X
Short term: use the VCL implementation of XCanvas.
Long term: create a native implementation of XCanvas. There are two alternative ways to complete this:
- Create complete, non-VCL, canvas implementation in OOo (like the Windows implementation, not worked on in Mac OS X)
- Create implementation based on Cairo -library (like the Linux implementation, this is the currently chosen alternative for Mac OS X)
The benefits of cairo-based implementation include:
- Less code in OOo, more shared code with other open source programs
- Cairo has been already ported to Mac OS X, no need to duplicate that effort for OOo only.
- Mozilla is using this approach (in Gecko 1.9 / Firefox 3.0) for all of their platforms (The Thebes API, which is a light C++ API on top of Cairo API in C)
- GTK/Gnome is using this approach for all of their platforms (The new Canvas-widget & rendering, based on Cairo)
As of Apr 2008, the Quartz cairo canvas for OOo Mac OS X is implemented, but not fully working. All the text is not visible, although actual rendering works ok. There's also a crash when closing down Canvas.
- Cairo canvas code documentation added
- Quartz backend added to Cairo Canvas (issue 69066)
Now there are cairo-based Canvas backends for Unix/X11, Windows and Mac/Quartz. The text rendering, however, is always directed back to VCL. To take the full advantage of cairo library, and it's support for cross-platform text layout and rendering, the XCanvasFont and XTextLayout interfaces need to be implemented "natively" with cairo.
- Create cross-platform cairo-based text rendering for cairo canvas backend (issue 88613)
- Aqua/Mac OS X related Wiki pages
- Related work: The re-design of Drawing layer in Impress/Draw, to make it possible to use XCanvas in Impress and Draw
- OpenOffice.org Architecture
- Quartz 2D: context explained, Image Masks, Mask explanation
- Linked list of Quartz 2D functions