1*d1766043SAndrew Rist/**************************************************************
2*d1766043SAndrew Rist *
3*d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*d1766043SAndrew Rist * distributed with this work for additional information
6*d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9*d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10*d1766043SAndrew Rist *
11*d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*d1766043SAndrew Rist *
13*d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*d1766043SAndrew Rist * software distributed under the License is distributed on an
15*d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17*d1766043SAndrew Rist * specific language governing permissions and limitations
18*d1766043SAndrew Rist * under the License.
19*d1766043SAndrew Rist *
20*d1766043SAndrew Rist *************************************************************/
21*d1766043SAndrew Rist
22*d1766043SAndrew Rist
23cdf0e10cSrcweir#ifndef __com_sun_star_rendering_XSprite_idl__
24cdf0e10cSrcweir#define __com_sun_star_rendering_XSprite_idl__
25cdf0e10cSrcweir
26cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__
27cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
28cdf0e10cSrcweir#endif
29cdf0e10cSrcweir#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
30cdf0e10cSrcweir#include <com/sun/star/lang/IllegalArgumentException.idl>
31cdf0e10cSrcweir#endif
32cdf0e10cSrcweir#ifndef __com_sun_star_geometry_RealPoint2D_idl__
33cdf0e10cSrcweir#include <com/sun/star/geometry/RealPoint2D.idl>
34cdf0e10cSrcweir#endif
35cdf0e10cSrcweir#ifndef __com_sun_star_geometry_AffineMatrix2D_idl__
36cdf0e10cSrcweir#include <com/sun/star/geometry/AffineMatrix2D.idl>
37cdf0e10cSrcweir#endif
38cdf0e10cSrcweir#ifndef __com_sun_star_rendering_ViewState_idl__
39cdf0e10cSrcweir#include <com/sun/star/rendering/ViewState.idl>
40cdf0e10cSrcweir#endif
41cdf0e10cSrcweir#ifndef __com_sun_star_rendering_RenderState_idl__
42cdf0e10cSrcweir#include <com/sun/star/rendering/RenderState.idl>
43cdf0e10cSrcweir#endif
44cdf0e10cSrcweir
45cdf0e10cSrcweirmodule com { module sun { module star { module rendering {
46cdf0e10cSrcweir
47cdf0e10cSrcweir/** Interface to control a sprite object.<p>
48cdf0e10cSrcweir
49cdf0e10cSrcweir    This is the basic interface to control a sprite object on a
50cdf0e10cSrcweir    <type>XSpriteCanvas</type>. Sprites are moving, back-buffered
51cdf0e10cSrcweir    objects.<p>
52cdf0e10cSrcweir */
53cdf0e10cSrcweirpublished interface XSprite : ::com::sun::star::uno::XInterface
54cdf0e10cSrcweir{
55cdf0e10cSrcweir    /** Set overall transparency of the sprite.<p>
56cdf0e10cSrcweir
57cdf0e10cSrcweir        This method is useful for e.g. fading in/out of animations.<p>
58cdf0e10cSrcweir
59cdf0e10cSrcweir        Please note that if this sprite is not animated, the
60cdf0e10cSrcweir        associated <type>XSpriteCanvas</type> does not update changed
61cdf0e10cSrcweir        sprites automatically, but has to be told to do so via
62cdf0e10cSrcweir        <member>XSpriteCanvas::updateScreen()</member>.<p>
63cdf0e10cSrcweir
64cdf0e10cSrcweir        @param nAlpha
65cdf0e10cSrcweir        New global alpha value to composite this sprite with the
66cdf0e10cSrcweir        background. Valid range is [0,1].
67cdf0e10cSrcweir
68cdf0e10cSrcweir        @throws <type>com::sun::star::lang::IllegalArgumentException</type>
69cdf0e10cSrcweir        if nAlpha is not within the permissible range.
70cdf0e10cSrcweir     */
71cdf0e10cSrcweir    void setAlpha( [in] double nAlpha )
72cdf0e10cSrcweir        raises (com::sun::star::lang::IllegalArgumentException);
73cdf0e10cSrcweir
74cdf0e10cSrcweir    //-------------------------------------------------------------------------
75cdf0e10cSrcweir
76cdf0e10cSrcweir    /** Move sprite to the specified position.<p>
77cdf0e10cSrcweir
78cdf0e10cSrcweir        The position specified here is first transformed by the
79cdf0e10cSrcweir        combined view and render transformation. The resulting
80cdf0e10cSrcweir        position is then used as the output position (also in device
81cdf0e10cSrcweir        coordinates) of the rendered sprite content.<p>
82cdf0e10cSrcweir
83cdf0e10cSrcweir        Please note that if this sprite is not animated, the
84cdf0e10cSrcweir        associated <type>XSpriteCanva</type> does not update changed sprites
85cdf0e10cSrcweir        automatically, but has to be told to do so via
86cdf0e10cSrcweir        <member>XSpriteCanvas::updateScreen()</member>.<p>
87cdf0e10cSrcweir
88cdf0e10cSrcweir        @param aNewPos
89cdf0e10cSrcweir        The new position, in user coordinate space, to move the sprite to.
90cdf0e10cSrcweir
91cdf0e10cSrcweir        @param aViewState
92cdf0e10cSrcweir        The viewstate to be used when interpreting aNewPos.
93cdf0e10cSrcweir
94cdf0e10cSrcweir        @param aRenderState
95cdf0e10cSrcweir        The renderstate to be used when interpreting aNewPos.
96cdf0e10cSrcweir
97cdf0e10cSrcweir        @throws <type>com::sun::star::lang::IllegalArgumentException</type>
98cdf0e10cSrcweir        if one of the view and renderstate parameters are outside the
99cdf0e10cSrcweir        specified range.
100cdf0e10cSrcweir     */
101cdf0e10cSrcweir    void move( [in] ::com::sun::star::geometry::RealPoint2D aNewPos, [in] ViewState aViewState, [in] RenderState aRenderState )
102cdf0e10cSrcweir        raises (com::sun::star::lang::IllegalArgumentException);
103cdf0e10cSrcweir
104cdf0e10cSrcweir    //-------------------------------------------------------------------------
105cdf0e10cSrcweir
106cdf0e10cSrcweir    /** Apply a local transformation to the sprite.<p>
107cdf0e10cSrcweir
108cdf0e10cSrcweir        The given transformation matrix locally transforms the sprite
109cdf0e10cSrcweir        shape. If this transformation contains translational
110cdf0e10cSrcweir        components, be aware that sprite content moved beyond the
111cdf0e10cSrcweir        sprite area (a box from (0,0) to (spriteWidth,spriteHeight))
112cdf0e10cSrcweir        might (but need not) be clipped. Use
113cdf0e10cSrcweir        <member>XSprite::move</member> to change the sprite location
114cdf0e10cSrcweir        on screen. The canvas implementations are free, if they have a
115cdf0e10cSrcweir        cached representation of the sprite at hand, to transform only
116cdf0e10cSrcweir        this cached representation (e.g. a bitmap), instead of
117cdf0e10cSrcweir        re-rendering the sprite from first principles. This is usually
118cdf0e10cSrcweir        the case for an implementation of a <type>XCustomSprite</type>
119cdf0e10cSrcweir        interface, since it typically has no other cached pictorial
120cdf0e10cSrcweir        information at hand.<p>
121cdf0e10cSrcweir
122cdf0e10cSrcweir        Please note that if this sprite is not animated, the
123cdf0e10cSrcweir        associated <type>XSpriteCanvas</type> does not update changed
124cdf0e10cSrcweir        sprites automatically, but has to be told to do so via
125cdf0e10cSrcweir        <member>XSpriteCanvas::updateScreen()</member>.<p>
126cdf0e10cSrcweir
127cdf0e10cSrcweir        @param aTransformation
128cdf0e10cSrcweir        The transformation to apply to the sprite shape.
129cdf0e10cSrcweir
130cdf0e10cSrcweir        @throws <type>com::sun::star::lang::IllegalArgumentException</type>
131cdf0e10cSrcweir        if the given transformation matrix is singular.
132cdf0e10cSrcweir     */
133cdf0e10cSrcweir    void transform( [in] com::sun::star::geometry::AffineMatrix2D aTransformation )
134cdf0e10cSrcweir        raises (com::sun::star::lang::IllegalArgumentException);
135cdf0e10cSrcweir
136cdf0e10cSrcweir    //-------------------------------------------------------------------------
137cdf0e10cSrcweir
138cdf0e10cSrcweir    /** Apply a clipping to the shape output.<p>
139cdf0e10cSrcweir
140cdf0e10cSrcweir        The given clip poly-polygon is always interpreted in device
141cdf0e10cSrcweir        coordinate space. As the sprite has its own local coordinate
142cdf0e10cSrcweir        system, with its origin on screen being equal to its current
143cdf0e10cSrcweir        position, the clip poly-polygon's origin will always coincide
144cdf0e10cSrcweir        with the sprite's origin. Furthermore, if any sprite
145cdf0e10cSrcweir        transformation is set via transform(), the clip is subject to
146cdf0e10cSrcweir        this transformation, too. The implementation is free, if it
147cdf0e10cSrcweir        has a cached representation of the sprite at hand, to
148cdf0e10cSrcweir        clip-output only this cached representation (e.g. a bitmap),
149cdf0e10cSrcweir        instead of re-rendering the sprite from first principles. This
150cdf0e10cSrcweir        is usually the case for an implementation of a
151cdf0e10cSrcweir        <type>XCustomSprite</type> interface, since it typically has
152cdf0e10cSrcweir        no other cached pictorial information at hand.<p>
153cdf0e10cSrcweir
154cdf0e10cSrcweir        Please note that if this sprite is not animated, the
155cdf0e10cSrcweir        associated <type>XSpriteCanvas</type> does not update changed
156cdf0e10cSrcweir        sprites automatically, but has to be told to do so via
157cdf0e10cSrcweir        <member>XSpriteCanvas::updateScreen()</member>.<p>
158cdf0e10cSrcweir
159cdf0e10cSrcweir        Specifying an empty interface denotes no clipping,
160cdf0e10cSrcweir        i.e. everything contained in the sprite will be visible
161cdf0e10cSrcweir        (subject to device-dependent constraints, of
162cdf0e10cSrcweir        course). Specifying an empty XPolyPolygon2D, i.e. a
163cdf0e10cSrcweir        poly-polygon containing zero polygons, or an XPolyPolygon2D
164cdf0e10cSrcweir        with any number of empty sub-polygons, denotes the NULL
165cdf0e10cSrcweir        clip. That means, nothing from the sprite will be visible.<p>
166cdf0e10cSrcweir
167cdf0e10cSrcweir        @param aClip
168cdf0e10cSrcweir        The clip poly-polygon to apply.
169cdf0e10cSrcweir     */
170cdf0e10cSrcweir    void clip( [in] XPolyPolygon2D aClip );
171cdf0e10cSrcweir
172cdf0e10cSrcweir    //-------------------------------------------------------------------------
173cdf0e10cSrcweir
174cdf0e10cSrcweir    /** Set sprite priority.<p>
175cdf0e10cSrcweir
176cdf0e10cSrcweir        The sprite priority determines the order of rendering relative
177cdf0e10cSrcweir        to all other sprites of the associated canvas. The higher the
178cdf0e10cSrcweir        priority, the later will the sprite be rendered, or, in other
179cdf0e10cSrcweir        words, the closer to the screen surface the sprite is shown.<p>
180cdf0e10cSrcweir
181cdf0e10cSrcweir        @param nPriority
182cdf0e10cSrcweir        New sprite priority value to serve as the sort key when
183cdf0e10cSrcweir        determining sprite rendering order. Avoid NaNs and other
184cdf0e10cSrcweir        irregular floating point values here, the order position for
185cdf0e10cSrcweir        sprites with such a priority value is undefined.
186cdf0e10cSrcweir     */
187cdf0e10cSrcweir    void setPriority( [in] double nPriority );
188cdf0e10cSrcweir
189cdf0e10cSrcweir    //-------------------------------------------------------------------------
190cdf0e10cSrcweir
191cdf0e10cSrcweir    /** Make the sprite visible.<p>
192cdf0e10cSrcweir
193cdf0e10cSrcweir        This method makes the sprite visible on the canvas it was
194cdf0e10cSrcweir        created on.<p>
195cdf0e10cSrcweir     */
196cdf0e10cSrcweir    void show();
197cdf0e10cSrcweir
198cdf0e10cSrcweir    //-------------------------------------------------------------------------
199cdf0e10cSrcweir
200cdf0e10cSrcweir    /** Make the sprite invisible.<p>
201cdf0e10cSrcweir
202cdf0e10cSrcweir        This method makes the sprite invisible.<p>
203cdf0e10cSrcweir     */
204cdf0e10cSrcweir    void hide();
205cdf0e10cSrcweir
206cdf0e10cSrcweir};
207cdf0e10cSrcweir
208cdf0e10cSrcweir}; }; }; };
209cdf0e10cSrcweir
210cdf0e10cSrcweir#endif
211