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 23 24 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GROUPPRIMITIVE2D_HXX 25 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GROUPPRIMITIVE2D_HXX 26 27 #include <drawinglayer/drawinglayerdllapi.h> 28 #include <drawinglayer/primitive2d/baseprimitive2d.hxx> 29 30 ////////////////////////////////////////////////////////////////////////////// 31 // GroupPrimitive2D class 32 33 namespace drawinglayer 34 { 35 namespace primitive2d 36 { 37 /** GroupPrimitive2D class 38 39 Baseclass for all grouping 2D primitives 40 41 The grouping primitive in it's basic form is capable of holding 42 a child primitive content and returns it on decomposition on default. 43 It is used for two main purposes, but more may apply: 44 45 - to transport extended information, e.g. for text classification, 46 see e.g. TextHierarchy*Primitive2D implementations. Since they 47 decompose to their child content, renderers not aware/interested 48 in that extra information will just ignore these primitives 49 50 - to encapsulate common geometry, e.g. the ShadowPrimitive2D implements 51 applying a generic shadow to a child sequence by adding the needed 52 offset and color stuff in the decomposition 53 54 In most cases the decomposition is straightforward, so by default 55 this primitive will not buffer the result and is not derived from 56 BufferedDecompositionPrimitive2D, but from BasePrimitive2D. 57 58 A renderer has to take GroupPrimitive2D derivations into account which 59 are used to hold a state. 60 61 Current Basic 2D StatePrimitives are: 62 63 - TransparencePrimitive2D (objects with freely defined transparence) 64 - InvertPrimitive2D (for XOR) 65 - MaskPrimitive2D (for masking) 66 - ModifiedColorPrimitive2D (for a stack of color modifications) 67 - TransformPrimitive2D (for a transformation stack) 68 */ 69 class DRAWINGLAYER_DLLPUBLIC GroupPrimitive2D : public BasePrimitive2D 70 { 71 private: 72 /// the children. Declared private since this shall never be changed at all after construction 73 Primitive2DSequence maChildren; 74 75 public: 76 /// constructor 77 GroupPrimitive2D(const Primitive2DSequence& rChildren); 78 79 /// data read access getChildren() const80 const Primitive2DSequence& getChildren() const { return maChildren; } 81 82 /// compare operator 83 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; 84 85 /// local decomposition. Implementation will just return children 86 virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 87 88 /// provide unique ID 89 DeclPrimitrive2DIDBlock() 90 }; 91 } // end of namespace primitive2d 92 } // end of namespace drawinglayer 93 94 ////////////////////////////////////////////////////////////////////////////// 95 96 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GROUPPRIMITIVE2D_HXX 97 98 ////////////////////////////////////////////////////////////////////////////// 99 // eof 100