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 text
String | Array 文字(字符串或包含字符串的数组)
option
Object Properties
Name Type Argument Default Description font
String <optional>
"10px sans-serif" 文字样式
line
String <optional>
"alphabetic" 文字垂直对齐方式
color
String <optional>
"#000000" 文字样式(颜色)
left
Number 文字起点 x 坐标
top
Number 文字起点 y 坐标
lineHeight
Number <optional>
24 文字行高(绘制多行文字时需要)
-
fillTriangle(option)
-
在画布上画三角形
Parameters:
Name Type Description option
Object Properties
Name Type Argument Default Description vertex
Array 三角形顶点
vertex[i].x
Number 顶点 x 坐标
vertex[i].y
Number 顶点 y 坐标
width
Number <optional>
1 线宽
color
String <optional>
"#000000" 颜色
-
getBase64( [quality])
-
获取base64图片地址
Parameters:
Name Type Argument Default Description quality
Number <optional>
0.8 图片质量
-
init(scene [, width] [, height], callback)
-
截图实例化之后需要进行初始化
Parameters:
Name Type Argument Default Description scene
Scene 场景对象
width
Number <optional>
128 画布宽度(像素)
height
Number <optional>
128 画布高度(像素)
callback
FdCamera.capture2~Callback 初始化完成后的回调函数,在回调函数中设置父元素的样式
-
strokeEllip(option)
-
画椭圆(扇形)
Parameters:
Name Type Description option
Object Properties
Name Type Argument Default Description centerX
Number 圆心坐标
centerY
Number radiusX
Number 半径
radiusY
Number rotate
Number <optional>
0 旋转弧度
startRadian
Number <optional>
0 起始弧度值
endRadian
Number <optional>
Math.PI * 2 结束弧度值
width
Number <optional>
1 线宽
color
String <optional>
"#000000" 颜色
-
strokeLine(option)
-
在画布上画线段
Parameters:
Name Type Description option
Object Properties
Name Type Argument Default Description startX
Number 线段起点 x 坐标
startY
Number 线段起点 y 坐标
endX
Number 线段结束点 x 坐标
endY
Number 线段结束点 y 坐标
width
Number <optional>
2 线宽
color
String <optional>
"#000000" 颜色
-
strokeRect(option)
-
画矩形框
Parameters:
Name Type Description option
Object Properties
Name Type Argument Default Description left
Number 左上角顶点 x 坐标
top
Number 左上角顶点 y 坐标
width
Number 宽度
height
Number 高度
lineWidth
Number <optional>
1 线宽
color
String <optional>
"#000000" 矩形框颜色
Type Definitions
-
Callback()
-
capture2.init的回调函数