office-gobmx/drawinglayer
Armin Le Grand 41c704a8d6 tdf#111853 Added TextFillColor to operator==
TextFillColor was added to TextSimplePortionPrimitive2D, but not added to
TextSimplePortionPrimitive2D::operator==, so when this changed it was not
detected. Added this.
Also added was bFilled and nWidthToFill, all defaulted. This is not accessible
for TextDecoratedPortionPrimitive2D and seems to be some special solution
just for one special case in DrawPortionInfo, only used from Outliner::DrawingTab,
so I am not sure if that change to the central TextSimplePortionPrimitive2D is
good and should stay

Change-Id: Ief8da74a8b66281e47c4c8a47131125e30b90e7d
Reviewed-on: https://gerrit.libreoffice.org/42188
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Tested-by: Armin Le Grand <Armin.Le.Grand@cib.de>
2017-09-12 13:26:40 +02:00
..
inc Fixup source layout in emf+ parser 2017-08-17 03:27:35 +02:00
qa/unit borderline: corrections for calc and writer 2017-07-28 18:09:10 +02:00
source tdf#111853 Added TextFillColor to operator== 2017-09-12 13:26:40 +02:00
CppunitTest_drawinglayer_border.mk gbuild: Remove MSVC 2013 legacy code 2017-04-21 18:18:44 +02:00
drawinglayer.component
Library_drawinglayer.mk emfplus: migrate gdiplus reader to drawinglayer 2017-07-15 11:01:30 +02:00
Makefile
Module_drawinglayer.mk Related: tdf#99315 BorderLinePrimitive2D: fix solid line primitive width 2016-04-15 14:46:00 +00:00
README boost->std 2015-09-19 08:02:51 +00:00

Drawing API that can specify what to draw via a kind of display list.

Example of the DrawingLayer use is eg. in svx/source/xoutdev/xtabhtch.cxx:121.
A stripped down version with extended comments:

     // Create a hatch primitive (here a rectangle that will be filled with
     // the appropriate hatching, but has no border).
     // This will not draw it yet; it's so far only constructed to add it to a
     // display list later.
     const drawinglayer::primitive2d::Primitive2DReference aHatchPrimitive(
         new drawinglayer::primitive2d::PolyPolygonHatchPrimitive2D(...));

     // Create a rectangle around the hatch, to give it a border.
     const drawinglayer::primitive2d::Primitive2DReference aBlackRectanglePrimitive(
         new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(...));

     // Here we want to render to a virtual device (to later obtain the bitmap
     // out of that), so prepare it.
     VirtualDevice aVirtualDevice;

     // Create processor and draw primitives, to get it ready for rendering.
     std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(
         drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(...));

     if (pProcessor2D)
     {
         // Fill-in the display list.
         drawinglayer::primitive2d::Primitive2DSequence aSequence(2);

         aSequence[0] = aHatchPrimitive;
         aSequence[1] = aBlackRectanglePrimitive;

         // Render it to the virtual device.
         pProcessor2D->process(aSequence);
         pProcessor2D.reset();
     }

     // Obtain the bitmap that was rendered from the virtual device, to re-use
     // it in the widget.
     aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel());

== DrawingLayer glossary ==

Primitives - classes that represent what should be drawn.  It holds the data
what to draw, but does not contain any kind of the rendering.  Some of the
primitives are 'Basic primitives', that are primitives that cannot be
decomposed.  The rest of the primitives can be decomposed to the basic
primitives.

Decomposition - a way how to break down the more complicated primitives into
the basic primitives, and represent them via them; this logically makes the
plain Primitive2DSequence display list a hierarchy.
Eg. PolygonMarkerPrimitive2D can be decomposed to 2 hairlines
PolyPolygonHairlinePrimitive2D's, each with different color.

Processor - a class that goes through the hierarchy of the Primitives, and
renders it some way.  Various processors, like VclPixelProcessor2D (renders to
the screen), VclMetafileProcessor2D (renders to the VCL metafile, eg. for
printing), etc.

== How to Implement a new Primitive ("something new to draw") ==

* Create an ancestor of BasePrimitive2D
  (or of its ancestor if it fits the purpose better)

  * Assign it an ID [in drawinglayer_primitivetypes2d.hxx]

  * Implement its decomposition
    [virtual Primitive2DSequence create2DDecomposition(...)]

* Extend the (various) processor(s)
  If you need more than relying on just the decomposition

== Where is DrawingLayer used ==

* SdrObject(s) (rectangles, Circles, predefined shapes etc.)

* Selections

* Various smaller cases to 'just draw something'

  * Draw to a virtual device, and use the resulting bitmap (like the example
    above)

* Custom widgets (like the Header / Footer indicator button)