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 _CPPCANVAS_SPRITE_HXX
25 #define _CPPCANVAS_SPRITE_HXX
26 
27 #include <com/sun/star/uno/Reference.hxx>
28 
29 #include <boost/shared_ptr.hpp>
30 
31 namespace basegfx
32 {
33     class B2DHomMatrix;
34     class B2DPolyPolygon;
35     class B2DPoint;
36 }
37 
38 namespace com { namespace sun { namespace star { namespace rendering
39 {
40     class  XSprite;
41 } } } }
42 
43 
44 /* Definition of Sprite class */
45 
46 namespace cppcanvas
47 {
48 
49     class Sprite
50     {
51     public:
~Sprite()52         virtual ~Sprite() {}
53 
54         virtual void setAlpha( const double& rAlpha ) = 0;
55 
56         /** Set the sprite position on screen
57 
58         	This method differs from the XSprite::move() insofar, as
59         	no viewstate/renderstate transformations are applied to
60         	the specified position. The given position is interpreted
61         	in device coordinates (i.e. screen pixel)
62          */
63         virtual void movePixel( const ::basegfx::B2DPoint& rNewPos ) = 0;
64 
65         /** Set the sprite position on screen
66 
67         	This method sets the sprite position in the view
68         	coordinate system of the parent canvas
69          */
70         virtual void move( const ::basegfx::B2DPoint& rNewPos ) = 0;
71 
72         virtual void transform( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
73 
74         /** Set output clipping
75 
76         	This method differs from the XSprite::clip() insofar, as
77         	no viewstate/renderstate transformations are applied to
78         	the specified clip polygon. The given polygon is
79         	interpreted in device coordinates (i.e. screen pixel)
80          */
81         virtual void setClipPixel( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
82 
83         /** Set output clipping
84 
85         	This method applies the clip poly-polygon interpreted in
86         	the view coordinate system of the parent canvas.
87          */
88         virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
89 
90         virtual void setClip() = 0;
91 
92         virtual void show() = 0;
93         virtual void hide() = 0;
94 
95         /** Change the sprite priority
96 
97             @param fPriority
98             New sprite priority. The higher the priority, the further
99             towards the viewer the sprite appears. That is, sprites
100             with higher priority appear before ones with lower
101             priority.
102          */
103         virtual void setPriority( double fPriority ) = 0;
104 
105         virtual ::com::sun::star::uno::Reference<
106             ::com::sun::star::rendering::XSprite > getUNOSprite() const = 0;
107     };
108 
109     typedef ::boost::shared_ptr< ::cppcanvas::Sprite > SpriteSharedPtr;
110 }
111 
112 #endif /* _CPPCANVAS_SPRITE_HXX */
113