new capture2(canvas)
Parameters:
| Name | Type | Description |
|---|---|---|
canvas |
Canvas | 显示截图的画布 |
Example
var capture = new Freedo.FdApp.capture2(canvas);
Methods
-
fillText(text, option)
-
画文字
Parameters:
Name Type Description textString | Array 文字(字符串或包含字符串的数组)
optionObject Properties
Name Type Argument Default Description fontString <optional>
"10px sans-serif" 文字样式
lineString <optional>
"alphabetic" 文字垂直对齐方式
colorString <optional>
"#000000" 文字样式(颜色)
leftNumber 文字起点 x 坐标
topNumber 文字起点 y 坐标
lineHeightNumber <optional>
24 文字行高(绘制多行文字时需要)
-
fillTriangle(option)
-
在画布上画三角形
Parameters:
Name Type Description optionObject Properties
Name Type Argument Default Description vertexArray 三角形顶点
vertex[i].xNumber 顶点 x 坐标
vertex[i].yNumber 顶点 y 坐标
widthNumber <optional>
1 线宽
colorString <optional>
"#000000" 颜色
-
getBase64( [quality])
-
获取base64图片地址
Parameters:
Name Type Argument Default Description qualityNumber <optional>
0.8 图片质量
-
init(scene [, width] [, height], callback)
-
截图实例化之后需要进行初始化
Parameters:
Name Type Argument Default Description sceneScene 场景对象
widthNumber <optional>
128 画布宽度(像素)
heightNumber <optional>
128 画布高度(像素)
callbackFdCamera.capture2~Callback 初始化完成后的回调函数,在回调函数中设置父元素的样式
-
strokeEllip(option)
-
画椭圆(扇形)
Parameters:
Name Type Description optionObject Properties
Name Type Argument Default Description centerXNumber 圆心坐标
centerYNumber radiusXNumber 半径
radiusYNumber rotateNumber <optional>
0 旋转弧度
startRadianNumber <optional>
0 起始弧度值
endRadianNumber <optional>
Math.PI * 2 结束弧度值
widthNumber <optional>
1 线宽
colorString <optional>
"#000000" 颜色
-
strokeLine(option)
-
在画布上画线段
Parameters:
Name Type Description optionObject Properties
Name Type Argument Default Description startXNumber 线段起点 x 坐标
startYNumber 线段起点 y 坐标
endXNumber 线段结束点 x 坐标
endYNumber 线段结束点 y 坐标
widthNumber <optional>
2 线宽
colorString <optional>
"#000000" 颜色
-
strokeRect(option)
-
画矩形框
Parameters:
Name Type Description optionObject Properties
Name Type Argument Default Description leftNumber 左上角顶点 x 坐标
topNumber 左上角顶点 y 坐标
widthNumber 宽度
heightNumber 高度
lineWidthNumber <optional>
1 线宽
colorString <optional>
"#000000" 矩形框颜色
Type Definitions
-
Callback()
-
capture2.init的回调函数