1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 #include <drawinglayer/processor2d/baseprocessor2d.hxx>
13 #include <basegfx/color/bcolormodifier.hxx>
14 #include <sal/config.h>
19 namespace drawinglayer::primitive2d
21 class PolyPolygonColorPrimitive2D
;
22 class PolygonHairlinePrimitive2D
;
23 class BitmapPrimitive2D
;
24 class UnifiedTransparencePrimitive2D
;
25 class BackgroundColorPrimitive2D
;
26 class TransparencePrimitive2D
;
27 class MaskPrimitive2D
;
28 class ModifiedColorPrimitive2D
;
29 class TransformPrimitive2D
;
30 class PointArrayPrimitive2D
;
31 class MarkerArrayPrimitive2D
;
32 class PolygonStrokePrimitive2D
;
33 class LineRectanglePrimitive2D
;
34 class FilledRectanglePrimitive2D
;
35 class SingleLinePrimitive2D
;
38 namespace drawinglayer::processor2d
40 class DRAWINGLAYER_DLLPUBLIC CairoPixelProcessor2D final
: public BaseProcessor2D
42 // the modifiedColorPrimitive stack
43 basegfx::BColorModifierStack maBColorModifierStack
;
45 // cairo specific data
48 // helpers for direct paints
49 void processPolygonHairlinePrimitive2D(
50 const primitive2d::PolygonHairlinePrimitive2D
& rPolygonHairlinePrimitive2D
);
51 void processPolyPolygonColorPrimitive2D(
52 const primitive2d::PolyPolygonColorPrimitive2D
& rPolyPolygonColorPrimitive2D
);
53 void processBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D
& rBitmapCandidate
);
55 processTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D
& rTransCandidate
);
56 void processUnifiedTransparencePrimitive2D(
57 const primitive2d::UnifiedTransparencePrimitive2D
& rTransCandidate
);
58 void processMaskPrimitive2DPixel(const primitive2d::MaskPrimitive2D
& rMaskCandidate
);
59 void processModifiedColorPrimitive2D(
60 const primitive2d::ModifiedColorPrimitive2D
& rModifiedCandidate
);
61 void processTransformPrimitive2D(const primitive2d::TransformPrimitive2D
& rTransformCandidate
);
63 processPointArrayPrimitive2D(const primitive2d::PointArrayPrimitive2D
& rPointArrayCandidate
);
65 processMarkerArrayPrimitive2D(const primitive2d::MarkerArrayPrimitive2D
& rMarkerArrayCandidate
);
66 void processBackgroundColorPrimitive2D(
67 const primitive2d::BackgroundColorPrimitive2D
& rBackgroundColorCandidate
);
68 void processPolygonStrokePrimitive2D(
69 const primitive2d::PolygonStrokePrimitive2D
& rPolygonStrokeCandidate
);
70 void processLineRectanglePrimitive2D(
71 const primitive2d::LineRectanglePrimitive2D
& rLineRectanglePrimitive2D
);
72 void processFilledRectanglePrimitive2D(
73 const primitive2d::FilledRectanglePrimitive2D
& rFilledRectanglePrimitive2D
);
75 processSingleLinePrimitive2D(const primitive2d::SingleLinePrimitive2D
& rSingleLinePrimitive2D
);
77 /* the local processor for BasePrimitive2D-Implementation based primitives,
78 called from the common process()-implementation
80 virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D
& rCandidate
) override
;
83 // local protected minimal constructor for usage in derivates, e.g. helpers
84 CairoPixelProcessor2D(const geometry::ViewInformation2D
& rViewInformation
);
86 bool hasError() const { return cairo_status(mpRT
) != CAIRO_STATUS_SUCCESS
; }
87 void setRenderTarget(cairo_t
* mpNewRT
) { mpRT
= mpNewRT
; }
88 bool hasRenderTarget() const { return nullptr != mpRT
; }
91 bool valid() const { return hasRenderTarget() && !hasError(); }
92 CairoPixelProcessor2D(const geometry::ViewInformation2D
& rViewInformation
,
93 cairo_surface_t
* pTarget
);
94 virtual ~CairoPixelProcessor2D() override
;
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */