android 动画 camera,GitHub - liuxuanhai/Android_CameraMaskDemo: 相机遮罩、扫描动画

CameraMask

LatestVersion

68747470733a2f2f6170692e62696e747261792e636f6d2f7061636b616765732f6a757374696e71756f74652f6d6176656e2f63616d6572612d6d61736b2f696d616765732f646f776e6c6f61642e737667

fdc2cc5ad2af86456cf1e85af4f27a46.png

camera mask library and demo

Scan QRCode to download demo application below:

1、implementation

1.1、Gradle

compile 'jsc.kit.cameramask:camera-mask:_latestVersion'

1.2、Maven

jsc.kit.cameramask

camera-mask

_latestVersion

pom

2、attrs

名称

类型

描述

clvCameraLensSizeRatio

float

相机镜头(或扫描框)大小占View宽度的百分比

clvCameraLensWidthWeight

string,例如:{1.5,4}

相机镜头(或扫描框)宽度比重

clvCameraLensHeightWeight

string,例如:{1.5,4}

相机镜头(或扫描框)高度比重

clvCameraLensWidth

dimension

相机镜头(或扫描框)宽度

clvCameraLensHeight

dimension

相机镜头(或扫描框)高度

clvCameraLensGravity

enum(top、center、bottom)

相机镜头(或扫描框)位置

clvCameraLensTopMargin

dimension

相机镜头(或扫描框)Y轴偏移量

clvCameraLensShape

enum(rectangle、circular)

相机镜头(或扫描框)形状

clvCameraLens

reference

相机镜头图片资源

clvMaskColor

color

相机镜头遮罩颜色

clvBoxBorderColor

color

扫描框边的颜色

clvBoxBorderWidth

dimension

扫描框边的粗细

clvShowBoxAngle

boolean

是否显示扫描框四个角

clvBoxAngleColor

color

扫描框四个角的颜色

clvBoxAngleBorderWidth

dimension

扫描框四个角边的粗细

clvBoxAngleLength

dimension

扫描框四个角边的长度

clvText

string

提示文字

clvTextColor

color

提示文字颜色

clvTextSize

dimension

提示文字字体大小

clvTextMathParent

boolean

提示文字是否填充View的宽度。true与View等宽,false与相机镜头(或扫描框)等宽。

clvTextLocation

enum(belowCameraLens、aboveCameraLens)

提示文字位于相机镜头(或扫描框)上方(或下方)

clvTextVerticalMargin

dimension

提示文字与相机镜头(或扫描框)的间距

clvTextLeftMargin

dimension

提示文字与View(或相机镜头或扫描框)的左间距

clvTextRightMargin

dimension

提示文字与View(或相机镜头或扫描框)的右间距

名称

类型

描述

sbvSrc

reference

扫描条图片

3、usage

3.1、CameraLensView:

{1.5,4}好比LinearLayout的weightSum=4, 其中相机镜头所占比重为1.5

android:id="@+id/camera_lens_view"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

app:clvCameraLensGravity="top"

app:clvCameraLensHeight="48dp"

app:clvCameraLensWidth="64dp"

app:clvCameraLensWidthWeight="{1.5,4}"

app:clvCameraLensHeightWeight="{1.5,4}"

app:clvCameraLensShape="rectangle"

app:clvCameraLensTopMargin="@dimen/space_32"

app:clvShowBoxAngle="true"

app:clvText="Put QR code inside camera lens please."

app:clvTextLocation="belowCameraLens"

app:clvTextMathParent="true"

app:clvTextSize="14sp"

app:clvTextVerticalMargin="8dp" />

android:id="@+id/scanner_view"

android:layout_width="160dp"

android:layout_height="160dp"

android:layout_gravity="center_horizontal"

android:layout_marginTop="@dimen/space_32"

app:svbSrc="drawable图片资源"

android:background="#f2f2f2" />

android:id="@+id/camera_scanner_mask_view"

android:layout_width="match_parent"

android:layout_height="match_parent"

app:clvCameraLensWidthWeight="{1.5, 4}"

app:clvCameraLensHeight="96dp"

app:clvCameraLensHeightWeight="{2, 5}"

app:clvCameraLensTopMargin="64dp"

app:clvText="Put QR code inside camera lens please."

app:clvTextVerticalMargin="16dp" />

4、Screenshots

b272ba1c174ce00d7223ad78e334c02d.png

fcd487b9617e96123573a9f5ab75d387.png

6a3f9effce253c905638f40c90d41626.png

f4509c5f44e82132798fee2cf5e9de7d.png

e60aea7f105b379a46bd13cf18eeaeac.png

61296cec4b59d2a1cc3b666399b145dc.png

5、release log

version:0.3.0

1、fix bugs

2、optimize CameraLensView, add attrs:

clvCameraLensWidthWeight:相机镜头宽度比重,例如:{1.5,4}

clvCameraLensHeightWeight:相机镜头高度比重,例如:`{5,2}

version:0.2.1

1、optimize CameraLensView, add attrs:

clvCameraLensWidth:相机镜头(或扫描框)宽度

clvCameraLensHeight:相机镜头(或扫描框)高

clvCameraLensGravity(top、center、bottom):相机镜头(或扫描框)位置

clvShowBoxAngle:是否显示扫描框四个角

version:0.1.2

version:0.1.1

1、add method in CameraLensView、CameraScannerMaskView:

Bitmap cropCameraLensRectBitmap(Bitmap src, boolean withRatio)

LICENSE

Copyright 2018 JustinRoom

Licensed under the Apache License, Version 2.0 (the "License");

you may not use this file except in compliance with the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an "AS IS" BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值