Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
org.skia.jetskidemo.samples.RuntimeSample Class Reference
Inheritance diagram for org.skia.jetskidemo.samples.RuntimeSample:
org.skia.jetskidemo.samples.Sample

Public Member Functions

 RuntimeSample (Resources res, int resId)
 
void render (Canvas canvas, long ms, float left, float top, float right, float bottom)
 
void render (Canvas canvas, long t, float left, float top, float right, float bottom)
 

Detailed Description

Definition at line 19 of file RuntimeSample.java.

Constructor & Destructor Documentation

◆ RuntimeSample()

org.skia.jetskidemo.samples.RuntimeSample.RuntimeSample ( Resources  res,
int  resId 
)
inline

Definition at line 22 of file RuntimeSample.java.

22 {
23 String sksl = "";
24 try {
25 InputStream is = res.openRawResource(resId);
26 byte[] data = new byte[is.available()];
27 is.read(data);
28
29 sksl = new String(data);
30 } catch (Exception e) {}
31
32 mShaderBuilder = new RuntimeShaderBuilder(sksl);
33 }
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

Member Function Documentation

◆ render()

void org.skia.jetskidemo.samples.RuntimeSample.render ( Canvas  canvas,
long  t,
float  left,
float  top,
float  right,
float  bottom 
)
inline

Renders a Sample frame t (ms) into the destination rect [L T R B].

Implements org.skia.jetskidemo.samples.Sample.

Definition at line 35 of file RuntimeSample.java.

35 {
36 mShaderBuilder.setUniform("u_time", ms / 1000.0f)
37 .setUniform("u_w", right - left)
38 .setUniform("u_h", bottom - top);
39
40 Paint paint = new Paint().setShader(mShaderBuilder.makeShader());
41
42 canvas.save();
43 canvas.concat(new Matrix().translate(left, top));
44 canvas.drawRect(0, 0, right - left, bottom - top, paint);
45 canvas.restore();
46 }
RuntimeShaderBuilder setUniform(String name, float val)
const Paint & paint
Definition: color_source.cc:38
SK_API sk_sp< PrecompileColorFilter > Matrix()

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