• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2013 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 #ifndef RASTERMILL_FRAME_SEQUENCE_H
18 #define RASTERMILL_FRAME_SEQUENCE_H
19 
20 #include "Stream.h"
21 #include "Color.h"
22 
23 class FrameSequenceState {
24 public:
25     /**
26      * Produces a frame of animation in the output buffer, drawing (at minimum) the delta since
27      * previousFrameNr (the current contents of the buffer), or from scratch if previousFrameNr is
28      * negative
29      *
30      * Returns frame's delay time in milliseconds.
31      */
32     virtual long drawFrame(int frameNr,
33             Color8888* outputPtr, int outputPixelStride, int previousFrameNr) = 0;
~FrameSequenceState()34     virtual ~FrameSequenceState() {}
35 };
36 
37 class FrameSequence {
38 public:
39     /**
40      * Creates a FrameSequence using data from the data stream
41      *
42      * Type determined by header information in the stream
43      */
44     static FrameSequence* create(Stream* stream);
45 
~FrameSequence()46     virtual ~FrameSequence() {}
47     virtual int getWidth() const = 0;
48     virtual int getHeight() const = 0;
49     virtual bool isOpaque() const = 0;
50     virtual int getFrameCount() const = 0;
51     virtual int getDefaultLoopCount() const = 0;
52     virtual jobject getRawByteBuffer() const = 0;
53 
54     virtual FrameSequenceState* createState() const = 0;
55 };
56 
57 #endif //RASTERMILL_FRAME_SEQUENCE_H
58