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 #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
21 #include <basegfx/polygon/b2dpolygon.hxx>
22 #include <basegfx/polygon/b2dpolygontools.hxx>
23 #include <basegfx/matrix/b2dhommatrix.hxx>
24 #include <drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx>
25 #include <drawinglayer/primitive2d/PolyPolygonHairlinePrimitive2D.hxx>
26 #include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx>
29 namespace drawinglayer::primitive2d
31 Primitive2DReference
createHiddenGeometryPrimitives2D(
32 const basegfx::B2DHomMatrix
& rMatrix
)
34 const basegfx::B2DPolygon
& aUnitOutline(basegfx::utils::createUnitPolygon());
36 return createHiddenGeometryPrimitives2D(
38 basegfx::B2DPolyPolygon(aUnitOutline
),
42 Primitive2DReference
createHiddenGeometryPrimitives2D(
43 const basegfx::B2DPolyPolygon
& rPolyPolygon
)
45 return createHiddenGeometryPrimitives2D(
48 basegfx::B2DHomMatrix());
51 Primitive2DReference
createHiddenGeometryPrimitives2D(
53 const basegfx::B2DRange
& rRange
)
55 return createHiddenGeometryPrimitives2D(
58 basegfx::B2DHomMatrix());
61 Primitive2DReference
createHiddenGeometryPrimitives2D(
63 const basegfx::B2DRange
& rRange
,
64 const basegfx::B2DHomMatrix
& rMatrix
)
66 const basegfx::B2DPolyPolygon
aOutline(basegfx::utils::createPolygonFromRect(rRange
));
68 return createHiddenGeometryPrimitives2D(
74 Primitive2DReference
createHiddenGeometryPrimitives2D(
76 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
77 const basegfx::B2DHomMatrix
& rMatrix
)
79 // create fill or line primitive
80 Primitive2DReference xReference
;
81 basegfx::B2DPolyPolygon
aScaledOutline(rPolyPolygon
);
82 aScaledOutline
.transform(rMatrix
);
86 xReference
= new PolyPolygonColorPrimitive2D(
87 std::move(aScaledOutline
),
88 basegfx::BColor(0.0, 0.0, 0.0));
92 const basegfx::BColor
aGrayTone(0xc0 / 255.0, 0xc0 / 255.0, 0xc0 / 255.0);
94 xReference
= new PolyPolygonHairlinePrimitive2D(
95 std::move(aScaledOutline
),
99 // create HiddenGeometryPrimitive2D
100 return Primitive2DReference(
101 new HiddenGeometryPrimitive2D(Primitive2DContainer
{ xReference
}));
104 } // end of namespace
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */