Skip to content

Repository files navigation

CameraMask

LatestVersion

Download

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
<dependency>
<groupId>jsc.kit.cameramask</groupId>
<artifactId>camera-mask</artifactId>
<version>_latestVersion</version>
<type>pom</type>
</dependency>

2、attrs

名称类型描述
clvCameraLensSizeRatiofloat相机镜头(或扫描框)大小占View宽度的百分比
clvCameraLensWidthWeightstring,例如:{1.5,4}相机镜头(或扫描框)宽度比重
clvCameraLensHeightWeightstring,例如:{1.5,4}相机镜头(或扫描框)高度比重
clvCameraLensWidthdimension相机镜头(或扫描框)宽度
clvCameraLensHeightdimension相机镜头(或扫描框)高度
clvCameraLensGravityenum(topcenterbottom)相机镜头(或扫描框)位置
clvCameraLensTopMargindimension相机镜头(或扫描框)Y轴偏移量
clvCameraLensShapeenum(rectanglecircular)相机镜头(或扫描框)形状
clvCameraLensreference相机镜头图片资源
clvMaskColorcolor相机镜头遮罩颜色
clvBoxBorderColorcolor扫描框边的颜色
clvBoxBorderWidthdimension扫描框边的粗细
clvShowBoxAngleboolean是否显示扫描框四个角
clvBoxAngleColorcolor扫描框四个角的颜色
clvBoxAngleBorderWidthdimension扫描框四个角边的粗细
clvBoxAngleLengthdimension扫描框四个角边的长度
clvTextstring提示文字
clvTextColorcolor提示文字颜色
clvTextSizedimension提示文字字体大小
clvTextMathParentboolean提示文字是否填充View的宽度。true与View等宽,false与相机镜头(或扫描框)等宽。
clvTextLocationenum(belowCameraLensaboveCameraLens)提示文字位于相机镜头(或扫描框)上方(或下方)
clvTextVerticalMargindimension提示文字与相机镜头(或扫描框)的间距
clvTextLeftMargindimension提示文字与View(或相机镜头或扫描框)的左间距
clvTextRightMargindimension提示文字与View(或相机镜头或扫描框)的右间距
名称类型描述
sbvSrcreference扫描条图片
子View类型属性
cameraLensViewCameraLensViewCameraLensView所有属性
scannerBarViewScannerBarViewScannerBarView所有属性

3、usage

  • 3.1、CameraLensView: {1.5,4}好比LinearLayout的weightSum=4, 其中相机镜头所占比重为1.5
 <jsc.kit.cameramask.CameraLensView
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" />
 <jsc.kit.cameramask.ScannerBarView
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" />
 <jsc.kit.cameramask.CameraScannerMaskView
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" />
组件使用示例
ScannerBarViewScannerBarViewFragment
CameraLensViewCameraLensViewFragment
CameraScannerMaskViewCameraScannerMaskViewFragment

4、Screenshots

ScannerBarView

CameraLensView:pictureCameraLensView:circle-shapeCameraLensView:square-shapeCameraLensView:crop-bitmap

CameraScannerMaskView

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(topcenterbottom):相机镜头(或扫描框)位置
    clvShowBoxAngle:是否显示扫描框四个角
version:0.1.2
version:0.1.1

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.

About

相机遮罩、扫描动画

Resources

Stars

101 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages