1*4bfbcde8SAndrew Rist /**************************************************************
2*4bfbcde8SAndrew Rist  *
3*4bfbcde8SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*4bfbcde8SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*4bfbcde8SAndrew Rist  * distributed with this work for additional information
6*4bfbcde8SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*4bfbcde8SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*4bfbcde8SAndrew Rist  * "License"); you may not use this file except in compliance
9*4bfbcde8SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*4bfbcde8SAndrew Rist  *
11*4bfbcde8SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*4bfbcde8SAndrew Rist  *
13*4bfbcde8SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*4bfbcde8SAndrew Rist  * software distributed under the License is distributed on an
15*4bfbcde8SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*4bfbcde8SAndrew Rist  * KIND, either express or implied.  See the License for the
17*4bfbcde8SAndrew Rist  * specific language governing permissions and limitations
18*4bfbcde8SAndrew Rist  * under the License.
19*4bfbcde8SAndrew Rist  *
20*4bfbcde8SAndrew Rist  *************************************************************/
21cdf0e10cSrcweir 
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_drawinglayer.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
26cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
27cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx>
28cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
29cdf0e10cSrcweir #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
30cdf0e10cSrcweir #include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
33cdf0e10cSrcweir 
34cdf0e10cSrcweir namespace drawinglayer
35cdf0e10cSrcweir {
36cdf0e10cSrcweir 	namespace primitive2d
37cdf0e10cSrcweir 	{
createHiddenGeometryPrimitives2D(bool bFilled,const basegfx::B2DHomMatrix & rMatrix)38cdf0e10cSrcweir         Primitive2DReference createHiddenGeometryPrimitives2D(
39cdf0e10cSrcweir             bool bFilled,
40cdf0e10cSrcweir             const basegfx::B2DHomMatrix& rMatrix)
41cdf0e10cSrcweir         {
42cdf0e10cSrcweir 			const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon());
43cdf0e10cSrcweir 
44cdf0e10cSrcweir             return createHiddenGeometryPrimitives2D(
45cdf0e10cSrcweir                 bFilled,
46cdf0e10cSrcweir                 basegfx::B2DPolyPolygon(aUnitOutline),
47cdf0e10cSrcweir                 rMatrix);
48cdf0e10cSrcweir         }
49cdf0e10cSrcweir 
createHiddenGeometryPrimitives2D(bool bFilled,const basegfx::B2DPolyPolygon & rPolyPolygon)50cdf0e10cSrcweir         Primitive2DReference createHiddenGeometryPrimitives2D(
51cdf0e10cSrcweir             bool bFilled,
52cdf0e10cSrcweir             const basegfx::B2DPolyPolygon& rPolyPolygon)
53cdf0e10cSrcweir         {
54cdf0e10cSrcweir             return createHiddenGeometryPrimitives2D(
55cdf0e10cSrcweir                 bFilled,
56cdf0e10cSrcweir                 rPolyPolygon,
57cdf0e10cSrcweir                 basegfx::B2DHomMatrix());
58cdf0e10cSrcweir         }
59cdf0e10cSrcweir 
createHiddenGeometryPrimitives2D(bool bFilled,const basegfx::B2DRange & rRange)60cdf0e10cSrcweir         Primitive2DReference createHiddenGeometryPrimitives2D(
61cdf0e10cSrcweir             bool bFilled,
62cdf0e10cSrcweir             const basegfx::B2DRange& rRange)
63cdf0e10cSrcweir 		{
64cdf0e10cSrcweir 			return createHiddenGeometryPrimitives2D(
65cdf0e10cSrcweir                 bFilled,
66cdf0e10cSrcweir                 rRange,
67cdf0e10cSrcweir                 basegfx::B2DHomMatrix());
68cdf0e10cSrcweir 		}
69cdf0e10cSrcweir 
createHiddenGeometryPrimitives2D(bool bFilled,const basegfx::B2DRange & rRange,const basegfx::B2DHomMatrix & rMatrix)70cdf0e10cSrcweir         Primitive2DReference createHiddenGeometryPrimitives2D(
71cdf0e10cSrcweir             bool bFilled,
72cdf0e10cSrcweir             const basegfx::B2DRange& rRange,
73cdf0e10cSrcweir             const basegfx::B2DHomMatrix& rMatrix)
74cdf0e10cSrcweir 		{
75cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon aOutline(basegfx::tools::createPolygonFromRect(rRange));
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 			return createHiddenGeometryPrimitives2D(
78cdf0e10cSrcweir                 bFilled,
79cdf0e10cSrcweir                 aOutline,
80cdf0e10cSrcweir                 rMatrix);
81cdf0e10cSrcweir 		}
82cdf0e10cSrcweir 
createHiddenGeometryPrimitives2D(bool bFilled,const basegfx::B2DPolyPolygon & rPolyPolygon,const basegfx::B2DHomMatrix & rMatrix)83cdf0e10cSrcweir         Primitive2DReference createHiddenGeometryPrimitives2D(
84cdf0e10cSrcweir             bool bFilled,
85cdf0e10cSrcweir             const basegfx::B2DPolyPolygon& rPolyPolygon,
86cdf0e10cSrcweir             const basegfx::B2DHomMatrix& rMatrix)
87cdf0e10cSrcweir         {
88cdf0e10cSrcweir             // create fill or line primitive
89cdf0e10cSrcweir             Primitive2DReference xReference;
90cdf0e10cSrcweir 			basegfx::B2DPolyPolygon aScaledOutline(rPolyPolygon);
91cdf0e10cSrcweir             aScaledOutline.transform(rMatrix);
92cdf0e10cSrcweir 
93cdf0e10cSrcweir             if(bFilled)
94cdf0e10cSrcweir             {
95cdf0e10cSrcweir                 xReference = new PolyPolygonColorPrimitive2D(
96cdf0e10cSrcweir                     basegfx::B2DPolyPolygon(aScaledOutline),
97cdf0e10cSrcweir                     basegfx::BColor(0.0, 0.0, 0.0));
98cdf0e10cSrcweir             }
99cdf0e10cSrcweir             else
100cdf0e10cSrcweir             {
101cdf0e10cSrcweir 				const basegfx::BColor aGrayTone(0xc0 / 255.0, 0xc0 / 255.0, 0xc0 / 255.0);
102cdf0e10cSrcweir 
103cdf0e10cSrcweir                 xReference = new PolyPolygonHairlinePrimitive2D(
104cdf0e10cSrcweir                     aScaledOutline,
105cdf0e10cSrcweir                     aGrayTone);
106cdf0e10cSrcweir             }
107cdf0e10cSrcweir 
108cdf0e10cSrcweir             // create HiddenGeometryPrimitive2D
109cdf0e10cSrcweir             return Primitive2DReference(
110cdf0e10cSrcweir                 new HiddenGeometryPrimitive2D(Primitive2DSequence(&xReference, 1)));
111cdf0e10cSrcweir         }
112cdf0e10cSrcweir 	} // end of namespace primitive2d
113cdf0e10cSrcweir } // end of namespace drawinglayer
114cdf0e10cSrcweir 
115cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
116cdf0e10cSrcweir // eof
117