Appearance
拍照
方法名
takePicture
用法
示例
js
if (this.$refs.refLevenUvcMultiCamera) {
this.$refs.refLevenUvcMultiCamera.takePicture({
type: type,
//水印,不添加水印可以不用传此参数
waterMarker: [{
//水印内容
text: "这是一条测试水印",
//文本颜色,默认:白色
color: "#FFFFFF",
//文本大小,默认:20
textSize: 40,
//文本样式,NORMAL:常规(默认),BOLD:加粗,ITALIC:斜体,BOLD_ITALIC:斜体加粗
typeFace: "NORMAL",
//是否使用抗锯齿功能,默认:true
antiAlia: true,
//透明度(0~255),默认:128
alpha: 128,
//水印位置,0:左上角(默认),1.右上角,2.左下角,3.右下角
position: 1,
//水印左边距,默认:40
leftMargin: 40,
//水印右边距,默认:40
rightMargin: 40,
//水印上边距,默认:40
topMargin: 40,
//水印下边距,默认:40
bottomMargin: 40
}]
}, res => {
this.writeLog(JSON.stringify(res))
})
}参数说明
| 参数名 | 参数类型 | 是否必填 | 默认值 | 参数描述 |
|---|---|---|---|---|
| type | Integer | 是 | 无 | 摄像头位置,1.左侧,2.右侧,0.所有 |
| waterMarker | Object | 否 | 无 | 水印列表 |
| waterMarker.text | String | 否 | 无 | 水印文本内容 |
| waterMarker.color | String | 否 | #FFFFFF | 文本颜色 |
| waterMarker.textSize | Integer | 否 | 20 | 文本大小 |
| waterMarker.typeFace | String | 否 | NORMAL | 文本样式NORMAL:常规(默认)BOLD:加粗ITALIC:斜体BOLD_ITALIC:斜体加粗 |
| waterMarker.antiAlia | Boolean | 否 | true | 是否使用抗锯齿功能 |
| waterMarker.alpha | Integer | 否 | 128 | 透明度(0~255) |
| waterMarker.position | Integer | 否 | 0 | 水印位置,0:左上角(默认),1.右上角,2.左下角,3.右下角 |
| waterMarker.leftMargin | Integer | 否 | 40 | 水印左边距 |
| waterMarker.rightMargin | Integer | 否 | 40 | 水印右边距 |
| waterMarker.topMargin | Integer | 否 | 40 | 水印上边距 |
| waterMarker.bottomMargin | Integer | 否 | 40 | 水印下边距 |
回调
示例
json
{
"message": "",
"code": 0,
"data": {
"index":1,
"path":""
}
}回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.index | Integer | 当前摄像头索引,1.左侧,2.右侧 |
| data.path | String | 图片文件路径 |
| code | Integer | 返回类型,0.成功,其他:失败 |
