Difference between revisions of "Mac OS X Porting - Canvas"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Tasks)
(Links)
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==Contributors==
 
==Contributors==
 
* Mox Soini: [[User:Mox|Mox]]
 
* Mox Soini: [[User:Mox|Mox]]
 +
* Thorsten Behrens (thb)
  
 
==Introduction==
 
==Introduction==
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 [[AquaBuild|Native Mac OS X port using Cocoa]].
+
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 [[AquaBuild|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 OpenOffice.org (OOo) is [http://api.openoffice.org/docs/common/ref/com/sun/star/rendering/XCanvas.html UNO XCanvas rendering framework]. The benefits include a well designed API (easier to port, easier to use) and a more strong isolation of the API from the rest of the OOo (One of the big problems of the current 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 [http://api.openoffice.org/docs/common/ref/com/sun/star/rendering/XCanvas.html 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.
+
Currently, the XCanvas implementation has been jump-started by directing text rendering back to VCL.
  
[[Image:oocon2006_g11-drawinglayer-thumb.png|left|200px|The location of the Drawing layer. Click on image for full view]]
+
[[Image:Oocon2006_g11-drawinglayer.png|right|500px|The location of the Drawing layer. Click on image for full view]]
 
+
       
XCanvas is part of bigger module in OpenOffice, called ''Drawing Layer''. There is initiative to improve the whole module: [[DrawingPrimitives|Drawing Layer/Drawing Primitives]]
+
XCanvas is part of bigger module in OOo, called ''Drawing Layer''. There is initiative to improve the whole module: [[DrawingPrimitives|Drawing Layer/Drawing Primitives]]
  
 
For '''XCanvas information''', see presentations at [http://marketing.openoffice.org/ooocon2006/schedule/wednesday.html OOoCon 2006] (PDF, ODP, video/ogg) and [http://ooocon-arnes.kiberpipa.org/media/Cairo_Radek_Doulik/slide.pdf OOoCon 2005 (PDF)]  
 
For '''XCanvas information''', see presentations at [http://marketing.openoffice.org/ooocon2006/schedule/wednesday.html OOoCon 2006] (PDF, ODP, video/ogg) and [http://ooocon-arnes.kiberpipa.org/media/Cairo_Radek_Doulik/slide.pdf OOoCon 2005 (PDF)]  
  
 
Of the OOo applications using VCL, currently (September 2006) OOo Impress slideshow [http://marketing.openoffice.org/ooocon2006/schedule/general_abstracts.html#g11 has been converted to XCanvas], with prototypes working in Draw and Impress. Future work will include converting Calc and Writer.
 
Of the OOo applications using VCL, currently (September 2006) OOo Impress slideshow [http://marketing.openoffice.org/ooocon2006/schedule/general_abstracts.html#g11 has been converted to XCanvas], with prototypes working in Draw and Impress. Future work will include converting Calc and Writer.
 
  
 
NOTE: this work does not address the problem with native widgets and UI layout, only rendering. The UI Layout is discussed in [[UI Layout]] and details are in [[VCL UI Rework]].
 
NOTE: this work does not address the problem with native widgets and UI layout, only rendering. The UI Layout is discussed in [[UI Layout]] and details are in [[VCL UI Rework]].
Line 34: Line 34:
 
* [http://www.mozilla.org Mozilla] is using this approach (in Gecko 1.9 / Firefox 3.0) for all of their platforms (The [http://wiki.mozilla.org/Mozilla2:GFXEvolution Thebes API], which is a light C++ API on top of Cairo API in C)
 
* [http://www.mozilla.org Mozilla] is using this approach (in Gecko 1.9 / Firefox 3.0) for all of their platforms (The [http://wiki.mozilla.org/Mozilla2:GFXEvolution Thebes API], which is a light C++ API on top of Cairo API in C)
 
* [http://www.gtk.org GTK/Gnome] is using this approach for all of their platforms (The new Canvas-widget & rendering, based on Cairo)
 
* [http://www.gtk.org GTK/Gnome] is using this approach for all of their platforms (The new Canvas-widget & rendering, based on Cairo)
 +
 +
==Status==
 +
 +
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.
 +
 +
DONE:
 +
* Cairo canvas code documentation added
 +
* Quartz backend added to Cairo Canvas ([http://www.openoffice.org/issues/show_bug.cgi?id=69066 issue 69066])
 +
  
 
==Tasks==
 
==Tasks==
  
The main task currently, is to understand and document the various APIs and how they interact with each other. The pieces are there ([http://api.openoffice.org/docs/common/ref/com/sun/star/rendering/XCanvas.html XCanvas], [http://www.cairographics.org/manual/cairo-Image-Surfaces.html Cairo], [http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/ Quartz 2D], [http://developer.apple.com/cocoa/ Cocoa] etc.), but more details are needed to understand how they fit together.
+
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 [http://api.openoffice.org/docs/common/ref/com/sun/star/rendering/XCanvasFont.html XCanvasFont] and [http://api.openoffice.org/docs/common/ref/com/sun/star/rendering/XTextLayout.html XTextLayout] interfaces need to be implemented "natively" with cairo.
  
 
TODO:
 
TODO:
* cairo implementation of XCanvas (in OOo) lacks function documentation
+
* Create cross-platform cairo-based text rendering for cairo canvas backend ([http://www.openoffice.org/issues/show_bug.cgi?id=88613 issue 88613])
* quartz implementation of cairo (in Cairo) lacks function documentation (look at other implementations)
+
* Create visual explanations of the API structure
+
* port the code, in [http://www.openoffice.org/issues/show_bug.cgi?id=69066 issue 69066]. Work started.
+
  
PERFORMANCE:
+
==Links==
* OpenOffice.org VCL uses a lot of XOR-based (win32-like, bitmap-oriented) graphics functions. Mac OS X does not have this concept and uses compositing, canvas and layers instead. To get good performance of OOo on Mac OS X, OOo needs to be gotten rid of heavy use of XOR functions
+
* 32-bit -images: OOo internally uses non-32bit images, whereas Cocoa/Carbon require 32-bit images for native graphics operations. OOo should be converted to use 32-bit images internally.
+
  
DOCS:
+
* [http://wiki.services.openoffice.org/wiki/Category:Aqua Aqua/Mac OS X related Wiki pages]
 +
* Related work: The re-design of [[DrawingPrimitives|Drawing layer in Impress/Draw]], to make it possible to use XCanvas in Impress and Draw
 
* OpenOffice.org [[Architecture]]
 
* OpenOffice.org [[Architecture]]
 
* Quartz 2D: [http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/ context explained], [http://developer.apple.com/documentation/GraphicsImaging/Reference/CGImage/Reference/reference.html#//apple_ref/c/func/CGImageCreateWithMask Image Masks], [http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_images/chapter_12_section_1.html#//apple_ref/doc/uid/TP30001066-CH212 Mask explanation]
 
* Quartz 2D: [http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/ context explained], [http://developer.apple.com/documentation/GraphicsImaging/Reference/CGImage/Reference/reference.html#//apple_ref/c/func/CGImageCreateWithMask Image Masks], [http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_images/chapter_12_section_1.html#//apple_ref/doc/uid/TP30001066-CH212 Mask explanation]
 
* [http://developer.apple.com/documentation/GraphicsImaging/Reference/Quartz2D_Collection/index.html#//apple_ref/doc/uid/TP40003853 Linked list of Quartz 2D functions]
 
* [http://developer.apple.com/documentation/GraphicsImaging/Reference/Quartz2D_Collection/index.html#//apple_ref/doc/uid/TP40003853 Linked list of Quartz 2D functions]
  
==Links==
 
  
* [http://wiki.services.openoffice.org/wiki/Category:Aqua Aqua/Mac OS X related Wiki pages]
+
The APIs that are involved are ([http://api.openoffice.org/docs/common/ref/com/sun/star/rendering/XCanvas.html XCanvas], [http://www.cairographics.org/manual/cairo-Image-Surfaces.html Cairo], [http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/ Quartz 2D], and a little bit of [http://developer.apple.com/cocoa/ Cocoa])
  
* Related work: The re-design of [[DrawingPrimitives|Drawing layer in Impress/Draw]], to make it possible to use XCanvas in Impress and Draw
 
 
==Status==
 
 
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.
 
  
  
[[Category:Porting]]
 
[[Category:MacOSX]]
 
 
[[Category:Aqua]]
 
[[Category:Aqua]]
[[Category:Development]]
 
 
[[Category:Features]]
 
[[Category:Features]]

Latest revision as of 11:42, 28 March 2010

Contributors

  • Mox Soini: Mox
  • Thorsten Behrens (thb)

Introduction

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.

The location of the Drawing layer. Click on image for full view

XCanvas is part of bigger module in OOo, called Drawing Layer. There is initiative to improve the whole module: Drawing Layer/Drawing Primitives

For XCanvas information, see presentations at OOoCon 2006 (PDF, ODP, video/ogg) and OOoCon 2005 (PDF)

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.

NOTE: this work does not address the problem with native widgets and UI layout, only rendering. The UI Layout is discussed in UI Layout and details are in VCL UI Rework.

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:

  1. Create complete, non-VCL, canvas implementation in OOo (like the Windows implementation, not worked on in Mac OS X)
  2. 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)

Status

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.

DONE:

  • Cairo canvas code documentation added
  • Quartz backend added to Cairo Canvas (issue 69066)


Tasks

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.

TODO:

  • Create cross-platform cairo-based text rendering for cairo canvas backend (issue 88613)

Links


The APIs that are involved are (XCanvas, Cairo, Quartz 2D, and a little bit of Cocoa)

Personal tools