Skip to content

拍照

方法名

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))
  })
}

参数说明

参数名参数类型是否必填默认值参数描述
typeInteger摄像头位置,1.左侧,2.右侧,0.所有
waterMarkerObject水印列表
waterMarker.textString水印文本内容
waterMarker.colorString#FFFFFF文本颜色
waterMarker.textSizeInteger20文本大小
waterMarker.typeFaceStringNORMAL文本样式
NORMAL:常规(默认)
BOLD:加粗
ITALIC:斜体
BOLD_ITALIC:斜体加粗
waterMarker.antiAliaBooleantrue是否使用抗锯齿功能
waterMarker.alphaInteger128透明度(0~255)
waterMarker.positionInteger0水印位置,0:左上角(默认),1.右上角,2.左下角,3.右下角
waterMarker.leftMarginInteger40水印左边距
waterMarker.rightMarginInteger40水印右边距
waterMarker.topMarginInteger40水印上边距
waterMarker.bottomMarginInteger40水印下边距

回调

示例

json
{
    "message": "",
    "code": 0,
    "data": {
        "index":1,
        "path":""
    }
}

回调说明

参数名参数类型参数描述
messageString消息提示
dataObject数据对象
data.indexInteger当前摄像头索引,1.左侧,2.右侧
data.pathString图片文件路径
codeInteger返回类型,0.成功,其他:失败