shadowprimitive2d.cxx (49c58f9b) shadowprimitive2d.cxx (e38dead8)
1/**************************************************************
1/**************************************************************
2 *
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
19 *
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_drawinglayer.hxx"
26
27#include <drawinglayer/primitive2d/shadowprimitive2d.hxx>

--- 11 unchanged lines hidden (view full) ---

39
40//////////////////////////////////////////////////////////////////////////////
41
42namespace drawinglayer
43{
44 namespace primitive2d
45 {
46 ShadowPrimitive2D::ShadowPrimitive2D(
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_drawinglayer.hxx"
26
27#include <drawinglayer/primitive2d/shadowprimitive2d.hxx>

--- 11 unchanged lines hidden (view full) ---

39
40//////////////////////////////////////////////////////////////////////////////
41
42namespace drawinglayer
43{
44 namespace primitive2d
45 {
46 ShadowPrimitive2D::ShadowPrimitive2D(
47 const basegfx::B2DHomMatrix& rShadowTransform,
48 const basegfx::BColor& rShadowColor,
47 const basegfx::B2DHomMatrix& rShadowTransform,
48 const basegfx::BColor& rShadowColor,
49 const Primitive2DSequence& rChildren)
50 : GroupPrimitive2D(rChildren),
51 maShadowTransform(rShadowTransform),
52 maShadowColor(rShadowColor)
53 {
54 }
55
56 bool ShadowPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
57 {
58 if(BasePrimitive2D::operator==(rPrimitive))
59 {
60 const ShadowPrimitive2D& rCompare = static_cast< const ShadowPrimitive2D& >(rPrimitive);
49 const Primitive2DSequence& rChildren)
50 : GroupPrimitive2D(rChildren),
51 maShadowTransform(rShadowTransform),
52 maShadowColor(rShadowColor)
53 {
54 }
55
56 bool ShadowPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
57 {
58 if(BasePrimitive2D::operator==(rPrimitive))
59 {
60 const ShadowPrimitive2D& rCompare = static_cast< const ShadowPrimitive2D& >(rPrimitive);
61
62 return (getShadowTransform() == rCompare.getShadowTransform()
61
62 return (getShadowTransform() == rCompare.getShadowTransform()
63 && getShadowColor() == rCompare.getShadowColor());
64 }
65
66 return false;
67 }
68
69 basegfx::B2DRange ShadowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
70 {
71 basegfx::B2DRange aRetval(getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation));
72 aRetval.transform(getShadowTransform());
73 return aRetval;
74 }
75
76 Primitive2DSequence ShadowPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
77 {
78 Primitive2DSequence aRetval;
79
63 && getShadowColor() == rCompare.getShadowColor());
64 }
65
66 return false;
67 }
68
69 basegfx::B2DRange ShadowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
70 {
71 basegfx::B2DRange aRetval(getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation));
72 aRetval.transform(getShadowTransform());
73 return aRetval;
74 }
75
76 Primitive2DSequence ShadowPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
77 {
78 Primitive2DSequence aRetval;
79
80 if(getChildren().hasElements())
81 {
82 // create a modifiedColorPrimitive containing the shadow color and the content
83 const basegfx::BColorModifierSharedPtr aBColorModifier(
84 new basegfx::BColorModifier_replace(
85 getShadowColor()));
86 const Primitive2DReference xRefA(
87 new ModifiedColorPrimitive2D(
88 getChildren(),
89 aBColorModifier));
90 const Primitive2DSequence aSequenceB(&xRefA, 1L);
80 if(getChildren().hasElements())
81 {
82 // create a modifiedColorPrimitive containing the shadow color and the content
83 const basegfx::BColorModifierSharedPtr aBColorModifier(
84 new basegfx::BColorModifier_replace(
85 getShadowColor()));
86 const Primitive2DReference xRefA(
87 new ModifiedColorPrimitive2D(
88 getChildren(),
89 aBColorModifier));
90 const Primitive2DSequence aSequenceB(&xRefA, 1L);
91
91
92 // build transformed primitiveVector with shadow offset and add to target
93 const Primitive2DReference xRefB(new TransformPrimitive2D(getShadowTransform(), aSequenceB));
94 aRetval = Primitive2DSequence(&xRefB, 1L);
95 }
92 // build transformed primitiveVector with shadow offset and add to target
93 const Primitive2DReference xRefB(new TransformPrimitive2D(getShadowTransform(), aSequenceB));
94 aRetval = Primitive2DSequence(&xRefB, 1L);
95 }
96
97 return aRetval;
98 }
99
100 // provide unique ID
101 ImplPrimitrive2DIDBlock(ShadowPrimitive2D, PRIMITIVE2D_ID_SHADOWPRIMITIVE2D)
102
103 } // end of namespace primitive2d
104} // end of namespace drawinglayer
105
96
97 return aRetval;
98 }
99
100 // provide unique ID
101 ImplPrimitrive2DIDBlock(ShadowPrimitive2D, PRIMITIVE2D_ID_SHADOWPRIMITIVE2D)
102
103 } // end of namespace primitive2d
104} // end of namespace drawinglayer
105
106//////////////////////////////////////////////////////////////////////////////
107// eof
106/* vim: set noet sw=4 ts=4: */