首頁 >web前端 >js教程 >javascript根據像素點取位置範例_javascript技巧

javascript根據像素點取位置範例_javascript技巧

WBOY
WBOY原創
2016-05-16 17:02:051226瀏覽

複製程式碼程式碼如下:


  >

        <script><br>        <BR>                this.x = x;<BR>             🎜><BR>            var canvas = document.getElementById('canvas'),<BR>     2d');<br>               width = canvas.width,<br>             ctx.fillStyle = "#FF0000";<BR>            ctx.字體=「20px 宋體.fillText("媽媽",10,50);<BR><BR>            var pixs = ctx.getImageData(0,0,width,height).data< );<BR> <BR>            for(var i=0;i<pixs.length;i = 4)<BR>        = pixs[i],<br>                    g = 像素[i 1],<br>   = pixs[i 2],<BR>                   a = pixs[i 3];<br>< 0 || b != 0 ){<br>                   var x = i@0;<BR>                   var y = i/400;<BR>       🎜>                }<BR>            )<BR>    <BR></script>
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn