8package org.skia.jetskidemo;
13import org.
skia.jetski.*;
14import org.skia.jetski.util.*;
17 private Shader mLinearGradient,
44 float[]
pos = {0, 0.5f, 1};
66 osc1 = (
float)(java.lang.Math.cos(ms * kSpeed / 1000)),
67 osc2 = (
float)(java.lang.Math.sin(ms * kSpeed / 1000));
69 drawRect(canvas, (1 + osc1)*cw/2, ch/2, mLinearGradient);
70 drawRect(canvas, (1 - osc1)*cw/2, ch/2, mConicalGradient);
71 drawRect(canvas, cw/2, (1 + osc2)*ch/2, mRadialGradient);
72 drawRect(canvas, cw/2, (1 - osc2)*ch/2, mSweepGradient);
75 private void drawRect(
Canvas canvas,
float cx,
float cy,
Shader shader) {
80 new Paint().setShader(shader).setColorFilter(mColorFilter));
86 System.loadLibrary(
"jetski");
90 protected void onCreate(Bundle savedInstanceState) {
91 super.onCreate(savedInstanceState);
92 setContentView(
R.layout.activity_animation);
94 SurfaceView sv = findViewById(
R.id.surfaceView);
void drawRect(float left, float top, float right, float bottom, Paint paint)
void onCreate(Bundle savedInstanceState)
void onSurfaceInitialized(Surface surface)
void onRenderFrame(Canvas canvas, long ms)
SK_API sk_sp< PrecompileShader > LinearGradient()
SK_API sk_sp< PrecompileShader > RadialGradient()
SK_API sk_sp< PrecompileShader > SweepGradient()
SK_API sk_sp< PrecompileShader > TwoPointConicalGradient()