Difference between revisions of "Canvas"

From Apache OpenOffice Wiki
Jump to: navigation, search
(New page: ==Introduction== Starting for OOo 2.0, the Canvas effort tries to modernize OOo's graphical output layer - its predecessor, VCL's OutputDevice, carries the burden of being designed as a s...)
 
(Introduction)
Line 5: Line 5:
 
In contrast, the Canvas offers a contemporary set of features useful for rendering application content, including ubiquituous alpha, floating point coordinates, texturing, and advanced text layouting facilities. Where VCL OutputDevice is a concrete class (without any virtual methods), the Canvas consists of a set of UNO interfaces grouped around the central [http://api.openoffice.org/docs/common/ref/com/sun/star/rendering/XCanvas.html com::sun::star::rendering::XCanvas] interface.
 
In contrast, the Canvas offers a contemporary set of features useful for rendering application content, including ubiquituous alpha, floating point coordinates, texturing, and advanced text layouting facilities. Where VCL OutputDevice is a concrete class (without any virtual methods), the Canvas consists of a set of UNO interfaces grouped around the central [http://api.openoffice.org/docs/common/ref/com/sun/star/rendering/XCanvas.html com::sun::star::rendering::XCanvas] interface.
  
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).
+
Because Canvas is interface-based, it's easy to provide multiple implementations, even for the same platform, and switchable during runtime (VCL does that during compile-time, depending on the platform it is built for).
 +
To facilitate easier migration, one of the Canvas implementations is based on VCL. Thus, every platform that has VCL working automatically gets a working Canvas - important to reduce effort for new ports, e.g. the MacOS Aqua port. Later on, these platforms might consider providing a native XCanvas implementation.
 +
 
 +
Currently, there are seven Canvas implementations in varying levels of completeness:
 +
* Java-Graphics2D-based
 +
* VCL-based
 +
* cairo-based
 +
** X11 backend
 +
** Windows backend
 +
** Aqua backend
 +
* DirectX/GDI+-based
 +
 
 +
and one empty demo implementation (nullcanvas), that can serve as a template for new ports.
 +
 
 +
For migration purposes, the new Canvas and VCL's OutputDevice will be contained in
 +
OOo for quite some time, allowing a step-by-step adaptation
 +
of the applications. Therefore, the canvas and VCL must somehow
 +
interoperate, since new code, using the canvas, typically is embedded
 +
in a VCL-based environment (for example, the OOo windows are still
 +
provided by VCL. To render into such a window via the canvas, a canvas
 +
must be constructable from a VCL window). Thus, essentially two new
 +
methods are provided at VCL's window, namely Window::GetCanvas() and
 +
Window::GetFullScreenCanvas(). Apart from that small link, canvas and
 +
VCL are completely separated.
 +
 
 +
The canvas framework currently consists of the following
 +
CVS modules, /gsl/canvas and /gsl/cppcanvas. Additionally, a new
 +
generic graphics tooling is used (but not exclusively by the canvas,
 +
AW's recent drawing layer fixups also make use of it), which
 +
resides in /graphics/basegfx.
  
To facilitate easier migration, one of the OOo XCanvas API implementations is based on VCL. This means that once the VCL part of OOo has been ported, also the XCanvas API works for that platform. This approach has made it possible to start the conversion from VCL to XCanvas, even though some of the non-VCL XCanvas implementations are missing.
 
  
 
[[Canvas_architecture.png]]
 
[[Canvas_architecture.png]]

Revision as of 22:48, 3 March 2008

Introduction

Starting for OOo 2.0, the Canvas effort tries to modernize OOo's graphical output layer - its predecessor, VCL's OutputDevice, carries the burden of being designed as a shallow wrapper around Win16 GDI. Back in the day, everything was integer coordinates, bezier curves didn't exist, nor a notion of alpha.

In contrast, the Canvas offers a contemporary set of features useful for rendering application content, including ubiquituous alpha, floating point coordinates, texturing, and advanced text layouting facilities. Where VCL OutputDevice is a concrete class (without any virtual methods), the Canvas consists of a set of UNO interfaces grouped around the central com::sun::star::rendering::XCanvas interface.

Because Canvas is interface-based, it's easy to provide multiple implementations, even for the same platform, and switchable during runtime (VCL does that during compile-time, depending on the platform it is built for). To facilitate easier migration, one of the Canvas implementations is based on VCL. Thus, every platform that has VCL working automatically gets a working Canvas - important to reduce effort for new ports, e.g. the MacOS Aqua port. Later on, these platforms might consider providing a native XCanvas implementation.

Currently, there are seven Canvas implementations in varying levels of completeness:

  • Java-Graphics2D-based
  • VCL-based
  • cairo-based
    • X11 backend
    • Windows backend
    • Aqua backend
  • DirectX/GDI+-based

and one empty demo implementation (nullcanvas), that can serve as a template for new ports.

For migration purposes, the new Canvas and VCL's OutputDevice will be contained in OOo for quite some time, allowing a step-by-step adaptation of the applications. Therefore, the canvas and VCL must somehow interoperate, since new code, using the canvas, typically is embedded in a VCL-based environment (for example, the OOo windows are still provided by VCL. To render into such a window via the canvas, a canvas must be constructable from a VCL window). Thus, essentially two new methods are provided at VCL's window, namely Window::GetCanvas() and Window::GetFullScreenCanvas(). Apart from that small link, canvas and VCL are completely separated.

The canvas framework currently consists of the following CVS modules, /gsl/canvas and /gsl/cppcanvas. Additionally, a new generic graphics tooling is used (but not exclusively by the canvas, AW's recent drawing layer fixups also make use of it), which resides in /graphics/basegfx.


Canvas_architecture.png

XCanvas is part of bigger module in OpenOffice, 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.

Personal tools