Flutter Engine
The Flutter Engine
SkottieAnimationActivity.java
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8package org.skia.jetskidemo;
9
10import android.app.Activity;
11import android.content.res.Resources;
12import android.os.Bundle;
13import android.view.SurfaceView;
14
15import org.skia.jetski.*;
16import org.skia.jetski.util.*;
17import org.skia.jetskidemo.samples.SkottieSample;
18
20 private SkottieSample mSample;
21 private float mSurfaceWidth,
22 mSurfaceHeight;
23
24 SkottieAnimationRenderer(Resources res, int resID) {
25 mSample = new SkottieSample(res, resID);
26 }
27
28 @Override
30 mSurfaceWidth = surface.getWidth();
31 mSurfaceHeight = surface.getHeight();
32 }
33
34 @Override
35 protected void onRenderFrame(Canvas canvas, long ms) {
36 canvas.drawColor(1, 1, 1, 1);
37 mSample.render(canvas, ms, 0, 0, mSurfaceWidth, mSurfaceHeight);
38 }
39}
40
41public class SkottieAnimationActivity extends Activity {
42 static {
43 System.loadLibrary("jetski");
44 }
45
46 @Override
47 protected void onCreate(Bundle savedInstanceState) {
48 super.onCreate(savedInstanceState);
49 setContentView(R.layout.activity_animation);
50
51 SurfaceView sv = findViewById(R.id.surfaceView);
52 sv.getHolder().addCallback(new SkottieAnimationRenderer(getResources(), R.raw.im_thirsty));
53 }
54}
void drawColor(Color c)
Definition: Canvas.java:99
void render(Canvas canvas, long ms, float left, float top, float right, float bottom)
VkSurfaceKHR surface
Definition: main.cc:49
#define R(r)