xref: /AOO41X/main/cppcanvas/inc/cppcanvas/sprite.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _CPPCANVAS_SPRITE_HXX
29 #define _CPPCANVAS_SPRITE_HXX
30 
31 #include <com/sun/star/uno/Reference.hxx>
32 
33 #include <boost/shared_ptr.hpp>
34 
35 namespace basegfx
36 {
37     class B2DHomMatrix;
38     class B2DPolyPolygon;
39     class B2DPoint;
40 }
41 
42 namespace com { namespace sun { namespace star { namespace rendering
43 {
44     class  XSprite;
45 } } } }
46 
47 
48 /* Definition of Sprite class */
49 
50 namespace cppcanvas
51 {
52 
53     class Sprite
54     {
55     public:
56         virtual ~Sprite() {}
57 
58         virtual void setAlpha( const double& rAlpha ) = 0;
59 
60         /** Set the sprite position on screen
61 
62         	This method differs from the XSprite::move() insofar, as
63         	no viewstate/renderstate transformations are applied to
64         	the specified position. The given position is interpreted
65         	in device coordinates (i.e. screen pixel)
66          */
67         virtual void movePixel( const ::basegfx::B2DPoint& rNewPos ) = 0;
68 
69         /** Set the sprite position on screen
70 
71         	This method sets the sprite position in the view
72         	coordinate system of the parent canvas
73          */
74         virtual void move( const ::basegfx::B2DPoint& rNewPos ) = 0;
75 
76         virtual void transform( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
77 
78         /** Set output clipping
79 
80         	This method differs from the XSprite::clip() insofar, as
81         	no viewstate/renderstate transformations are applied to
82         	the specified clip polygon. The given polygon is
83         	interpreted in device coordinates (i.e. screen pixel)
84          */
85         virtual void setClipPixel( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
86 
87         /** Set output clipping
88 
89         	This method applies the clip poly-polygon interpreted in
90         	the view coordinate system of the parent canvas.
91          */
92         virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
93 
94         virtual void setClip() = 0;
95 
96         virtual void show() = 0;
97         virtual void hide() = 0;
98 
99         /** Change the sprite priority
100 
101             @param fPriority
102             New sprite priority. The higher the priority, the further
103             towards the viewer the sprite appears. That is, sprites
104             with higher priority appear before ones with lower
105             priority.
106          */
107         virtual void setPriority( double fPriority ) = 0;
108 
109         virtual ::com::sun::star::uno::Reference<
110             ::com::sun::star::rendering::XSprite > getUNOSprite() const = 0;
111     };
112 
113     typedef ::boost::shared_ptr< ::cppcanvas::Sprite > SpriteSharedPtr;
114 }
115 
116 #endif /* _CPPCANVAS_SPRITE_HXX */
117