1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLHATCHPRIMITIVE2D_HXX
21 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLHATCHPRIMITIVE2D_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
26 #include <drawinglayer/primitive2d/primitivetools2d.hxx>
27 #include <drawinglayer/attribute/fillhatchattribute.hxx>
28 #include <basegfx/color/bcolor.hxx>
31 // FillHatchPrimitive2D class
33 namespace drawinglayer
37 /** FillHatchPrimitive2D class
39 This class defines a hatch filling for a rectangular area. The
40 Range is defined by the Transformation, the hatch by the FillHatchAttribute.
41 If the background is to be filled, a flag in FillHatchAttribute is set and
42 the BColor defines the background color.
44 #i120230# This primitive is now evtl. metric dependent due to the value
45 MinimalDiscreteDistance in the FillHatchAttribute if the value is not zero.
46 This is used for a more appealing, VCL-like visualisation by not letting the
47 distances get too small between lines.
49 The decomposition will deliver the hatch lines.
51 class DRAWINGLAYER_DLLPUBLIC FillHatchPrimitive2D
: public DiscreteMetricDependentPrimitive2D
54 /// the geometrically visible area
55 basegfx::B2DRange maOutputRange
;
57 /// the area the gradient definition is based on
58 /// in the simplest case identical to OutputRange
59 basegfx::B2DRange maDefinitionRange
;
61 /// the hatch definition
62 attribute::FillHatchAttribute maFillHatch
;
64 /// hatch background color (if used)
65 basegfx::BColor maBColor
;
68 /// local decomposition.
69 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const SAL_OVERRIDE
;
72 /// constructors. The one without definition range will use output range as definition range
74 const basegfx::B2DRange
& rOutputRange
,
75 const basegfx::BColor
& rBColor
,
76 const attribute::FillHatchAttribute
& rFillHatch
);
78 const basegfx::B2DRange
& rOutputRange
,
79 const basegfx::B2DRange
& rDefinitionRange
,
80 const basegfx::BColor
& rBColor
,
81 const attribute::FillHatchAttribute
& rFillHatch
);
84 const basegfx::B2DRange
& getOutputRange() const { return maOutputRange
; }
85 const basegfx::B2DRange
& getDefinitionRange() const { return maDefinitionRange
; }
86 const attribute::FillHatchAttribute
& getFillHatch() const { return maFillHatch
; }
87 const basegfx::BColor
& getBColor() const { return maBColor
; }
90 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const SAL_OVERRIDE
;
93 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const SAL_OVERRIDE
;
95 /// Override standard getDecomposition to be view-dependent here
96 virtual Primitive2DSequence
get2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const SAL_OVERRIDE
;
99 DeclPrimitive2DIDBlock()
101 } // end of namespace primitive2d
102 } // end of namespace drawinglayer
106 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLHATCHPRIMITIVE2D_HXX
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */