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#ifndef __com_sun_star_rendering_XSpriteCanvas_idl__
24#define __com_sun_star_rendering_XSpriteCanvas_idl__
25
26#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
27#include <com/sun/star/lang/IllegalArgumentException.idl>
28#endif
29#ifndef __com_sun_star_rendering_XBitmapCanvas_idl__
30#include <com/sun/star/rendering/XBitmapCanvas.idl>
31#endif
32#ifndef __com_sun_star_rendering_XAnimation_idl__
33#include <com/sun/star/rendering/XAnimation.idl>
34#endif
35#ifndef __com_sun_star_rendering_VolatileContentDestroyedException_idl__
36#include <com/sun/star/rendering/VolatileContentDestroyedException.idl>
37#endif
38
39module com { module sun { module star { module rendering {
40
41published interface XSprite;
42published interface XAnimatedSprite;
43published interface XCustomSprite;
44
45/** Specialization of a XBitmapCanvas, where moving, animated objects
46    (called sprites) are supported.<p>
47
48    @attention The screen output of canvas drawing operations is
49    undefined, unless XSpriteCanvas::updateScreen() is called. This is
50    because a sprite canvas might choose to employ double buffering to
51    reduce animation flicker, and cannot know the instant suitable to
52    display the newly rendered canvas content. When using external
53    double-buffering via XBufferController on a sprite canvas, the
54    implementation takes care of this issue, and in this case is able
55    to render correctly even without explicit updateScreen() calls
56    (because there's a defined moment in time where content display
57    can happen, namely the XBufferController::showBuffer()) call. If
58    you don't need sprite functionality, and don't want the
59    updateScreen hassle, simply use the XBitmapCanvas.
60 */
61published interface XSpriteCanvas : XBitmapCanvas
62{
63    /** Create a sprite object from the specified animation
64        sequence. A sprite is a back-buffered object with its own,
65        independent animation.
66     */
67    XAnimatedSprite	createSpriteFromAnimation( [in] XAnimation animation )
68        raises (com::sun::star::lang::IllegalArgumentException);
69
70    /** Create a sprite object from the specified animation
71        sequence.
72
73        A sprite is a back-buffered object with its own,
74        independent animation.
75
76        @param animationBitmaps
77        Sequence of bitmaps. The bitmaps don't need to have the same
78        size, but they are all rendered with their left, top edges
79        aligned.
80
81        @param interpolationMode
82        Value of <type>InterpolationMode</type>, to determine whether
83        and how to interpolate between the provided bitmaps, if
84        animation runs fast enough.
85
86        @throws <type>VolatileContentDestroyedException</type>
87        if at least one of the bitmap is volatile, and its content has been destroyed by the system.
88     */
89    XAnimatedSprite	createSpriteFromBitmaps( [in] sequence<XBitmap> animationBitmaps, [in] byte interpolationMode )
90        raises (com::sun::star::lang::IllegalArgumentException,
91                VolatileContentDestroyedException);
92
93    /** Create a custom, user-handles-it-all sprite object.
94
95        A sprite is a back-buffered object with its own, independent
96        animation.
97
98        @param spriteSize
99        The required size of the sprite in device
100        coordinates. Everything that is rendered outside this area
101        might be clipped on output. Both components of the size must
102        be greater than zero.
103
104        @return an interface to a custom sprite object.
105     */
106    XCustomSprite createCustomSprite( [in] ::com::sun::star::geometry::RealSize2D spriteSize )
107        raises (com::sun::star::lang::IllegalArgumentException);
108
109    /** Create a cloned version of an already existing sprite
110        object.
111
112        The cloned sprite always shows the same content as its
113        original. Furthermore, cloned copies of a hidden original are
114        never visible, although cloned copies of a visible original
115        can of course be invisible.
116
117        @param original
118        The original sprite to copy the content from. This sprite must
119        have been created by the same XSpriteCanvas instance as this
120        method is called on. Other sprite instances will generate an
121        IllegalArgumentException.
122
123        @return an interface to a sprite object.
124     */
125    XSprite createClonedSprite( [in] XSprite original )
126        raises (com::sun::star::lang::IllegalArgumentException);
127
128    /** Tells the sprite canvas to now update the screen
129        representation.
130
131        Required to display rendered changes to the canvas, and
132        updates to stopped animations and XCustomSprites in
133        general. This method will return only after the screen update
134        is done, or earlier if an error happened.<p>
135
136        If double buffering is enabled via XBufferController, no
137        explicit call of updateScreen() is necessary, since the
138        XBufferController methods will automatically notify all
139        associated XSpriteCanvas instances.<p>
140
141        @param bUpdateAll
142        When <TRUE/>, update the whole screen. When <FALSE/>,
143        implementation is permitted to restrict update to areas the
144        canvas itself changed (e.g. because of render operations, or
145        changes on the sprites). The former is useful for updates
146        after window expose events. the latter for animation display.
147
148        @return <TRUE/>, if the screen update was successfully
149        performed
150     */
151    boolean updateScreen( [in] boolean bUpdateAll );
152};
153
154}; }; }; };
155
156#endif
157