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