Difference between revisions of "DrawingPrimitives"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Giving it a try)
(Giving it a try)
Line 5: Line 5:
 
==Giving it a try==
 
==Giving it a try==
  
You can have a (preliminary) glance at how this works by building [http://eis.services.openoffice.org/EIS2/cws.ShowCWS?Id=3064&Path=SRC680%2Faw033 CWS aw033] (follow the link for informations on which milestone this is currently based, and which modules are branched). You'll further need to checkout the new module drawinglayer from CVS (and for gcc-based builds, apply the patch from [http://www.openoffice.org/issues/show_bug.cgi?id=65883 Issue i65883]).
+
You can have a (preliminary) glance at how this works by building [http://eis.services.openoffice.org/EIS2/cws.ShowCWS?Id=3064&Path=SRC680%2Faw033 CWS aw033] (follow the link for informations on which milestone this is currently based, and which modules are branched). You'll further need to checkout the new module drawinglayer from CVS.
  
 
After the build is done, open up a Draw or Impress, insert some shapes, and toggle between old and new drawing layer via <Ctrl><Shift>-T (this already repaints the view, just like <Ctrl><Shift>-R).  
 
After the build is done, open up a Draw or Impress, insert some shapes, and toggle between old and new drawing layer via <Ctrl><Shift>-T (this already repaints the view, just like <Ctrl><Shift>-R).  

Revision as of 13:22, 2 August 2006

The DrawingLayer, i.e. the engine providing the Draw/Impress content, which is reused in both Calc and Writer, currently undergoes substantial refactoring. This rework takes place in CWS aw033 (and partially in CWS aw024). Although the DrawingLayer was already usable as an engine, it had several shortcomings, among them no clear distinction between model and view (all model objects handled the viewing of their content themselves), lacking separation of concerns (lots of generally useful functionality was buried in the DrawingLayer code, instead of separated out into tooling libraries), and a hard-to-remove dependency on VCL's OutputDevice for rendering.

All three items will be addressed in CWS aw033, and the means for that are DrawingPrimitives. The mental model for these primitives are metafiles or display lists, i.e. resolution-independent representation of renderable geometry. DrawingPrimitives define a hierarchy of increasingly simpler geometric primitives, starting with fairly high-level ones like customShapePrimitive or captionPrimitive, down to simple ones like polyPolygonColorPrimitive. The high-level primitives have built-in support for breaking them up into simpler ones, which makes implementing a renderer for DrawingPrimitives quite easy (in a first step, one has to provide only support for a small set of very basic primitives, like bitmap and polygon).

Giving it a try

You can have a (preliminary) glance at how this works by building CWS aw033 (follow the link for informations on which milestone this is currently based, and which modules are branched). You'll further need to checkout the new module drawinglayer from CVS.

After the build is done, open up a Draw or Impress, insert some shapes, and toggle between old and new drawing layer via <Ctrl><Shift>-T (this already repaints the view, just like <Ctrl><Shift>-R).

Some code pointers:

  • drawinglayer/source/primitive for the basic primitives
  • svx/source/sdr/primitive for the high-level (shape-equivalent) primitives
  • svx/source/sdr/contact/objectcontactofpageview.cxx: DoProcessDisplay() for the main paint entry (and some funny flags)
Personal tools