【发布时间】:2012-12-11 18:33:39
【问题描述】:
使用 Javascript 画布元素,是否可以将 RGB 值的二维数组复制到画布上?
<html>
<body>
<canvas id="canvas" height="200" width="200"></canvas>
<script type = "text/javascript">
//copy the following array to the canvas:
var arr1 = [
[[255, 255, 255],[200, 200, 0],[200, 200, 200]],
[[200, 0, 0],[200, 200, 0],[200, 200, 0]],
[[200, 200, 0],[200, 0, 0],[200, 200, 0]]
]
<script>
</body>
</html>
【问题讨论】:
-
我找到了一个相关的例子:jsfiddle.net/Z6CHB/1 现在我只需要修改它,让它将一个数组复制到画布上。
-
与此相反的是从画布中获取像素:stackoverflow.com/questions/6727090/…
标签: javascript canvas