ImageData - Web APIs 编辑
The ImageData
interface represents the underlying pixel data of an area of a <canvas>
element. It is created using the ImageData()
constructor or creator methods on the CanvasRenderingContext2D
object associated with a canvas: createImageData()
and getImageData()
. It can also be used to set a part of the canvas by using putImageData()
.
Note:
This feature is available in Web Workers.Constructors
ImageData()
- Creates an
ImageData
object from a givenUint8ClampedArray
and the size of the image it contains. If no array is given, it creates an image of a transparent black rectangle. Note that this is the most common way to create such an object in workers ascreateImageData()
is not available there.
Properties
ImageData.data
Read only- Is a
Uint8ClampedArray
representing a one-dimensional array containing the data in the RGBA order, with integer values between0
and255
(inclusive). ImageData.height
Read only- Is an
unsigned long
representing the actual height, in pixels, of theImageData
. ImageData.width
Read only- Is an
unsigned long
representing the actual width, in pixels, of theImageData
.
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'ImageData' in that specification. | Living Standard |
Browser compatibility
BCD tables only load in the browser
See also
CanvasRenderingContext2D
- The
<canvas>
element and its associated interface,HTMLCanvasElement
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论