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