小程序畫布獲取OffscreenCanvas的繪圖上下文OffscreenCanvas.getContext
RenderingContext OffscreenCanvas.getContext(string contextType)
該方法返回 OffscreenCanvas 的繪圖上下文
基礎(chǔ)庫 2.7.0 開始支持,低版本需做兼容處理。
小程序插件:支持,需要小程序基礎(chǔ)庫版本不低于 2.16.1
參數(shù)
string contextType
繪圖上下文類型,需要與 createOffscreenCanvas 時傳入的 type 一致
contextType 的合法值
值 說明 最低版本
webgl webgl類型上下文
2d 2d類型上下文 2.16.1
返回值
RenderingContext
注意不允許混用 webgl 和 2d 繪圖上下文,傳入的 contextType 必須要與 wx.createOffscreenCanvas 傳入的 type 類型一致。
作者:大學生新聞網(wǎng) 來源:大學生新聞網(wǎng)
- 小程序畫布Path2D
- Canvas 2D API 的接口 Path2D 用來聲明路徑,此路徑稍后會被CanvasRenderingContext2D 對象使用。
- 04-18 關(guān)注:0
- 小程序畫布ImageData 對象
- 一維數(shù)組,包含以 RGBA 順序的數(shù)據(jù),數(shù)據(jù)使用 0 至 255(包含)的整數(shù)表示
- 04-17 關(guān)注:3
- 小程序畫布顏色Color
- 顏色?梢杂靡韵聨追N方式來表示 canvas 中使用的顏色:
- 04-17 關(guān)注:3