diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:17 -0500 |
commit | da78a9e329e272dedb2400b79a3bdeebff387d47 (patch) | |
tree | e6ef8aa7c43556f55ddfe031a01cf0a8fa271bfe /files/ko/web/api/offscreencanvas | |
parent | 1109132f09d75da9a28b649c7677bb6ce07c40c0 (diff) | |
download | translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.tar.gz translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.tar.bz2 translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.zip |
initial commit
Diffstat (limited to 'files/ko/web/api/offscreencanvas')
-rw-r--r-- | files/ko/web/api/offscreencanvas/getcontext/index.html | 117 | ||||
-rw-r--r-- | files/ko/web/api/offscreencanvas/height/index.html | 63 | ||||
-rw-r--r-- | files/ko/web/api/offscreencanvas/index.html | 153 | ||||
-rw-r--r-- | files/ko/web/api/offscreencanvas/offscreencanvas/index.html | 74 | ||||
-rw-r--r-- | files/ko/web/api/offscreencanvas/toblob/index.html | 77 | ||||
-rw-r--r-- | files/ko/web/api/offscreencanvas/width/index.html | 63 |
6 files changed, 547 insertions, 0 deletions
diff --git a/files/ko/web/api/offscreencanvas/getcontext/index.html b/files/ko/web/api/offscreencanvas/getcontext/index.html new file mode 100644 index 0000000000..de0015ac61 --- /dev/null +++ b/files/ko/web/api/offscreencanvas/getcontext/index.html @@ -0,0 +1,117 @@ +--- +title: OffscreenCanvas.getContext() +slug: Web/API/OffscreenCanvas/getContext +translation_of: Web/API/OffscreenCanvas/getContext +--- +<div>{{APIRef("Canvas API")}} {{SeeCompatTable}}</div> + +<p><strong><code>OffscreenCanvas.getContext()</code></strong> 메소드는 offscreen 캔버스를 위한 드로잉 컨텍스트 반환합니다. 컨텍스트 식별자가 지원되는 상황이 아닐 경우 {{jsxref("null")}}를 반환합니다.</p> + +<div class="note"> +<p><strong>Note</strong>: 이 API는 현재 <a href="/en-US/docs/Web/API/WebGLRenderingContext">WebGL1</a>과 <a href="/en-US/docs/Web/API/WebGL2RenderingContext">WebGL2</a> 컨텍스트에서만 실행됩니다. <a href="/en-US/docs/Web/API/Canvas_API">Canvas 2D API</a> 관련 {{bug(801176)}}를 참조하세요.</p> +</div> + +<h2 id="구문">구문</h2> + +<pre class="syntaxbox"><em>offscreen</em>.getContext(<em>contextType</em>, <em>contextAttributes</em>); +</pre> + +<h3 id="매개_변수">매개 변수</h3> + +<dl> + <dt><code>contextType</code></dt> + <dd>캔버스의 드로잉 컨텍스트를 정의하는 컨텍스트 식별자가 포함된 {{domxref("DOMString")}}입니다: + <ul> + <li><strong><code>"2d"</code></strong>는 2차원 렌더링 컨텍스트를 표현하는 {{domxref("CanvasRenderingContext2D")}} 객체를 생성합니다.</li> + <li><strong><code>"webgl"</code></strong>는 3차원 렌더링 컨텍스트를 표현하는 {{domxref("WebGLRenderingContext")}} 객체를 생성합니다. 이 컨텍스트는 <a href="https://developer.mozilla.org/en-US/docs/Web/WebGL">WebGL</a> 버전 1(OpenGL ES 2.0)을 지원하는 브라우저에서만 사용 가능합니다.</li> + <li><strong><code>"webgl2"</code></strong>는 3차원 렌더링 컨텍스트를 표현하는 {{domxref("WebGL2RenderingContext")}} 객체를 생성합니다. 이 컨텍스트는 <a href="https://developer.mozilla.org/en-US/docs/Web/WebGL">WebGL</a> 버전 2 (OpenGL ES 3.0)를 지원하는 브라우저에서만 사용 가능합니다. {{experimental_inline}}</li> + <li> + <p><strong><code>"bitmaprenderer"</code></strong>는 주어진 {{domxref("ImageBitmap")}}을 캔버스의 내용 대신 전환하는 함수를 제공하는 {{domxref("ImageBitmapRenderingContext")}}를 생성합니다. </p> + </li> + </ul> + + <p>Note:<strong><code>"experimental-webgl"</code></strong>과 <strong><code>"experimental-webgl2"</code></strong> 식별자는 WebGL에서도 사용됩니다. 그러나 아직 테스트 적합성을 통과하지 못했거나 플랫폼별 그래픽 드라이버 지원이 안정적이진 않습니다. <a href="https://www.khronos.org/">Khronos Group</a>은 특정한 <a href="https://www.khronos.org/registry/webgl/sdk/tests/CONFORMANCE_RULES.txt">정합성 규칙</a>에 WebGL 구현을 인증하고 있습니다.</p> + </dd> + <dt><code>contextAttributes</code></dt> + <dd> + <p>You can use several context attributes when creating your rendering context, for example:</p> + + <pre class="brush: js">offscreen.getContext("webgl", + { antialias: false, + depth: false });</pre> + 2d context attributes: + + <ul> + <li><strong><code>alpha</code></strong>: Boolean that indicates if the canvas contains an alpha channel. If set to <code>false</code>, the browser now knows that the backdrop is always opaque, which can speed up drawing of transparent content and images then.</li> + <li>{{non-standard_inline}} (Gecko only) <strong><code>willReadFrequently</code></strong>: Boolean that indicates whether or not a lot of read-back operations are planned. This will force the use of a software (instead of hardware accelerated) 2D canvas and can save memory when calling {{domxref("CanvasRenderingContext2D.getImageData", "getImageData()")}} frequently. This option is only available, if the flag <code>gfx.canvas.willReadFrequently.enable</code> is set to <code>true</code> (which, by default, is only the case for B2G/Firefox OS).</li> + <li>{{non-standard_inline}} (Blink only) <strong><code>storage</code></strong>: String that indicates which storage is used ("persistent" by default).</li> + </ul> + WebGL context attributes: + + <ul> + <li><strong><code>alpha</code></strong>: Boolean that indicates if the canvas contains an alpha buffer.</li> + <li><strong><code>depth</code></strong>: Boolean that indicates that the drawing buffer has a depth buffer of at least 16 bits.</li> + <li><strong><code>stencil</code></strong>: Boolean that indicates that the drawing buffer has a stencil buffer of at least 8 bits.</li> + <li><strong><code>antialias</code></strong>: Boolean that indicates whether or not to perform anti-aliasing.</li> + <li><strong><code>premultipliedAlpha</code></strong>: Boolean that indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha.</li> + <li><strong><code>preserveDrawingBuffer</code></strong>: If the value is true the buffers will not be cleared and will preserve their values until cleared or overwritten by the author.</li> + <li> + <p><code><strong>failIfMajorPerformanceCaveat</strong></code>: Boolean that indicates if a context will be created if the system performance is low.</p> + </li> + </ul> + </dd> +</dl> + +<h3 id="Return_value">Return value</h3> + +<p>A {{domxref("RenderingContext")}} which is either a</p> + +<ul> + <li>{{domxref("CanvasRenderingContext2D")}} for <code>"2d"</code>,</li> + <li>{{domxref("WebGLRenderingContext")}} for <code>"webgl"</code> and <code>"experimental-webgl"</code>,</li> + <li>{{domxref("WebGL2RenderingContext")}} for <code>"webgl2"</code> and <code>"experimental-webgl2"</code> {{experimental_inline}}, or</li> + <li>{{domxref("ImageBitmapRenderingContext")}} for <code>"bitmaprenderer"</code>.</li> +</ul> + +<p>If the <code>contextType</code> doesn't match a possible drawing context, <code>null</code> is returned.</p> + +<h2 id="Examples">Examples</h2> + +<pre class="brush: js">var offscreen = new OffscreenCanvas(256, 256); +var gl = offscreen.getContext("webgl"); + +gl; // WebGLRenderingContext +gl.canvas; // OffscreenCanvas</pre> + +<h2 id="Specifications">Specifications</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', "#dom-offscreencanvas-getcontext", "OffscreenCanvas.getContext()")}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<div> + + +<p>{{Compat("api.OffscreenCanvas.getContext")}}</p> +</div> + +<h2 id="See_also">See also</h2> + +<ul> + <li>The interface defining this method: {{domxref("OffscreenCanvas")}}</li> + <li>{{domxref("HTMLCanvasElement.getContext()")}}</li> + <li>Available rendering contexts: {{domxref("CanvasRenderingContext2D")}}, {{domxref("WebGLRenderingContext")}}, {{domxref("WebGL2RenderingContext")}}, and {{domxref("ImageBitmapRenderingContext")}}</li> +</ul> diff --git a/files/ko/web/api/offscreencanvas/height/index.html b/files/ko/web/api/offscreencanvas/height/index.html new file mode 100644 index 0000000000..9cf16b703f --- /dev/null +++ b/files/ko/web/api/offscreencanvas/height/index.html @@ -0,0 +1,63 @@ +--- +title: OffscreenCanvas.height +slug: Web/API/OffscreenCanvas/height +tags: + - API + - Canvas + - Experimental + - OffscreenCanvas + - Property + - Reference +translation_of: Web/API/OffscreenCanvas/height +--- +<div>{{APIRef("Canvas API")}} {{SeeCompatTable}}</div> + +<p><code><strong>height</strong></code> 프로퍼티는 {{domxref("OffscreenCanvas")}} 객체에 할당된 높이를 반환합니다.</p> + +<h2 id="구문">구문</h2> + +<pre class="syntaxbox"><var>var <em>pxl</em> = <em>offscreen</em></var>.height; +<em>offscreen</em>.height = <em>pxl</em>;</pre> + +<dl> +</dl> + +<h2 id="예시">예시</h2> + +<p>새로운 offscreen 캔버스를 생성하고 높이를 설정하거나 반환합니다.</p> + +<pre class="brush: js">var offscreen = new OffscreenCanvas(256, 256); +offscreen.height; // 256 +offscreen.height = 512; +</pre> + +<h2 id="상세">상세</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', "#dom-offscreencanvas-height", "OffscreenCanvas.height")}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="브라우저_호환성">브라우저 호환성</h2> + +<div> + + +<p>{{Compat("api.OffscreenCanvas.height")}}</p> +</div> + +<h2 id="더_보기">더 보기</h2> + +<ul> + <li>{{domxref("OffscreenCanvas")}}, 프로퍼티가 속한 인터페이스</li> +</ul> diff --git a/files/ko/web/api/offscreencanvas/index.html b/files/ko/web/api/offscreencanvas/index.html new file mode 100644 index 0000000000..4e90bbf294 --- /dev/null +++ b/files/ko/web/api/offscreencanvas/index.html @@ -0,0 +1,153 @@ +--- +title: OffscreenCanvas +slug: Web/API/OffscreenCanvas +tags: + - API + - Canvas + - Experimental + - Interface + - Reference +translation_of: Web/API/OffscreenCanvas +--- +<div>{{APIRef("Canvas API")}} {{SeeCompatTable}}</div> + +<p><strong><code>OffscreenCanvas</code></strong>는 화면 밖에서 렌더링되는 캔버스 인터페이스입니다. window 객체와 <a href="/en-US/docs/Web/API/Web_Workers_API">worker</a> 객체 모두 지원합니다.</p> + +<h2 id="생성자">생성자</h2> + +<dl> + <dt>{{domxref("OffscreenCanvas.OffscreenCanvas", "OffscreenCanvas()")}}</dt> + <dd><code>OffscreenCanvas</code> 생성자. 새 <code>OffscreenCanvas</code> 객체를 생성합니다.</dd> +</dl> + +<h2 id="프로퍼티">프로퍼티</h2> + +<dl> + <dt>{{domxref("OffscreenCanvas.height")}}</dt> + <dd>캔버스의 높이</dd> + <dt>{{domxref("OffscreenCanvas.width")}}</dt> + <dd>캔버스의 너비</dd> +</dl> + +<h2 id="메소드">메소드</h2> + +<dl> + <dt>{{domxref("OffscreenCanvas.getContext()")}}</dt> + <dd>렌더링된 캔버스 컨텍스트 객체를 반환합니다.</dd> +</dl> + +<dl> + <dt>{{domxref("OffscreenCanvas.convertToBlob()")}}</dt> + <dd>캔버스에 들어있는 이미지에 대한 {{domxref("Blob")}} 객체를 생성합니다.</dd> +</dl> + +<dl> + <dt>{{domxref("OffscreenCanvas.transferToImageBitmap()")}}</dt> + <dd>OffscreenCanvas에 렌더링된 이미지중에서 가장 최근에 렌더링된 이미지를 {{domxref("ImageBitmap")}} 객체로 생성합니다.</dd> +</dl> + +<h2 id="예시">예시</h2> + +<h3 id="OffscreenCanvas_에서_만들어진_프레임을_동기적으로_화면에_보여주는_방법"><code>OffscreenCanvas</code> 에서 만들어진 프레임을 동기적으로 화면에 보여주는 방법</h3> + +<p><code>OffscreenCanvas</code> API를 사용하는 방법은 <code>OffscreenCanvas</code>에 속한 {{domxref("RenderingContext")}}를 이용해 새로운 프레임 객체를 생성하는 것입니다. 새 프레임이 컨텍스트에 렌더링이 되고나면, 가장 최근에 렌더링 된 이미지를 저장하는 {{domxref("OffscreenCanvas.transferToImageBitmap", "transferToImageBitmap()")}} 메소드를 호출할 수 있습니다. 이 메소드는 다른 수 많은 Web API에서 사용되고 있는 {{domxref("ImageBitmap")}} 객체를 리턴합니다.</p> + +<p><code>ImageBitmap</code>을 화면에 표시하려면, 현재 (화면에 보여지고 있는) 캔버스 요소의 <code>canvas.getContext("bitmaprenderer")</code> 메소드를 호출했을 때 생성되는 {{domxref("ImageBitmapRenderingContext")}} 객체를 사용하면 됩니다. 이 컨텍스트는 캔버스의 내용을 주어진 <code>ImageBitmap</code>으로 전환하는 기능을 제공합니다. OffscreenCanvas에서 이전에 렌더링이 되어서 등록된 <code>ImageBitmap</code>을 이용한 {{domxref("ImageBitmapRenderingContext.transferFromImageBitmap()")}}을 호출하면 <code>ImageBitmap</code>이 캔버스에 표시되고 소유권 역시 캔버스로 넘어갑니다. 단일 <code>OffscreenCanvas</code>는 프레임들을 임의의 다른 <code>ImageBitmapRenderingContext</code> 객체로 전달합니다.</p> + +<p>아래에 두 개의 {{HTMLElement("canvas")}} 요소가 있습니다.</p> + +<pre class="brush: html"><canvas id="one"></canvas> +<canvas id="two"></canvas></pre> + +<p>다음의 코드는 위에서 설명한 것처럼 <code>OffscreenCanvas</code>를 이용해 렌더링합니다.</p> + +<pre class="brush: js">var one = document.getElementById("one").getContext("bitmaprenderer"); +var two = document.getElementById("two").getContext("bitmaprenderer"); + +var offscreen = new OffscreenCanvas(256, 256); +var gl = offscreen.getContext('webgl'); + +// ... gl 컨텍스트를 이용해 첫 번째 캔버스에 무언가를 그립니다 ... + +// 첫 번째 캔버스에 렌더링을 수행합니다. +var bitmapOne = offscreen.transferToImageBitmap(); +one.transferFromImageBitmap(bitmapOne); + +// ... gl 컨텍스트를 이용해 두 번째 캔버스에 무언가를 그립니다 ... + +// 두 번째 캔버스에 렌더링을 수행합니다. +var bitmapTwo = offscreen.transferToImageBitmap(); +two.transferFromImageBitmap(bitmapTwo); +</pre> + +<h3 id="OffscreenCanvas_에서_만들어진_프레임을_비동기적으로_화면에_보여주는_방법"><code>OffscreenCanvas</code> 에서 만들어진 프레임을 비동기적으로 화면에 보여주는 방법</h3> + +<p><code>OffscreenCanvas</code> API를 이용하는 또 다른 방법은 <a href="/en-US/docs/Web/API/Web_Workers_API">worker</a> 또는 메인 스레드위에서 {{HTMLElement("canvas")}} 요소의 {{domxref("HTMLCanvasElement.transferControlToOffscreen", "transferControlToOffscreen()")}}를 호출하는 것입니다. 여기서 메인 스레드는 <code>OffscreenCanvas</code> 객체를 반환하는 {{domxref("HTMLCanvasElement")}} 객체를 가지고 있습니다. {{domxref("OffscreenCanvas.getContext", "getContext()")}}를 호출하면 <code>OffscreenCanvas</code>에서 <code>RenderingContext</code>를 얻을 수 있습니다.</p> + +<p>main.js (메인 스레드 코드):</p> + +<pre class="brush: js">var htmlCanvas = document.getElementById("canvas"); +var offscreen = htmlCanvas.transferControlToOffscreen(); + +var worker = new Worker("offscreencanvas.js"); +worker.postMessage({canvas: offscreen}, [offscreen]); +</pre> + +<p>offscreencanvas.js (worker 코드):</p> + +<pre class="brush: js">onmessage = function(evt) { + var canvas = evt.data.canvas; + var gl = canvas.getContext("webgl"); + + // ... gl 컨텍스트를 이용해 무언가를 그립니다 ... +}; +</pre> + +<p>worker 내에서 requestAnimationFrame 또한 사용할 수 있습니다.</p> + +<pre class="brush: js">onmessage = function(evt) { + const canvas = evt.data.canvas; + const gl = canvas.getContext("webgl"); + + function render(time) { + // ... gl 컨텍스트를 이용해 무언가를 그립니다 ... + requestAnimationFrame(render); + } + requestAnimationFrame(render); +};</pre> + +<h2 id="상세">상세</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#the-offscreencanvas-interface", "OffscreenCanvas")}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="브라우저_호환성">브라우저 호환성</h2> + +<div> + + +<p>{{Compat("api.OffscreenCanvas")}}</p> +</div> + +<h2 id="더_보기">더 보기</h2> + +<ul> + <li><a href="https://hacks.mozilla.org/2016/01/webgl-off-the-main-thread/">WebGL Off the Main Thread – Mozilla Hacks</a></li> + <li>{{domxref("CanvasRenderingContext2D")}}</li> + <li>{{domxref("ImageBitmap")}}</li> + <li>{{domxref("ImageBitmapRenderingContext")}}</li> + <li>{{domxref("HTMLCanvasElement.transferControlToOffscreen()")}}</li> + <li>{{domxref("WebGLRenderingContext.commit()")}}</li> +</ul> diff --git a/files/ko/web/api/offscreencanvas/offscreencanvas/index.html b/files/ko/web/api/offscreencanvas/offscreencanvas/index.html new file mode 100644 index 0000000000..89c6f42062 --- /dev/null +++ b/files/ko/web/api/offscreencanvas/offscreencanvas/index.html @@ -0,0 +1,74 @@ +--- +title: OffscreenCanvas() +slug: Web/API/OffscreenCanvas/OffscreenCanvas +tags: + - API + - Canvas + - Constructor + - Experimental + - OffscreenCanvas + - Reference + - WebGL +translation_of: Web/API/OffscreenCanvas/OffscreenCanvas +--- +<div>{{APIRef("Canvas API")}} {{SeeCompatTable}}</div> + +<p><code><strong>OffscreenCanvas()</strong></code> 생성자는 새롭게 초기화된 {{domxref("OffscreenCanvas")}} 객체를 반환합니다.</p> + +<p> </p> + +<h2 id="구문">구문</h2> + +<pre class="syntaxbox">new OffscreenCanvas(<em>width</em>, <em>height</em>); +</pre> + +<h3 id="매개_변수">매개 변수</h3> + +<dl> + <dt><code>width</code></dt> + <dd>offscreen 캔버스의 너비</dd> + <dt><code>height</code></dt> + <dd>offscreen 캔버스의 높이</dd> +</dl> + +<dl> +</dl> + +<h2 id="예시">예시</h2> + +<p>이 예시는 <code>OffscreenCanvas()</code> 생성자를 이용해 새로운 offscreen 캔버스를 생성하고, <a href="/en-US/docs/Web/API/WebGL_API">WebGL</a> 컨텍스트의 {{domxref("OffscreenCanvas.getContext()", "getContext()")}} 메소드를 사용해 초기화합니다.</p> + +<pre class="brush: js">let offscreen = new OffscreenCanvas(256, 256); +let gl = offscreen.getContext('webgl'); +</pre> + +<h2 id="상세">상세</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', "#dom-offscreencanvas", "OffscreenCanvas()")}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="브라우저_호환성">브라우저 호환성</h2> + +<div> + + +<p>{{Compat("api.OffscreenCanvas.OffscreenCanvas")}}</p> +</div> + +<h2 id="더_보기">더 보기</h2> + +<ul> + <li>{{domxref("OffscreenCanvas")}}, 생성자가 속한 인터페이스</li> +</ul> diff --git a/files/ko/web/api/offscreencanvas/toblob/index.html b/files/ko/web/api/offscreencanvas/toblob/index.html new file mode 100644 index 0000000000..e57eeecfbb --- /dev/null +++ b/files/ko/web/api/offscreencanvas/toblob/index.html @@ -0,0 +1,77 @@ +--- +title: OffscreenCanvas.convertToBlob() +slug: Web/API/OffscreenCanvas/toBlob +tags: + - API + - Canvas + - Experimental + - Method + - OffscreenCanvas + - Reference +translation_of: Web/API/OffscreenCanvas/toBlob +--- +<div>{{APIRef("Canvas API")}} {{SeeCompatTable}}</div> + +<p><strong><code>OffscreenCanvas.convertToBlob()</code></strong> 메소드는 캔버스에 포함된 이미지를 표현하는 {{domxref("Blob")}} 객체를 생성합니다.</p> + +<h2 id="구문">구문</h2> + +<pre class="syntaxbox">Promise<Blob> OffscreenCanvas.convertToBlob(<var>options</var>);</pre> + +<h3 id="매개_변수">매개 변수</h3> + +<dl> + <dt><code>options</code> {{optional_inline}}</dt> + <dd> + <p>객체를 {{domxref("Blob")}} 객체로 전환할 때 다양한 옵션을 줄 수 있습니다.</p> + + <pre class="brush: js">const blob = offscreenCanvas.convertToBlob({ + type: "image/jpeg", + quality: 0.95 +});</pre> + + <p>options:</p> + + <ul> + <li><strong><code>type</code></strong>: 이미지 포맷을 가리키는 {{domxref("DOMString")}}. 상세 타입은 <code>image/png</code></li> + <li><code><strong>quality</strong></code>: <code>type</code> 옵션이 <code>image/jpeg</code> 혹은 <code>image/webp</code> 일 때 이미지의 품질을 가리키는 <code>0</code>과 <code>1</code>사이의 {{jsxref("Number")}}. 이 매개 변수가 다른 값이라면, 이미지 품질의 기본 설정값이 적용됩니다. 다른 매개 변수들은 무시됩니다.</li> + </ul> + </dd> +</dl> + +<h3 id="반환_값">반환 값</h3> + +<p>캔버스에 포함된 이미지를 표현하는 {{domxref("Blob")}} 객체를 반환하는 {{jsxref("Promise")}}</p> + +<h2 id="예시">예시</h2> + +<pre class="brush: js">var offscreen = new OffscreenCanvas(256, 256); +var gl = offscreen.getContext("webgl"); + +// ... gl 컨텍스트를 이용해 무언가를 그립니다 ... + +offscreen.convertToBlob().then(function(blob) { + console.log(blob); +}); + +// Blob { size: 334, type: "image/png" }</pre> + +<h2 id="상세">상세</h2> + +<p>현재 작성되고 있는 중입니다: <a href="https://wiki.whatwg.org/wiki/OffscreenCanvas">OffscreenCanvas</a>.</p> + +<h2 id="브라우저_호환성">브라우저 호환성</h2> + +<div> + + +<p>{{Compat("api.OffscreenCanvas.convertToBlob")}}</p> +</div> + +<p> </p> + +<h2 id="더_보기">더 보기</h2> + +<ul> + <li>이 메소드를 정의하는 인터페이스, {{domxref("OffscreenCanvas")}}.</li> +</ul> diff --git a/files/ko/web/api/offscreencanvas/width/index.html b/files/ko/web/api/offscreencanvas/width/index.html new file mode 100644 index 0000000000..e7d7440d28 --- /dev/null +++ b/files/ko/web/api/offscreencanvas/width/index.html @@ -0,0 +1,63 @@ +--- +title: OffscreenCanvas.width +slug: Web/API/OffscreenCanvas/width +tags: + - API + - Canvas + - Experimental + - OffscreenCanvas + - Property + - Reference +translation_of: Web/API/OffscreenCanvas/width +--- +<div>{{APIRef("Canvas API")}} {{SeeCompatTable}}</div> + +<p><code><strong>width</strong></code><strong> </strong><span style="font-size: 1rem; letter-spacing: -0.00278rem;">프로퍼티는 {{domxref("OffscreenCanvas")}} 객체에 할당된 너비를 반환합니다.</span></p> + +<h2 id="구문">구문</h2> + +<pre class="syntaxbox"><var>var <em>pxl</em> = <em>offscreen</em></var>.width; +<em>offscreen</em>.width = <em>pxl</em>;</pre> + +<dl> +</dl> + +<h2 id="예시">예시</h2> + +<p>새로운 offscreen 캔버스를 생성하고 높이를 설정하거나 반환합니다.</p> + +<pre class="brush: js">var offscreen = new OffscreenCanvas(256, 256); +offscreen.width; // 256 +offscreen.width = 512; +</pre> + +<h2 id="상세">상세</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', "#dom-offscreencanvas-width", "OffscreenCanvas.width")}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="브라우저_호환성">브라우저 호환성</h2> + +<div> + + +<p>{{Compat("api.OffscreenCanvas.width")}}</p> +</div> + +<h2 id="더_보기">더 보기</h2> + +<ul> + <li>{{domxref("OffscreenCanvas")}}, 프로퍼티가 속한 인터페이스</li> +</ul> |