MCPcopy Create free account
hub / github.com/antvis/F2Native / BitmapCanvasContext

Method BitmapCanvasContext

core/android/BitmapCanvasContext.cpp:32–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32BitmapCanvasContext::BitmapCanvasContext(jobject canvasContext, float devicePixelRatio, token::DarkModeManager &manager)
33 : CanvasContext(devicePixelRatio, nullptr), darkModeManager_(manager) {
34 //多线程的情况下不能缓存 因为env和线程相关需要在使用的地方调用GetJniEnvSafe方法中获取
35 env_ = GetJniEnvSafe();
36 canvasContext_ = new ScopedJavaGlobalRef<jobject>(env_, canvasContext);
37 jclass contextCls = env_->GetObjectClass(canvasContext);
38 if(env_->ExceptionCheck()) {return;}
39 lineTo_ = env_->GetMethodID(contextCls, "lineTo", "(FF)V");
40 F2ASSERT(lineTo_, "lineTo_ method is null");
41 if(env_->ExceptionCheck()) {return;}
42 moveTo_ = env_->GetMethodID(contextCls, "moveTo", "(FF)V");
43 F2ASSERT(moveTo_, "moveTo_ method is null");
44 if(env_->ExceptionCheck()) {return;}
45 stroke_ = env_->GetMethodID(contextCls, "stroke", "()V");
46 F2ASSERT(stroke_, "stroke_ method is null");
47 if(env_->ExceptionCheck()) {return;}
48 setStrokeStyle_ = env_->GetMethodID(contextCls, "setStrokeStyle", "(I)V");
49 F2ASSERT(setStrokeStyle_, "setStrokeStyle_ method is null");
50 if(env_->ExceptionCheck()) {return;}
51 fill_ = env_->GetMethodID(contextCls, "fill", "()V");
52 F2ASSERT(fill_, "fill_ method is null");
53 if(env_->ExceptionCheck()) {return;}
54 setFillStyle_ = env_->GetMethodID(contextCls, "setFillStyle", "(I)V");
55 F2ASSERT(setFillStyle_, "setFillStyle_ method is null");
56 if(env_->ExceptionCheck()) {return;}
57 setLineWidth_ = env_->GetMethodID(contextCls, "setLineWidth", "(F)V");
58 F2ASSERT(setLineWidth_, "setLineWidth_ method is null");
59 if(env_->ExceptionCheck()) {return;}
60 setGlobalAlpha_ = env_->GetMethodID(contextCls, "setGlobalAlpha", "(F)V");
61 F2ASSERT(setGlobalAlpha_, "setGlobalAlpha_ method is null");
62 if(env_->ExceptionCheck()) {return;}
63 getGlobalAlpha_ = env_->GetMethodID(contextCls, "getGlobalAlpha", "()F");
64 F2ASSERT(getGlobalAlpha_, "getGlobalAlpha_ method is null");
65 if(env_->ExceptionCheck()) {return;}
66 setFont_ = env_->GetMethodID(contextCls, "setFont", "(IIILjava/lang/String;F)V");
67 F2ASSERT(setFont_, "setFont_ method is null");
68 if(env_->ExceptionCheck()) {return;}
69 fillText_ = env_->GetMethodID(contextCls, "fillText", "(Ljava/lang/String;FF)V");
70 F2ASSERT(fillText_, "fillText_ method is null");
71 if(env_->ExceptionCheck()) {return;}
72 strokeText_ = env_->GetMethodID(contextCls, "strokeText", "(Ljava/lang/String;FF)V");
73 F2ASSERT(strokeText_, "strokeText_ method is null");
74 if(env_->ExceptionCheck()) {return;}
75 getTextAlign_ = env_->GetMethodID(contextCls, "getTextAlign", "()Ljava/lang/String;");
76 F2ASSERT(getTextAlign_, "getTextAlign_ method is null");
77 if(env_->ExceptionCheck()) {return;}
78 setTextAlign_ = env_->GetMethodID(contextCls, "setTextAlign", "(Ljava/lang/String;)V");
79 F2ASSERT(setTextAlign_, "setTextAlign_ method is null");
80 if(env_->ExceptionCheck()) {return;}
81 getTextBaseline_ = env_->GetMethodID(contextCls, "getTextBaseline", "()Ljava/lang/String;");
82 F2ASSERT(getTextBaseline_, "getTextBaseline_ method is null");
83 if(env_->ExceptionCheck()) {return;}
84 setTextBaseline_ = env_->GetMethodID(contextCls, "setTextBaseline", "(Ljava/lang/String;)V");
85 F2ASSERT(setTextBaseline_, "setTextBaseline_ method is null");
86 if(env_->ExceptionCheck()) {return;}
87 strokeRect_ = env_->GetMethodID(contextCls, "strokeRect", "(FFFF)V");
88 F2ASSERT(strokeRect_, "strokeRect_ method is null");
89 if(env_->ExceptionCheck()) {return;}

Callers

nothing calls this directly

Calls 1

GetJniEnvSafeFunction · 0.85

Tested by

no test coverage detected