1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.ide.common.rendering.api; 18 19 20 import java.awt.image.BufferedImage; 21 22 public interface IAnimationListener { 23 /** 24 * Called when a new animation frame is available for display. 25 * 26 * <p>The {@link RenderSession} object is provided as a convenience. It should be queried 27 * for the image through {@link RenderSession#getImage()}. 28 * 29 * <p>If no {@link IImageFactory} is used, then each new animation frame will be rendered 30 * in its own new {@link BufferedImage} object. However if an image factory is used, and it 31 * always re-use the same object, then the image is only guaranteed to be valid during 32 * this method call. As soon as this method return the image content will be overridden 33 * with new drawing. 34 * 35 */ 36 void onNewFrame(RenderSession scene); 37 38 /** 39 * Called when the animation is done playing. 40 */ 41 void done(Result result); 42 43 /** 44 * Return true to cancel the animation. 45 */ 46 boolean isCanceled(); 47 48 } 49