21jlong Image_Create(JNIEnv*
env, jobject, jbyteArray jdata) {
22 auto size =
env->GetArrayLength(jdata);
23 auto*
data =
env->GetByteArrayElements(jdata,
nullptr);
26 env->ReleaseByteArrayElements(jdata,
data, 0);
31void Image_Release(JNIEnv*, jobject, jlong native_instance) {
35jint Image_GetWidth(JNIEnv*, jobject, jlong native_instance) {
36 const auto*
image =
reinterpret_cast<const SkImage*
>(native_instance);
40jint Image_GetHeight(JNIEnv*, jobject, jlong native_instance) {
41 const auto*
image =
reinterpret_cast<const SkImage*
>(native_instance);
45jlong Image_MakeShader(JNIEnv*, jobject, jlong native_instance, jint jtmx, jint jtmy,
46 jint sampling_desc, jfloat sampling_b, jfloat sampling_c,
47 jlong native_matrix) {
50 if (
const auto*
image =
reinterpret_cast<const SkImage*
>(native_instance)) {
54 sampling_b, sampling_c);
56 const auto* lm =
reinterpret_cast<const SkM44*
>(native_matrix);
62 return reinterpret_cast<jlong
>(shader.
release());
68 static const JNINativeMethod methods[] = {
69 {
"nCreate" ,
"([B)J" ,
reinterpret_cast<void*
>(Image_Create) },
70 {
"nRelease" ,
"(J)V" ,
reinterpret_cast<void*
>(Image_Release) },
72 {
"nGetWidth" ,
"(J)I" ,
reinterpret_cast<void*
>(Image_GetWidth) },
73 {
"nGetHeight" ,
"(J)I" ,
reinterpret_cast<void*
>(Image_GetHeight)},
75 {
"nMakeShader",
"(JIIIFFJ)J" ,
reinterpret_cast<void*
>(Image_MakeShader)},
78 const auto clazz =
env->FindClass(
"org/skia/jetski/Image");
80 ?
env->RegisterNatives(clazz, methods,
std::size(methods))
static void SkSafeUnref(T *obj)
constexpr size_t SkToSizeT(S x)
static sk_sp< SkData > MakeWithCopy(const void *data, size_t length)
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
int register_jetski_Image(JNIEnv *env)
SK_API sk_sp< SkImage > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)
sk_sp< const SkImage > image
SkSamplingOptions sampling
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
SkTileMode TileMode(jint tm)
SkSamplingOptions SamplingOptions(jint desc, jfloat coeffB, jfloat coeffC)
std::shared_ptr< const fml::Mapping > data