Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | Package Functions | List of all members
org.skia.jetski.util.SkottieRenderer Class Reference
Inheritance diagram for org.skia.jetski.util.SkottieRenderer:
org.skia.jetski.util.SurfaceRenderer

Public Member Functions

void release ()
 
- Public Member Functions inherited from org.skia.jetski.util.SurfaceRenderer
void run ()
 
void surfaceCreated (SurfaceHolder holder)
 
void surfaceChanged (SurfaceHolder holder, int format, int width, int height)
 
void surfaceDestroyed (SurfaceHolder holder)
 
void setBaseTime (long millis)
 
void release ()
 

Protected Member Functions

void onSurfaceInitialized (Surface surface)
 
void onRenderFrame (Canvas canvas, long ms)
 
void finalize () throws Throwable
 
abstract void onSurfaceInitialized (Surface surface)
 
abstract void onRenderFrame (Canvas canvas, long ms)
 

Package Functions

 SkottieRenderer (SkottieAnimation mAnimation, Color mBackground)
 
void play ()
 
void pause ()
 
SkottieAnimation getAnimation ()
 

Detailed Description

Definition at line 28 of file SkottieView.java.

Constructor & Destructor Documentation

◆ SkottieRenderer()

org.skia.jetski.util.SkottieRenderer.SkottieRenderer ( SkottieAnimation  mAnimation,
Color  mBackground 
)
inlinepackage

Definition at line 35 of file SkottieView.java.

35 {
36 this.mAnimation = mAnimation;
37 this.mBackground = mBackground;
38 }

Member Function Documentation

◆ finalize()

void org.skia.jetski.util.SkottieRenderer.finalize ( ) throws Throwable
inlineprotected

Definition at line 88 of file SkottieView.java.

88 {
89 this.release();
90 }

◆ getAnimation()

SkottieAnimation org.skia.jetski.util.SkottieRenderer.getAnimation ( )
inlinepackage

Definition at line 77 of file SkottieView.java.

77 {
78 return mAnimation;
79 }

◆ onRenderFrame()

void org.skia.jetski.util.SkottieRenderer.onRenderFrame ( Canvas  canvas,
long  ms 
)
inlineprotected

Callback for frame content.

Invoked once per (vsync'ed) frame.

Reimplemented from org.skia.jetski.util.SurfaceRenderer.

Definition at line 47 of file SkottieView.java.

47 {
48 if(mPlaying) {
49 canvas.drawColor(mBackground);
50 double t = (double)ms / 1000 % mAnimation.getDuration();
51 mAnimation.seekTime(t);
52
53 float s = Math.min(mSurfaceWidth / mAnimation.getWidth(),
54 mSurfaceHeight / mAnimation.getHeight());
55 canvas.save();
56 canvas.concat(new Matrix().translate((mSurfaceWidth - s*mAnimation.getWidth())/2,
57 (mSurfaceHeight - s*mAnimation.getHeight())/2)
58 .scale(s, s));
59
60 mAnimation.render(canvas);
61 canvas.restore();
62 }
63 }
struct MyStruct s
SK_API sk_sp< PrecompileColorFilter > Matrix()

◆ onSurfaceInitialized()

void org.skia.jetski.util.SkottieRenderer.onSurfaceInitialized ( Surface  surface)
inlineprotected

Initialization callback.

This can be invoked multiple times if the underlying surface changes.

Reimplemented from org.skia.jetski.util.SurfaceRenderer.

Definition at line 40 of file SkottieView.java.

40 {
41 mSurfaceWidth = surface.getWidth();
42 mSurfaceHeight = surface.getHeight();
43 mPlaying = true;
44 }
VkSurfaceKHR surface
Definition: main.cc:49

◆ pause()

void org.skia.jetski.util.SkottieRenderer.pause ( )
inlinepackage

Definition at line 71 of file SkottieView.java.

71 {
72 if (mPlaying) {
73 mPlaying = false;
74 }
75 }

◆ play()

void org.skia.jetski.util.SkottieRenderer.play ( )
inlinepackage

Definition at line 65 of file SkottieView.java.

65 {
66 if (!mPlaying) {
67 mPlaying = true;
68 }
69 }

◆ release()

void org.skia.jetski.util.SkottieRenderer.release ( )
inline

Reimplemented from org.skia.jetski.util.SurfaceRenderer.

Definition at line 82 of file SkottieView.java.

82 {
83 mAnimation.release();
84 super.release();
85 }

The documentation for this class was generated from the following file: