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/polypolygonprimitive2d.hxx>
25 #include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx>
28 namespace drawinglayer
32 Primitive2DReference
createHiddenGeometryPrimitives2D(
33 const basegfx::B2DHomMatrix
& rMatrix
)
35 const basegfx::B2DPolygon
& aUnitOutline(basegfx::utils::createUnitPolygon());
37 return createHiddenGeometryPrimitives2D(
39 basegfx::B2DPolyPolygon(aUnitOutline
),
43 Primitive2DReference
createHiddenGeometryPrimitives2D(
44 const basegfx::B2DPolyPolygon
& rPolyPolygon
)
46 return createHiddenGeometryPrimitives2D(
49 basegfx::B2DHomMatrix());
52 Primitive2DReference
createHiddenGeometryPrimitives2D(
54 const basegfx::B2DRange
& rRange
)
56 return createHiddenGeometryPrimitives2D(
59 basegfx::B2DHomMatrix());
62 Primitive2DReference
createHiddenGeometryPrimitives2D(
64 const basegfx::B2DRange
& rRange
,
65 const basegfx::B2DHomMatrix
& rMatrix
)
67 const basegfx::B2DPolyPolygon
aOutline(basegfx::utils::createPolygonFromRect(rRange
));
69 return createHiddenGeometryPrimitives2D(
75 Primitive2DReference
createHiddenGeometryPrimitives2D(
77 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
78 const basegfx::B2DHomMatrix
& rMatrix
)
80 // create fill or line primitive
81 Primitive2DReference xReference
;
82 basegfx::B2DPolyPolygon
aScaledOutline(rPolyPolygon
);
83 aScaledOutline
.transform(rMatrix
);
87 xReference
= new PolyPolygonColorPrimitive2D(
89 basegfx::BColor(0.0, 0.0, 0.0));
93 const basegfx::BColor
aGrayTone(0xc0 / 255.0, 0xc0 / 255.0, 0xc0 / 255.0);
95 xReference
= new PolyPolygonHairlinePrimitive2D(
100 // create HiddenGeometryPrimitive2D
101 return Primitive2DReference(
102 new HiddenGeometryPrimitive2D(Primitive2DContainer
{ xReference
}));
104 } // end of namespace primitive2d
105 } // end of namespace drawinglayer
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */