8package org.skia.jetski;
10import androidx.annotation.Nullable;
11import java.io.InputStream;
14 private long mNativeInstance;
22 long nativeImage = nCreate(encodedData);
23 return nativeImage != 0
24 ?
new Image(nativeImage)
33 public static Image fromStream(InputStream encodedStream)
throws java.io.IOException {
34 byte[] encodedData =
new byte[encodedStream.available()];
35 encodedStream.read(encodedData);
41 return nGetWidth(mNativeInstance);
45 return nGetHeight(mNativeInstance);
53 @Nullable
Matrix localMatrix) {
55 return new Shader(nMakeShader(mNativeInstance,
tmx.nativeInt,
tmy.nativeInt,
65 nRelease(mNativeInstance);
76 mNativeInstance = nativeInstance;
82 private static native
long nCreate(
byte[] encodedData);
83 private static native
void nRelease(
long nativeInstance);
85 private static native
int nGetWidth(
long nativeInstance);
86 private static native
int nGetHeight(
long nativeInstance);
88 private static native
long nMakeShader(
long nativeInstance,
int tmx,
int tmy,
int samplingDesc,
89 float samplingCoeffB,
float samplingCoeffC,
Shader makeShader(TileMode tmx, TileMode tmy, SamplingOptions sampling, @Nullable Matrix localMatrix)
static Image fromStream(InputStream encodedStream)
Shader makeShader(TileMode tmx, TileMode tmy, SamplingOptions sampling)
static Image fromEncoded(byte[] encodedData)
Image(long nativeInstance)
SkSamplingOptions sampling