xref: /trunk/main/cppcanvas/inc/cppcanvas/sprite.hxx (revision 2d788491)
1*2d788491SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2d788491SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2d788491SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2d788491SAndrew Rist  * distributed with this work for additional information
6*2d788491SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2d788491SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2d788491SAndrew Rist  * "License"); you may not use this file except in compliance
9*2d788491SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2d788491SAndrew Rist  *
11*2d788491SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2d788491SAndrew Rist  *
13*2d788491SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2d788491SAndrew Rist  * software distributed under the License is distributed on an
15*2d788491SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2d788491SAndrew Rist  * KIND, either express or implied.  See the License for the
17*2d788491SAndrew Rist  * specific language governing permissions and limitations
18*2d788491SAndrew Rist  * under the License.
19*2d788491SAndrew Rist  *
20*2d788491SAndrew Rist  *************************************************************/
21*2d788491SAndrew Rist 
22*2d788491SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _CPPCANVAS_SPRITE_HXX
25cdf0e10cSrcweir #define _CPPCANVAS_SPRITE_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir namespace basegfx
32cdf0e10cSrcweir {
33cdf0e10cSrcweir     class B2DHomMatrix;
34cdf0e10cSrcweir     class B2DPolyPolygon;
35cdf0e10cSrcweir     class B2DPoint;
36cdf0e10cSrcweir }
37cdf0e10cSrcweir 
38cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace rendering
39cdf0e10cSrcweir {
40cdf0e10cSrcweir     class  XSprite;
41cdf0e10cSrcweir } } } }
42cdf0e10cSrcweir 
43cdf0e10cSrcweir 
44cdf0e10cSrcweir /* Definition of Sprite class */
45cdf0e10cSrcweir 
46cdf0e10cSrcweir namespace cppcanvas
47cdf0e10cSrcweir {
48cdf0e10cSrcweir 
49cdf0e10cSrcweir     class Sprite
50cdf0e10cSrcweir     {
51cdf0e10cSrcweir     public:
~Sprite()52cdf0e10cSrcweir         virtual ~Sprite() {}
53cdf0e10cSrcweir 
54cdf0e10cSrcweir         virtual void setAlpha( const double& rAlpha ) = 0;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir         /** Set the sprite position on screen
57cdf0e10cSrcweir 
58cdf0e10cSrcweir         	This method differs from the XSprite::move() insofar, as
59cdf0e10cSrcweir         	no viewstate/renderstate transformations are applied to
60cdf0e10cSrcweir         	the specified position. The given position is interpreted
61cdf0e10cSrcweir         	in device coordinates (i.e. screen pixel)
62cdf0e10cSrcweir          */
63cdf0e10cSrcweir         virtual void movePixel( const ::basegfx::B2DPoint& rNewPos ) = 0;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir         /** Set the sprite position on screen
66cdf0e10cSrcweir 
67cdf0e10cSrcweir         	This method sets the sprite position in the view
68cdf0e10cSrcweir         	coordinate system of the parent canvas
69cdf0e10cSrcweir          */
70cdf0e10cSrcweir         virtual void move( const ::basegfx::B2DPoint& rNewPos ) = 0;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir         virtual void transform( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir         /** Set output clipping
75cdf0e10cSrcweir 
76cdf0e10cSrcweir         	This method differs from the XSprite::clip() insofar, as
77cdf0e10cSrcweir         	no viewstate/renderstate transformations are applied to
78cdf0e10cSrcweir         	the specified clip polygon. The given polygon is
79cdf0e10cSrcweir         	interpreted in device coordinates (i.e. screen pixel)
80cdf0e10cSrcweir          */
81cdf0e10cSrcweir         virtual void setClipPixel( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir         /** Set output clipping
84cdf0e10cSrcweir 
85cdf0e10cSrcweir         	This method applies the clip poly-polygon interpreted in
86cdf0e10cSrcweir         	the view coordinate system of the parent canvas.
87cdf0e10cSrcweir          */
88cdf0e10cSrcweir         virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir         virtual void setClip() = 0;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir         virtual void show() = 0;
93cdf0e10cSrcweir         virtual void hide() = 0;
94cdf0e10cSrcweir 
95cdf0e10cSrcweir         /** Change the sprite priority
96cdf0e10cSrcweir 
97cdf0e10cSrcweir             @param fPriority
98cdf0e10cSrcweir             New sprite priority. The higher the priority, the further
99cdf0e10cSrcweir             towards the viewer the sprite appears. That is, sprites
100cdf0e10cSrcweir             with higher priority appear before ones with lower
101cdf0e10cSrcweir             priority.
102cdf0e10cSrcweir          */
103cdf0e10cSrcweir         virtual void setPriority( double fPriority ) = 0;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference<
106cdf0e10cSrcweir             ::com::sun::star::rendering::XSprite > getUNOSprite() const = 0;
107cdf0e10cSrcweir     };
108cdf0e10cSrcweir 
109cdf0e10cSrcweir     typedef ::boost::shared_ptr< ::cppcanvas::Sprite > SpriteSharedPtr;
110cdf0e10cSrcweir }
111cdf0e10cSrcweir 
112cdf0e10cSrcweir #endif /* _CPPCANVAS_SPRITE_HXX */
113