36 {
37 super.onCreate(savedInstanceState);
38 setContentView(
R.layout.activity_main);
39
41 p.setColor(
new Color(0, 1, 0, 1));
42
43
44
45
46
47
48 Bitmap.Config conf = Bitmap.Config.ARGB_8888;
49 Bitmap bmp = Bitmap.createBitmap(400, 400, conf);
51 Canvas canvas = bitmapSurface.
getCanvas();
52
54
55 float[]
m = {1, 0, 0, 100,
56 0, 1, 0, 100,
57 0, 0, 1, 0,
58 0, 0, 0, 1};
59 p.setColor(
new Color(0, 0, 1, 1));
60 canvas.save();
61 canvas.concat(m);
62 canvas.drawRect(0, 0, 100, 100, p);
63 canvas.restore();
64
66 canvas.drawImage(snapshot, 0, 200);
67
68 try {
69 Image image =
Image.fromStream(getResources().openRawResource(
R.raw.brickwork_texture));
70
71 canvas.concat(
new Matrix().
scale(10, 10));
73 } catch (Exception e) {
74 Log.e(
"JetSki Demo",
"Could not load Image resource: " +
R.raw.brickwork_texture);
75 }
76 bitmapImage = findViewById(
R.id.bitmapImage);
77 bitmapImage.setImageBitmap(bmp);
78
79
80
81
82
83 SurfaceView surfaceView = findViewById(
R.id.threadedSurface);
84 surfaceView.getHolder().addCallback(new ThreadedSurfaceHandler());
85
86
87
88
89
90 SurfaceView runtimeEffectView = findViewById(
R.id.runtimeEffect);
91 runtimeEffectView.getHolder().addCallback(new DemoRuntimeShaderRenderer());
92
93
94
95
96 SkottieView skottieView =
new SkottieView(
this,
R.raw.im_thirsty,
new Color(1, 1, 1, 1));
97 skottieView.setLayoutParams(new ViewGroup.LayoutParams(400, 400));
98 skottieView.setOnClickListener((View v) -> {
99 SkottieView
s = (SkottieView)v;
101 });
102 LinearLayout skottieContainer = findViewById(
R.id.skottie_container);
103 skottieContainer.addView(skottieView);
104 }
void drawRect(const SkRect &rect, const SkPaint &paint)
virtual SkCanvas * getCanvas()=0
sk_sp< SkImage > makeImageSnapshot() const
void Log(const char *format,...) SK_PRINTF_LIKE(1
SkSamplingOptions SamplingOptions(jint desc, jfloat coeffB, jfloat coeffC)