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 #if ! defined INCLUDED_SLIDESHOW_CLIPPINGFUNCTOR_HXX
25 #define INCLUDED_SLIDESHOW_CLIPPINGFUNCTOR_HXX
26 
27 #include <basegfx/numeric/ftools.hxx>
28 #include <basegfx/vector/b2dsize.hxx>
29 #include <basegfx/matrix/b2dhommatrix.hxx>
30 #include <basegfx/polygon/b2dpolypolygontools.hxx>
31 #include <transitioninfo.hxx>
32 #include <parametricpolypolygon.hxx>
33 
34 
35 namespace slideshow
36 {
37     namespace internal
38     {
39         /** Generates the final clipping polygon.
40 
41         	This class serves as the functor, which generates the
42         	final clipping polygon from a given ParametricPolyPolygon
43         	and a TransitionInfo.
44 
45             The ParametricPolyPolygon can be obtained from the
46             ParametricPolyPolygonFactory, see there.
47 
48             The TransitionInfo further parameterizes the polygon
49             generated by the ParametricPolyPolygon, with common
50             modifications such as rotation, flipping, or change of
51             direction. This allows the ParametricPolyPolygonFactory to
52             provide only prototypical shapes, with the ClippingFunctor
53             further customizing the output.
54          */
55         class ClippingFunctor
56         {
57         public:
58             ClippingFunctor(
59                 const ParametricPolyPolygonSharedPtr&   rPolygon,
60                 const TransitionInfo&                   rTransitionInfo,
61                 bool                                    bDirectionForward,
62                 bool                                    bModeIn );
63 
64             /** Generate clip polygon.
65 
66             	@param nValue
67                 Value to generate the polygon for. Must be in the
68                 range [0,1].
69 
70                 @param rTargetSize
71                 Size the clip polygon should cover. This is typically
72                 the size of the object the effect is applied on.
73              */
74             ::basegfx::B2DPolyPolygon operator()( double 					nValue,
75                                                   const ::basegfx::B2DSize& rTargetSize );
76 
77         private:
78             ParametricPolyPolygonSharedPtr     mpParametricPoly;
79             ::basegfx::B2DHomMatrix            maStaticTransformation;
80             // AW: Not needed
81 			// ::basegfx::B2DPolyPolygon          maBackgroundRect;
82             bool                               mbForwardParameterSweep;
83             bool                               mbSubtractPolygon;
84             const bool                         mbScaleIsotrophically;
85             bool                               mbFlip;
86         };
87 
88     }
89 }
90 
91 #endif /* INCLUDED_SLIDESHOW_CLIPPINGFUNCTOR_HXX */
92