1 /************************************************************** 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 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 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. 19 * 20 *************************************************************/ 21 22 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_QUADRATICSHADOWPRIMITIVE2D_HXX 23 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_QUADRATICSHADOWPRIMITIVE2D_HXX 24 25 #include <drawinglayer/drawinglayerdllapi.h> 26 #include <drawinglayer/primitive2d/primitivetools2d.hxx> 27 #include <vcl/bitmapex.hxx> 28 #include <basegfx/matrix/b2dhommatrix.hxx> 29 30 // DiscreteShadowPrimitive2D class 31 32 namespace drawinglayer 33 { 34 namespace primitive2d 35 { 36 /** DiscreteShadow data class 37 38 */ 39 class DRAWINGLAYER_DLLPUBLIC DiscreteShadow 40 { 41 private: 42 // the original shadow BitmapEx in a special form 43 BitmapEx maBitmapEx; 44 45 // buffered extracted parts of CombinedShadow for easier usage 46 BitmapEx maTopLeft; 47 BitmapEx maTop; 48 BitmapEx maTopRight; 49 BitmapEx maRight; 50 BitmapEx maBottomRight; 51 BitmapEx maBottom; 52 BitmapEx maBottomLeft; 53 BitmapEx maLeft; 54 55 public: 56 // constructor 57 DiscreteShadow(const BitmapEx& rBitmapEx); 58 59 // data read access getBitmapEx() const60 const BitmapEx& getBitmapEx() const { return maBitmapEx; } 61 62 // compare operator operator ==(const DiscreteShadow & rCompare) const63 bool operator==(const DiscreteShadow& rCompare) const 64 { 65 return getBitmapEx() == rCompare.getBitmapEx(); 66 } 67 68 // helper accesses which create on-demand needed segments 69 const BitmapEx& getTopLeft() const; 70 const BitmapEx& getTop() const; 71 const BitmapEx& getTopRight() const; 72 const BitmapEx& getRight() const; 73 const BitmapEx& getBottomRight() const; 74 const BitmapEx& getBottom() const; 75 const BitmapEx& getBottomLeft() const; 76 const BitmapEx& getLeft() const; 77 }; 78 79 /** DiscreteShadowPrimitive2D class 80 81 */ 82 class DRAWINGLAYER_DLLPUBLIC DiscreteShadowPrimitive2D : public DiscreteMetricDependentPrimitive2D 83 { 84 private: 85 // the object transformation of the rectangular object 86 basegfx::B2DHomMatrix maTransform; 87 88 // the bitmap shadow data 89 DiscreteShadow maDiscreteShadow; 90 91 protected: 92 // create local decomposition 93 virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 94 95 public: 96 // constructor 97 DiscreteShadowPrimitive2D( 98 const basegfx::B2DHomMatrix& rTransform, 99 const DiscreteShadow& rDiscreteShadow); 100 101 // data read access getTransform() const102 const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } getDiscreteShadow() const103 const DiscreteShadow& getDiscreteShadow() const { return maDiscreteShadow; } 104 105 // compare operator 106 virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 107 108 // get range 109 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; 110 111 // provide unique ID 112 DeclPrimitrive2DIDBlock() 113 }; 114 } // end of namespace primitive2d 115 } // end of namespace drawinglayer 116 117 #endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_QUADRATICSHADOWPRIMITIVE2D_HXX 118 119 /* vim: set noet sw=4 ts=4: */ 120