-
public final class CodeUtils二维码/条形码工具类:主要包括二维码/条形码的解析与生成
-
-
Field Summary
Fields Modifier and Type Field Description public final static intDEFAULT_REQ_WIDTHpublic final static intDEFAULT_REQ_HEIGHT
-
Method Summary
Modifier and Type Method Description static BitmapcreateQRCode(String content, int heightPix)生成二维码 static BitmapcreateQRCode(String content, int heightPix, int codeColor)生成二维码 static BitmapcreateQRCode(String content, int heightPix, Bitmap logo)生成我二维码 static BitmapcreateQRCode(String content, int heightPix, Bitmap logo, int codeColor)生成我二维码 static BitmapcreateQRCode(String content, int heightPix, Bitmap logo, @FloatRange(from = 0.0f, to = 1.0f) float ratio)生成二维码 static BitmapcreateQRCode(String content, int heightPix, Bitmap logo, @FloatRange(from = 0.0f, to = 1.0f) float ratio, int codeColor)生成二维码 static BitmapcreateQRCode(String content, int heightPix, Bitmap logo, @FloatRange(from = 0.0f, to = 1.0f) float ratio, Map<EncodeHintType, out Object> hints)static BitmapcreateQRCode(String content, int heightPix, Bitmap logo, @FloatRange(from = 0.0f, to = 1.0f) float ratio, Map<EncodeHintType, out Object> hints, int codeColor)生成二维码 static StringparseQRCode(String bitmapPath)解析二维码图片 static ResultparseQRCodeResult(String bitmapPath)解析二维码图片 static ResultparseQRCodeResult(String bitmapPath, int reqWidth, int reqHeight)解析二维码图片 static StringparseCode(String bitmapPath)解析一维码/二维码图片 static StringparseCode(String bitmapPath, Map<DecodeHintType, Object> hints)解析一维码/二维码图片 static StringparseQRCode(Bitmap bitmap)解析二维码图片 static StringparseCode(Bitmap bitmap)解析一维码/二维码图片 static StringparseCode(Bitmap bitmap, Map<DecodeHintType, Object> hints)解析一维码/二维码图片 static ResultparseCodeResult(String bitmapPath, Map<DecodeHintType, Object> hints)解析一维码/二维码图片 static ResultparseCodeResult(String bitmapPath, int reqWidth, int reqHeight, Map<DecodeHintType, Object> hints)解析一维码/二维码图片 static ResultparseCodeResult(Bitmap bitmap)解析一维码/二维码图片 static ResultparseCodeResult(Bitmap bitmap, Map<DecodeHintType, Object> hints)解析一维码/二维码图片 static ResultparseCodeResult(LuminanceSource source, Map<DecodeHintType, Object> hints)解析一维码/二维码图片 static BitmapcreateBarCode(String content, int desiredWidth, int desiredHeight)生成条形码 static BitmapcreateBarCode(String content, BarcodeFormat format, int desiredWidth, int desiredHeight)生成条形码 static BitmapcreateBarCode(String content, int desiredWidth, int desiredHeight, boolean isShowText)static BitmapcreateBarCode(String content, int desiredWidth, int desiredHeight, boolean isShowText, @ColorInt() int codeColor)生成条形码 static BitmapcreateBarCode(String content, BarcodeFormat format, int desiredWidth, int desiredHeight, Map<EncodeHintType, out Object> hints)生成条形码 static BitmapcreateBarCode(String content, BarcodeFormat format, int desiredWidth, int desiredHeight, Map<EncodeHintType, out Object> hints, boolean isShowText)生成条形码 static BitmapcreateBarCode(String content, BarcodeFormat format, int desiredWidth, int desiredHeight, boolean isShowText, @ColorInt() int codeColor)生成条形码 static BitmapcreateBarCode(String content, BarcodeFormat format, int desiredWidth, int desiredHeight, Map<EncodeHintType, out Object> hints, boolean isShowText, @ColorInt() int codeColor)生成条形码 static BitmapcreateBarCode(String content, BarcodeFormat format, int desiredWidth, int desiredHeight, Map<EncodeHintType, out Object> hints, boolean isShowText, int textSize, @ColorInt() int codeColor)生成条形码 -
-
Method Detail
-
createQRCode
static Bitmap createQRCode(String content, int heightPix)
生成二维码
- Parameters:
content- 二维码的内容heightPix- 二维码的高
-
createQRCode
static Bitmap createQRCode(String content, int heightPix, int codeColor)
生成二维码
- Parameters:
content- 二维码的内容heightPix- 二维码的高codeColor- 二维码的颜色
-
createQRCode
static Bitmap createQRCode(String content, int heightPix, Bitmap logo)
生成我二维码
- Parameters:
content- 二维码的内容heightPix- 二维码的高logo- logo大小默认占二维码的20%
-
createQRCode
static Bitmap createQRCode(String content, int heightPix, Bitmap logo, int codeColor)
生成我二维码
- Parameters:
content- 二维码的内容heightPix- 二维码的高logo- logo大小默认占二维码的20%codeColor- 二维码的颜色
-
createQRCode
static Bitmap createQRCode(String content, int heightPix, Bitmap logo, @FloatRange(from = 0.0f, to = 1.0f) float ratio)
生成二维码
- Parameters:
content- 二维码的内容heightPix- 二维码的高logo- 二维码中间的logoratio- logo所占比例 因为二维码的最大容错率为30%,所以建议ratio的范围小于0.
-
createQRCode
static Bitmap createQRCode(String content, int heightPix, Bitmap logo, @FloatRange(from = 0.0f, to = 1.0f) float ratio, int codeColor)
生成二维码
- Parameters:
content- 二维码的内容heightPix- 二维码的高logo- 二维码中间的logoratio- logo所占比例 因为二维码的最大容错率为30%,所以建议ratio的范围小于0.codeColor- 二维码的颜色
-
createQRCode
static Bitmap createQRCode(String content, int heightPix, Bitmap logo, @FloatRange(from = 0.0f, to = 1.0f) float ratio, Map<EncodeHintType, out Object> hints)
-
createQRCode
static Bitmap createQRCode(String content, int heightPix, Bitmap logo, @FloatRange(from = 0.0f, to = 1.0f) float ratio, Map<EncodeHintType, out Object> hints, int codeColor)
生成二维码
- Parameters:
content- 二维码的内容heightPix- 二维码的高logo- 二维码中间的logoratio- logo所占比例 因为二维码的最大容错率为30%,所以建议ratio的范围小于0.codeColor- 二维码的颜色
-
parseQRCode
static String parseQRCode(String bitmapPath)
解析二维码图片
- Parameters:
bitmapPath- 需要解析的图片路径
-
parseQRCodeResult
static Result parseQRCodeResult(String bitmapPath)
解析二维码图片
- Parameters:
bitmapPath- 需要解析的图片路径
-
parseQRCodeResult
static Result parseQRCodeResult(String bitmapPath, int reqWidth, int reqHeight)
解析二维码图片
- Parameters:
bitmapPath- 需要解析的图片路径reqWidth- 请求目标宽度,如果实际图片宽度大于此值,会自动进行压缩处理,当 reqWidth 和 reqHeight都小于或等于0时,则不进行压缩处理reqHeight- 请求目标高度,如果实际图片高度大于此值,会自动进行压缩处理,当 reqWidth 和 reqHeight都小于或等于0时,则不进行压缩处理
-
parseCode
static String parseCode(String bitmapPath, Map<DecodeHintType, Object> hints)
解析一维码/二维码图片
- Parameters:
bitmapPath- 需要解析的图片路径hints- 解析编码类型
-
parseQRCode
static String parseQRCode(Bitmap bitmap)
解析二维码图片
- Parameters:
bitmap- 解析的图片
-
parseCode
static String parseCode(Bitmap bitmap, Map<DecodeHintType, Object> hints)
解析一维码/二维码图片
- Parameters:
bitmap- 解析的图片hints- 解析编码类型
-
parseCodeResult
static Result parseCodeResult(String bitmapPath, Map<DecodeHintType, Object> hints)
解析一维码/二维码图片
- Parameters:
hints- 解析编码类型
-
parseCodeResult
static Result parseCodeResult(String bitmapPath, int reqWidth, int reqHeight, Map<DecodeHintType, Object> hints)
解析一维码/二维码图片
- Parameters:
bitmapPath- 需要解析的图片路径reqWidth- 请求目标宽度,如果实际图片宽度大于此值,会自动进行压缩处理,当 reqWidth 和 reqHeight都小于或等于0时,则不进行压缩处理reqHeight- 请求目标高度,如果实际图片高度大于此值,会自动进行压缩处理,当 reqWidth 和 reqHeight都小于或等于0时,则不进行压缩处理hints- 解析编码类型
-
parseCodeResult
static Result parseCodeResult(Bitmap bitmap)
解析一维码/二维码图片
- Parameters:
bitmap- 解析的图片
-
parseCodeResult
static Result parseCodeResult(Bitmap bitmap, Map<DecodeHintType, Object> hints)
解析一维码/二维码图片
- Parameters:
bitmap- 解析的图片hints- 解析编码类型
-
parseCodeResult
static Result parseCodeResult(LuminanceSource source, Map<DecodeHintType, Object> hints)
解析一维码/二维码图片
-
createBarCode
static Bitmap createBarCode(String content, int desiredWidth, int desiredHeight)
生成条形码
-
createBarCode
static Bitmap createBarCode(String content, BarcodeFormat format, int desiredWidth, int desiredHeight)
生成条形码
-
createBarCode
static Bitmap createBarCode(String content, int desiredWidth, int desiredHeight, boolean isShowText)
-
createBarCode
static Bitmap createBarCode(String content, int desiredWidth, int desiredHeight, boolean isShowText, @ColorInt() int codeColor)
生成条形码
-
createBarCode
static Bitmap createBarCode(String content, BarcodeFormat format, int desiredWidth, int desiredHeight, Map<EncodeHintType, out Object> hints)
生成条形码
-
createBarCode
static Bitmap createBarCode(String content, BarcodeFormat format, int desiredWidth, int desiredHeight, Map<EncodeHintType, out Object> hints, boolean isShowText)
生成条形码
-
createBarCode
static Bitmap createBarCode(String content, BarcodeFormat format, int desiredWidth, int desiredHeight, boolean isShowText, @ColorInt() int codeColor)
生成条形码
-
createBarCode
static Bitmap createBarCode(String content, BarcodeFormat format, int desiredWidth, int desiredHeight, Map<EncodeHintType, out Object> hints, boolean isShowText, @ColorInt() int codeColor)
生成条形码
-
createBarCode
static Bitmap createBarCode(String content, BarcodeFormat format, int desiredWidth, int desiredHeight, Map<EncodeHintType, out Object> hints, boolean isShowText, int textSize, @ColorInt() int codeColor)
生成条形码
-
-
-
-