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_TRANSPARENCEPRIMITIVE2D_HXX
23 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSPARENCEPRIMITIVE2D_HXX
24 
25 #include <drawinglayer/drawinglayerdllapi.h>
26 #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
27 
28 //////////////////////////////////////////////////////////////////////////////
29 
30 namespace drawinglayer
31 {
32 	namespace primitive2d
33 	{
34         /** TransparencePrimitive2D class
35 
36             This is the basic primitive for applying freely defined transparence
37             to freely defined content. The basic idea is to associate a content
38             which is defined as a sequence of primitives and hold as child content
39             in the GroupPrimitive2D with a transparence channel also defined as a sequence
40             of primitives and hold in the transparence member.
41 
42             The basic definition is to use the transparence content as transparence-Mask by
43             interpreting the transparence-content not as RGB, but as Luminance transparence mask
44             using the common RGB_to_luminance definition as e.g. used by VCL.
45 
46             The defining geometry is the Range of the child primitive sequence,
47             this means the renderers will/shall use this geometric information for
48             rendering, not the transparent one. The transparent one should/will be clipped
49             accordingly.
50          */
51 		class DRAWINGLAYER_DLLPUBLIC TransparencePrimitive2D : public GroupPrimitive2D
52 		{
53 		private:
54             /// The transparence-Mask who's RGB-Values are interpreted as Luminance
55 			Primitive2DSequence						maTransparence;
56 
57 		public:
58             /** constructor
59 
60                 @param rChildren
61                 The content which is defined to have a transparency. The
62                 range of this primitive is defined by this content
63 
64                 @param rTransparence
65                 The definition of the Transparence-channel for this primitive. It
66                 will be interpreted as mask by interpreting as gray values
67                 using the common RGB_to_luminance definitions
68              */
69 			TransparencePrimitive2D(
70 				const Primitive2DSequence& rChildren,
71 				const Primitive2DSequence& rTransparence);
72 
73 			/// data read access
getTransparence() const74 			const Primitive2DSequence& getTransparence() const { return maTransparence; }
75 
76 			/// compare operator
77 			virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
78 
79 			/// provide unique ID
80 			DeclPrimitrive2DIDBlock()
81 		};
82 	} // end of namespace primitive2d
83 } // end of namespace drawinglayer
84 
85 //////////////////////////////////////////////////////////////////////////////
86 
87 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSPARENCEPRIMITIVE2D_HXX
88 
89 //////////////////////////////////////////////////////////////////////////////
90 // eof
91