#en
4.7.11.1.10. Images
#ja
4.7.11.1.10. 画像
#en
To draw images onto the canvas, the drawImage method can be
used.
#ja
メソッド drawImage
は画布上に画像を描画するために使用することができます。
#en
This method is overloaded with three variants: drawImage(image, dx, dy), drawImage(image, dx, dy, dw, dh), and drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh). (Actually it is overloaded with six; each of
those three can take either an HTMLImageElement or an HTMLCanvasElement for the image argument.) If not specified, the dw and dh arguments must default to the
values of sw and sh, interpreted
such that one CSS pixel in the image is treated as one unit in the canvas
coordinate space. If the sx, sy,
sw, and sh arguments are omitted,
they must default to 0, 0, the image's intrinsic width in image pixels,
and the image's intrinsic height in image pixels, respectively.
#ja
このメソッドは、drawImage(image, dx, dy)、drawImage(image, dx, dy, dw, dh)、drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) の3通りに多重定義されています。(実際には
6通りで、3通りのいずれの場合も、 image 引数に
HTMLImageElement か HTMLCanvasElement
のいずれかを指定できます。)
引数 dw および dh は、
指定されていない場合、既定値として、 sw と
sh の値を使用し[[MUST:なければなりません]]。
その場合、画像中の 1 CSS 画素が画布座標空間上の1単位として処理されることとなります。
引数 sx、sy、
sw、 sh が省略された場合、
それぞれ既定値の 0、0、画像の画素における画像の内在幅、
画像の画素における画像の内在高とし[[MUST:なければなりません]]。
#en
The image argument must be an instance of an
HTMLImageElement or HTMLCanvasElement. If the image is of the wrong type or null, the implementation must
raise a TYPE_MISMATCH_ERR exception.
#ja
引数 image は HTMLImageElement
または HTMLCanvasElement
の実現値でなければ[[MUST:なりません]]。 image が誤った型や null である場合、実装は
TYPE_MISMATCH_ERR 例外を発生させなければ[[MUST:なりません]]。
#en
If the image argument is an HTMLImageElement object whose complete attribute
is false, then the implementation must raise an
INVALID_STATE_ERR exception.
#ja
image 引数が HTMLImageElement であって
complete 属性が偽である場合、
実装は INVALID_STATE_ERR 例外を発生させなければ[[MUST:なりません]]。
#en
The source rectangle is the rectangle whose corners are the four points
(sx, sy), (sx+sw, sy),
(sx+sw, sy+sh), (sx,
sy+sh).
#ja
原始矩形は、その頂点が4点
(sx, sy), (sx+sw, sy),
(sx+sw, sy+sh), (sx,
sy+sh)
であるような矩形です。
#en
If the source rectangle is not entirely within the source image, or if
one of the sw or sh arguments is
zero, the implementation must raise an INDEX_SIZE_ERR
exception.
#ja
原始矩形が原始画像中に完全に収まっていない場合、
または引数 sw または sh
の1つが零である場合、実装は INDEX_SIZE_ERR 例外を発生させなければ[[MUST:なりません]]。
#en
The destination rectangle is the rectangle whose corners are the four
points (dx, dy), (dx+dw, dy),
(dx+dw, dy+dh), (dx,
dy+dh).
#ja
目的矩形は、その頂点が4点
(dx, dy), (dx+dw, dy),
(dx+dw, dy+dh), (dx,
dy+dh)
であるような矩形です。
#en
When drawImage() is invoked, the region of the
image specified by the source rectangle must be painted on the region of
the canvas specified by the destination rectangle, after applying the current
transformation matrix to the points of the destination rectangle.
#ja
drawImage() が呼び出されたとき、
原始矩形で指定される画像上の領域は、
現在変形行列を目的矩形の点に適用した後、
目的矩形で指定される画布上の領域に塗られなければ[[MUST:なりません]]。
#en
#ja
#en
When a canvas is drawn onto itself, the drawing model
requires the source to be copied before the image is drawn back onto the
canvas, so it is possible to copy parts of a canvas onto overlapping parts
of itself.
#ja
画布がそれ自体に塗られるとき、この描画モデルに従うと原始画像は画布上に重ねて描画する以前に複写されなければなりませんから、
画布の一部分をそれと重複する部分に複写することが可能です。
#en
When the drawImage() method is passed, as its image argument, an animated image, the poster frame of the
animation, or the first frame of the animation if there is no poster
frame, must be used.
#ja
drawImage() メソッドが image 引数にアニメーション画像を引き渡されたとき、
そのアニメーションのポスター枠か、ポスター枠がない場合には最初の枠が使用されなければ[[MUST:なりません]]。
#en
Images are painted without affecting the current path, and are subject
to shadow effects, global alpha, the
clipping region, and global composition
operators.
#ja
画像は現在経路に影響せずに塗られ、影効果、
大域アルファ、
くり抜き領域、
大域合成操作の対象でもあります。