二维码的生成与扫描 源码下载

移动开发
搜集了二维码的生成、扫描功能代码,扫描功能 包括了 二维码、条码的扫描,具有 360扫描的UI效果,作为二维码的工具。

搜集了二维码的生成、扫描功能代码,扫描功能 包括了 二维码、条码的扫描,具有 360扫描的UI效果,作为二维码的工具。

源码简介

源码运行截图

 

运行截图

二维码、条码的扫描

二维码的生成  

源码片段

/*** 
     * 
     * @param string  生成二维码的字符串 
     * @param format  二维码的格式 
     * @return     返回二维码图片 
     * @throws WriterException 
     */ 
    public Bitmap qr_code(String string, BarcodeFormat format) 
            throws WriterException { 
        MultiFormatWriter writer = new MultiFormatWriter(); 
        Hashtable<encodehinttype, string=""> hst = new Hashtable<encodehinttype, string="">(); 
        hst.put(EncodeHintType.CHARACTER_SET, "UTF-8"); 
        BitMatrix matrix = writer.encode(string, format, 400400, hst); 
        int width = matrix.getWidth(); 
        int height = matrix.getHeight(); 
        int[] pixels = new int[width * height]; 
        for (int y = 0; y < height; y++) { 
            for (int x = 0; x < width; x++) { 
                if (matrix.get(x, y)) { 
                    pixels[y * width + x] = 0xff000000
                } 
  
            } 
        } 
        Bitmap bitmap = Bitmap.createBitmap(width, height, 
                Bitmap.Config.ARGB_8888); 
        // 通过像素数组生成bitmap,具体参考api 
        bitmap.setPixels(pixels, 0, width, 00, width, height); 
        return bitmap; 
    } 
</encodehinttype,></encodehinttype,> 
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.

源码下载地址:http://down.51cto.com/data/1968746

责任编辑:闫佳明 来源: 网络整理
相关推荐

2024-06-26 08:46:45

2015-10-28 13:33:50

二维码条形码扫描源码

2023-11-17 15:44:06

C++库生成二维码

2023-11-17 09:07:51

.NET生成二维码识别二维码

2015-09-24 09:56:19

.NET二维码

2013-10-29 09:46:05

二维码

2013-03-27 16:13:17

Android开发Android二维码生QR生成

2013-01-30 12:16:49

二维码NFC近场通讯

2023-10-31 08:16:16

Go语言二维码

2020-04-01 10:06:41

二维码技术服务端

2015-07-22 10:46:20

二维码扫描

2024-11-20 13:00:02

2017-11-21 09:00:15

PHP二维码LOGO图像

2020-08-07 14:18:03

二维码Go语言编程

2021-02-08 08:40:00

Zint二维码开源

2017-02-21 09:17:46

二维码漏洞

2012-04-01 09:53:13

二维码

2011-12-06 16:40:45

二维码快拍二维码灵动快拍

2011-11-24 16:00:23

信息图QR码二维码

2022-03-24 09:43:29

二维码二维码修改器github
点赞
收藏

51CTO技术栈公众号