diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/imagedata | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/imagedata')
-rw-r--r-- | files/zh-cn/web/api/imagedata/data/index.html | 95 | ||||
-rw-r--r-- | files/zh-cn/web/api/imagedata/height/index.html | 94 | ||||
-rw-r--r-- | files/zh-cn/web/api/imagedata/imagedata/index.html | 66 | ||||
-rw-r--r-- | files/zh-cn/web/api/imagedata/index.html | 63 | ||||
-rw-r--r-- | files/zh-cn/web/api/imagedata/width/index.html | 94 |
5 files changed, 412 insertions, 0 deletions
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 +--- +<p>{{APIRef("Canvas API")}}</p> + +<p>只读的 <code><strong>ImageData.data</strong></code> 属性,返回 <span style="line-height: 1.5;">{{jsxref("Uint8ClampedArray")}}</span><span style="line-height: 1.5;"> ,描述</span><span style="line-height: 1.5;">一个一维数组,包含以 RGBA 顺序的数据,数据使用 </span><code style="font-style: normal; line-height: 1.5;">0</code><span style="line-height: 1.5;"> 至 </span><code style="font-style: normal; line-height: 1.5;">255</code><span style="line-height: 1.5;">(包含)的整数表示。 </span></p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox"><em>imagedata</em>.data +</pre> + +<h2 id="示例">示例</h2> + +<pre class="brush: js language-js">var imagedata = new ImageData(100, 100); +imagedata.data; // Uint8ClampedArray[40000] +</pre> + +<h2 id="Specification" name="Specification">规范描述</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG', 'scripting.html#dom-imagedata-data', 'ImageData.data')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoDesktop("14")}}</td> + <td>9.0</td> + <td>9.0</td> + <td>3.1</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile("14")}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="参见">参见</h2> + +<ul> + <li>{{domxref("ImageData.height")}}</li> + <li>{{domxref("ImageData.width")}}</li> +</ul> + +<div id="cke_pastebin" style="position: absolute; top: 459.5px; width: 1px; height: 1px; overflow: hidden; left: -1000px;"> </div> 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 +--- +<p>{{APIRef("Canvas API")}}</p> + +<p>只读的 <code><strong>ImageData.height</strong></code> 属性,返回在图像数据对象中的行的数量。</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox"><em>imagedata</em>.height +</pre> + +<h2 id="示例">示例</h2> + +<pre class="brush: js language-js">var imagedata = new ImageData(100, 100); +imagedata.height; // 100 +</pre> + +<h2 id="Specification" name="Specification">规范描述</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG', 'scripting.html#dom-imagedata-height', 'ImageData.height')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoDesktop("14")}}</td> + <td>9.0</td> + <td>9.0</td> + <td>3.1</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile("14")}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="参见">参见</h2> + +<ul> + <li>{{domxref("ImageData.width")}}</li> +</ul> + +<div id="cke_pastebin" style="position: absolute; top: 459.5px; width: 1px; height: 1px; overflow: hidden; left: -1000px;"> </div> 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 +--- +<p>{{APIRef("Canvas API")}}</p> + +<p><code><strong>ImageData()</strong></code> 构造函数返回一个新的实例化的 <code style="font-style: normal; line-height: 1.5;">ImageData</code><span style="line-height: 1.5;"> 对象,</span><span style="line-height: 1.5;"> 此对象由给定的类型化数组和指定的宽度与高度组成。</span></p> + +<p>这个构造器是创建像这种对象首选的方式。</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">new ImageData(<em>array</em>, <em>width</em>, <em>height</em>); +<em>n</em>ew ImageData(<em>width</em>, <em>height</em>); +</pre> + +<h3 id="参数">参数</h3> + +<dl> + <dt><code>array </code></dt> + <dd>包含图像隐藏像素的 {{jsxref("Uint8ClampedArray")}} 数组。如果数组没有给定,指定大小的黑色矩形图像将会被创建。</dd> + <dt><code>width</code></dt> + <dd>无符号长整型(unsigned long)数值,描述图像的宽度。</dd> + <dt><span style="display: none;"> </span><code>height</code></dt> + <dd> 无符号长整型(unsigned long)数值,描述图像的高度。</dd> + <dd>如果已给定数组,这个值是可选的:它将通过它的大小和给定的宽度进行推断。</dd> +</dl> + +<dl> +</dl> + +<h2 id="示例">示例</h2> + +<pre class="brush: js language-js">var imageData = new ImageData(100, 100); // Creates a 100x100 black rectangle +// ImageData { width: 100, height: 100, data: Uint8ClampedArray[40000] } +</pre> + +<h2 id="Specification" name="Specification">规范描述</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG', 'scripting.html#dom-imagedata', 'ImageData()')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p>{{Compat("api.ImageData.ImageData")}}</p> + +<h2 id="参见">参见</h2> + +<ul> + <li>{{domxref("CanvasRenderingContext2D.createImageData()")}}, the creator method that can be used outside workers.</li> +</ul> + +<div id="cke_pastebin" style="position: absolute; top: 459.5px; width: 1px; height: 1px; overflow: hidden; left: -1000px;"></div> 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 +--- +<div>{{APIRef("Canvas API")}}</div> + +<p><code><strong>ImageData</strong></code> 接口描述 {{HTMLElement("canvas")}} 元素的一个隐含像素数据的区域。使用 {{domxref("ImageData.ImageData", "ImageData()")}} 构造函数创建或者使用和 canvas 在一起的 {{domxref("CanvasRenderingContext2D")}} 对象的创建方法: {{domxref("CanvasRenderingContext2D.createImageData", "createImageData()")}} 和 {{domxref("CanvasRenderingContext2D.getImageData", "getImageData()")}}。也可以使用 {{domxref("CanvasRenderingContext2D.putImageData", "putImageData()")}} 设置 canvas 的一部分。</p> + +<h2 id="构造函数" style="margin-bottom: 20px; font-size: 2.14285714285714rem;">构造函数</h2> + +<dl> + <dt>{{domxref("ImageData.ImageData", "ImageData()")}} {{experimental_inline}}</dt> + <dd>三个参数,第一个 是{{jsxref("Uint8ClampedArray")}}的实例,第二个和第三个表示的是width和height,必须保证Uint8ClampedArray的length = 4*width*height才不会报错,如果第一个参数Uint8ClampedArray没有的话,自动按照width和height的大小,以0填充整个像素矩阵。</dd> + <dd>使用给定的{{jsxref("Uint8ClampedArray")}}创建一个 <code>ImageData</code> 对象,并包含图像的大小。如果不给定数组,会创建一个“完全透明”(因为透明度值为0)的黑色矩形图像。注意,这是最常见的方式去创建这样一个对象,在 {{domxref("CanvasRenderingContext2D.createImageData", "createImageData()")}} 不可用时。</dd> +</dl> + +<h2 id="属性" style="margin-bottom: 20px; font-size: 2.14285714285714rem;">属性</h2> + +<dl> + <dt>{{domxref("ImageData.data")}} {{readonlyInline}}</dt> + <dd>{{jsxref("Uint8ClampedArray")}} 描述了一个一维数组,包含以 RGBA 顺序的数据,数据使用 <code style="font-style: normal;">0</code> 至 <code style="font-style: normal;">255</code>(包含)的整数表示。 </dd> + <dt>{{domxref("ImageData.height")}} {{readonlyInline}}</dt> + <dd>无符号长整型(<code>unsigned</code> <code>long</code>),使用像素描述 <strong style="font-family: courier new,andale mono,monospace; font-weight: bold;">ImageData</strong> 的实际高度。</dd> + <dt>{{domxref("ImageData.width")}} {{readonlyInline}}</dt> + <dd>无符号长整型(<code style="font-style: normal;">unsigned</code> <code style="font-style: normal;">long</code>),使用像素描述 <strong style="font-family: courier new,andale mono,monospace;">ImageData</strong> 的实际宽度。</dd> +</dl> + +<h2 id="Specifications" name="Specifications" style="margin-bottom: 20px; font-size: 2.14285714285714rem;">规范描述</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('HTML WHATWG', "canvas.html#imagedata", "ImageData")}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性" style="margin-bottom: 20px; font-size: 2.14285714285714rem;">浏览器兼容性</h2> + +<div>{{CompatibilityTable}}</div> + +<div> + + +<p>{{Compat("api.ImageData")}}</p> +</div> + +<h2 id="参见" style="margin-bottom: 20px; font-size: 2.14285714285714rem;">参见</h2> + +<ul> + <li>{{domxref("CanvasRenderingContext2D")}}</li> + <li>{{HTMLElement("canvas")}} 元素及其相关的接口 {{domxref("HTMLCanvasElement")}}。</li> +</ul> 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 +--- +<p>{{APIRef("Canvas API")}}</p> + +<p>只读的 <code><strong>ImageData.width</strong></code> 属性,返回在图像数据对象中每一行像素的数量。</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox"><em>imagedata</em>.width +</pre> + +<h2 id="示例">示例</h2> + +<pre class="brush: js language-js">var imagedata = new ImageData(100, 100); +imagedata.width // 100 +</pre> + +<h2 id="Specification" name="Specification">规范描述</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG', 'scripting.html#dom-imagedata-width', 'ImageData.width')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoDesktop("14")}}</td> + <td>9.0</td> + <td>9.0</td> + <td>3.1</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile("14")}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="参见">参见</h2> + +<ul> + <li>{{domxref("ImageData.height")}}</li> +</ul> + +<div id="cke_pastebin" style="position: absolute; top: 459.5px; width: 1px; height: 1px; overflow: hidden; left: -1000px;"> </div> |