标签:evel 宽高 idt nal option RKE code lin canvas
首先看html5.js
/**
@param {Element} img_elem
@param {Number} dx_or_sx
@param {Number} dy_or_sy
@param {Number} [dw_or_sw]
@param {Number} [dh_or_sh]
@param {Number} [dx]
@param {Number} [dy]
@param {Number} [dw]
@param {Number} [dh]
*/
CanvasRenderingContext2D.prototype.drawImage = function(img_elem,dx_or_sx,dy_or_sy,dw_or_sw,dh_or_sh,dx,dy,dw,dh) {};
再底层
drawImage(image: HTMLElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void;
其实平时调用支持三种传参
void ctx.drawImage(image, dx, dy);//dx,dy决定了生成的图像与画布的间隔距离 void ctx.drawImage(image, dx, dy, dWidth, dHeight);//dWidth, dHeight决定了生成图片的宽高,默认是img.width,img.height
void ctx.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);// dWidth, dHeight是对生成图片的缩放值
image
CanvasImageSource
),例如:CSSImageValue
,HTMLImageElement
,SVGImageElement
,HTMLVideoElement
,HTMLCanvasElement
,ImageBitmap
或者OffscreenCanvas
。 dx
dy
dWidth
可选 dHeight
可选 sx
可选 sy
可选 sWidth
可选 sHeight
可选INDEX_SIZE_ERR
INVALID_STATE_ERR
TYPE_MISMATCH_ERR
NS_ERROR_NOT_AVAILABLE
.complete === true
和.onload
确定何时准备就绪。标签:evel 宽高 idt nal option RKE code lin canvas
原文地址:https://www.cnblogs.com/zeussbook/p/10281967.html