Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Canvas not rendering on Android 4.2.2

Steps of reproduction:

  • Use 4.2.2. Android system (but not cyanogen mod since the issue is fixed there)
  • Make a webview and serve it a canvas element through a server
  • You get a black screen / it does not render canvas at all

Correct behaviour: You serve it a canvas element and it renders what it is on it. It works on all possible android versions we were able to test except the 4.2.2. .
We confirmed the problems on at least these devices which are at the moment running this version of Android: Moto G, Samsung Galaxy SII, Samsung Galaxy SIII , Samsung Galaxy SIV, HTC One X, HTC One S mini...

I presume the bug is already known but i was not able to find it or more accurately not able to find any way of reproduction. If anyone knows if there is any workaround it would be nice

like image 850
Matjaz Trcek Avatar asked May 20 '26 05:05

Matjaz Trcek


1 Answers

you can try this, it work for me on HTC device:

in html:

<canvas style="background-image:-webkit-canvas(mask);" />

in javascript:

 var ctx = document.getCSSCanvasContext("2d", "mask", 150, 80);
 //now you free to use canvas normally
like image 154
skcks Avatar answered May 21 '26 17:05

skcks