From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/api/imagedata/data/index.html | 95 ++++++++++++++++++++++ files/zh-cn/web/api/imagedata/height/index.html | 94 +++++++++++++++++++++ files/zh-cn/web/api/imagedata/imagedata/index.html | 66 +++++++++++++++ files/zh-cn/web/api/imagedata/index.html | 63 ++++++++++++++ files/zh-cn/web/api/imagedata/width/index.html | 94 +++++++++++++++++++++ 5 files changed, 412 insertions(+) create mode 100644 files/zh-cn/web/api/imagedata/data/index.html create mode 100644 files/zh-cn/web/api/imagedata/height/index.html create mode 100644 files/zh-cn/web/api/imagedata/imagedata/index.html create mode 100644 files/zh-cn/web/api/imagedata/index.html create mode 100644 files/zh-cn/web/api/imagedata/width/index.html (limited to 'files/zh-cn/web/api/imagedata') diff --git a/files/zh-cn/web/api/imagedata/data/index.html b/files/zh-cn/web/api/imagedata/data/index.html new file mode 100644 index 0000000000..c25770cb3b --- /dev/null +++ b/files/zh-cn/web/api/imagedata/data/index.html @@ -0,0 +1,95 @@ +--- +title: ImageData.data +slug: Web/API/ImageData/data +translation_of: Web/API/ImageData/data +--- +

{{APIRef("Canvas API")}}

+ +

只读的 ImageData.data 属性,返回 {{jsxref("Uint8ClampedArray")}} ,描述一个一维数组,包含以 RGBA 顺序的数据,数据使用  0 至 255(包含)的整数表示。 

+ +

语法

+ +
imagedata.data
+
+ +

示例

+ +
var imagedata = new ImageData(100, 100);
+imagedata.data; // Uint8ClampedArray[40000]
+
+ +

规范描述

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'scripting.html#dom-imagedata-data', 'ImageData.data')}}{{Spec2('HTML WHATWG')}} 
+ +

浏览器兼容性

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatVersionUnknown}}{{CompatGeckoDesktop("14")}}9.09.03.1
+
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatGeckoMobile("14")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +

参见

+ + + +
 
diff --git a/files/zh-cn/web/api/imagedata/height/index.html b/files/zh-cn/web/api/imagedata/height/index.html new file mode 100644 index 0000000000..2daa6a9daf --- /dev/null +++ b/files/zh-cn/web/api/imagedata/height/index.html @@ -0,0 +1,94 @@ +--- +title: ImageData.height +slug: Web/API/ImageData/height +translation_of: Web/API/ImageData/height +--- +

{{APIRef("Canvas API")}}

+ +

只读的 ImageData.height 属性,返回在图像数据对象中的行的数量。

+ +

语法

+ +
imagedata.height
+
+ +

示例

+ +
var imagedata = new ImageData(100, 100);
+imagedata.height; // 100
+
+ +

规范描述

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'scripting.html#dom-imagedata-height', 'ImageData.height')}}{{Spec2('HTML WHATWG')}} 
+ +

浏览器兼容性

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatVersionUnknown}}{{CompatGeckoDesktop("14")}}9.09.03.1
+
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatGeckoMobile("14")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +

参见

+ + + +
 
diff --git a/files/zh-cn/web/api/imagedata/imagedata/index.html b/files/zh-cn/web/api/imagedata/imagedata/index.html new file mode 100644 index 0000000000..fc2b782cd0 --- /dev/null +++ b/files/zh-cn/web/api/imagedata/imagedata/index.html @@ -0,0 +1,66 @@ +--- +title: ImageData() +slug: Web/API/ImageData/ImageData +translation_of: Web/API/ImageData/ImageData +--- +

{{APIRef("Canvas API")}}

+ +

ImageData() 构造函数返回一个新的实例化的 ImageData 对象,  此对象由给定的类型化数组和指定的宽度与高度组成。

+ +

这个构造器是创建像这种对象首选的方式。

+ +

语法

+ +
new ImageData(array, width, height);
+new ImageData(width, height);
+
+ +

参数

+ +
+
array
+
包含图像隐藏像素的 {{jsxref("Uint8ClampedArray")}} 数组。如果数组没有给定,指定大小的黑色矩形图像将会被创建。
+
width
+
无符号长整型(unsigned long)数值,描述图像的宽度。
+
 height
+
      无符号长整型(unsigned long)数值,描述图像的高度。
+
如果已给定数组,这个值是可选的:它将通过它的大小和给定的宽度进行推断。
+
+ +
+
+ +

示例

+ +
var imageData = new ImageData(100, 100); // Creates a 100x100 black rectangle
+// ImageData { width: 100, height: 100, data: Uint8ClampedArray[40000] }
+
+ +

规范描述

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'scripting.html#dom-imagedata', 'ImageData()')}}{{Spec2('HTML WHATWG')}}Initial definition.
+ +

浏览器兼容性

+ +

{{Compat("api.ImageData.ImageData")}}

+ +

参见

+ + + +
diff --git a/files/zh-cn/web/api/imagedata/index.html b/files/zh-cn/web/api/imagedata/index.html new file mode 100644 index 0000000000..ffb6aa3ba8 --- /dev/null +++ b/files/zh-cn/web/api/imagedata/index.html @@ -0,0 +1,63 @@ +--- +title: ImageData +slug: Web/API/ImageData +translation_of: Web/API/ImageData +--- +
{{APIRef("Canvas API")}}
+ +

ImageData 接口描述 {{HTMLElement("canvas")}} 元素的一个隐含像素数据的区域。使用 {{domxref("ImageData.ImageData", "ImageData()")}} 构造函数创建或者使用和 canvas 在一起的 {{domxref("CanvasRenderingContext2D")}} 对象的创建方法: {{domxref("CanvasRenderingContext2D.createImageData", "createImageData()")}} 和 {{domxref("CanvasRenderingContext2D.getImageData", "getImageData()")}}。也可以使用 {{domxref("CanvasRenderingContext2D.putImageData", "putImageData()")}} 设置 canvas 的一部分。

+ +

构造函数

+ +
+
{{domxref("ImageData.ImageData", "ImageData()")}} {{experimental_inline}}
+
三个参数,第一个 是{{jsxref("Uint8ClampedArray")}}的实例,第二个和第三个表示的是width和height,必须保证Uint8ClampedArray的length = 4*width*height才不会报错,如果第一个参数Uint8ClampedArray没有的话,自动按照width和height的大小,以0填充整个像素矩阵。
+
使用给定的{{jsxref("Uint8ClampedArray")}}创建一个 ImageData 对象,并包含图像的大小。如果不给定数组,会创建一个“完全透明”(因为透明度值为0)的黑色矩形图像。注意,这是最常见的方式去创建这样一个对象,在 {{domxref("CanvasRenderingContext2D.createImageData", "createImageData()")}} 不可用时。
+
+ +

属性

+ +
+
{{domxref("ImageData.data")}} {{readonlyInline}}
+
{{jsxref("Uint8ClampedArray")}} 描述了一个一维数组,包含以 RGBA 顺序的数据,数据使用  0 至 255(包含)的整数表示。 
+
{{domxref("ImageData.height")}} {{readonlyInline}}
+
无符号长整型(unsigned long),使用像素描述 ImageData 的实际高度。
+
{{domxref("ImageData.width")}} {{readonlyInline}}
+
无符号长整型(unsigned long),使用像素描述 ImageData 的实际宽度。
+
+ +

规范描述

+ + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', "canvas.html#imagedata", "ImageData")}}{{Spec2('HTML WHATWG')}}
+ +

浏览器兼容性

+ +
{{CompatibilityTable}}
+ +
+ + +

{{Compat("api.ImageData")}}

+
+ +

参见

+ + diff --git a/files/zh-cn/web/api/imagedata/width/index.html b/files/zh-cn/web/api/imagedata/width/index.html new file mode 100644 index 0000000000..1d6476f05f --- /dev/null +++ b/files/zh-cn/web/api/imagedata/width/index.html @@ -0,0 +1,94 @@ +--- +title: ImageData.width +slug: Web/API/ImageData/width +translation_of: Web/API/ImageData/width +--- +

{{APIRef("Canvas API")}}

+ +

只读的 ImageData.width 属性,返回在图像数据对象中每一行像素的数量。

+ +

语法

+ +
imagedata.width
+
+ +

示例

+ +
var imagedata = new ImageData(100, 100);
+imagedata.width // 100
+
+ +

规范描述

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'scripting.html#dom-imagedata-width', 'ImageData.width')}}{{Spec2('HTML WHATWG')}} 
+ +

浏览器兼容性

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatVersionUnknown}}{{CompatGeckoDesktop("14")}}9.09.03.1
+
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatGeckoMobile("14")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +

参见

+ + + +
 
-- cgit v1.2.3-54-g00ecf