类 BlockPuzzleCaptchaServiceImpl

java.lang.Object
com.xingyuv.captcha.service.impl.AbstractCaptchaService
com.xingyuv.captcha.service.impl.BlockPuzzleCaptchaServiceImpl
所有已实现的接口:
CaptchaService

public class BlockPuzzleCaptchaServiceImpl extends AbstractCaptchaService
滑动验证码

Created by raodeming on 2019/12/25.

  • 构造器详细资料

    • BlockPuzzleCaptchaServiceImpl

      public BlockPuzzleCaptchaServiceImpl()
  • 方法详细资料

    • init

      public void init(Properties config)
      从类复制的说明: AbstractCaptchaService
      判断应用是否实现了自定义缓存,没有就使用内存
      指定者:
      init 在接口中 CaptchaService
      覆盖:
      init 在类中 AbstractCaptchaService
      参数:
      config - config
    • destroy

      public void destroy(Properties config)
      从接口复制的说明: CaptchaService
      历史资源清除(过期的图片文件,生成的临时图片...)
      指定者:
      destroy 在接口中 CaptchaService
      覆盖:
      destroy 在类中 AbstractCaptchaService
      参数:
      config - 配置项 控制资源清理的粒度
    • captchaType

      public String captchaType()
      从接口复制的说明: CaptchaService
      验证码类型 通过java SPI机制,接入方可自定义实现类,实现新的验证类型
      返回:
      captchaType
    • get

      public ResponseModel get(CaptchaVO captchaVO)
      从接口复制的说明: CaptchaService
      获取验证码
      指定者:
      get 在接口中 CaptchaService
      覆盖:
      get 在类中 AbstractCaptchaService
      参数:
      captchaVO - captchaVO
      返回:
      ResponseModel
    • check

      public ResponseModel check(CaptchaVO captchaVO)
      从接口复制的说明: CaptchaService
      核对验证码(前端)
      指定者:
      check 在接口中 CaptchaService
      覆盖:
      check 在类中 AbstractCaptchaService
      参数:
      captchaVO - captchaVO
      返回:
      ResponseModel
    • verification

      public ResponseModel verification(CaptchaVO captchaVO)
      从接口复制的说明: CaptchaService
      二次校验验证码(后端)
      指定者:
      verification 在接口中 CaptchaService
      覆盖:
      verification 在类中 AbstractCaptchaService
      参数:
      captchaVO - captchaVO
      返回:
      ResponseModel
    • pictureTemplatesCut

      public CaptchaVO pictureTemplatesCut(BufferedImage originalImage, BufferedImage jigsawImage, String jigsawImageBase64)
      根据模板切图
      参数:
      originalImage - originalImage
      jigsawImage - jigsawImage
      jigsawImageBase64 - jigsawImageBase64
      返回:
      CaptchaVO
    • generateJigsawPoint

      private static PointVO generateJigsawPoint(int originalWidth, int originalHeight, int jigsawWidth, int jigsawHeight)
      随机生成拼图坐标
      参数:
      originalWidth - originalWidth
      originalHeight - originalHeight
      jigsawWidth - jigsawWidth
      jigsawHeight - jigsawHeight
      返回:
      PointVO
    • cutByTemplate

      private static void cutByTemplate(BufferedImage oriImage, BufferedImage templateImage, BufferedImage newImage, int x, int y)
      参数:
      oriImage - 原图
      templateImage - 模板图
      newImage - 新抠出的小图
      x - 随机扣取坐标X
      y - 随机扣取坐标y
    • interferenceByTemplate

      private static void interferenceByTemplate(BufferedImage oriImage, BufferedImage templateImage, int x, int y)
      干扰抠图处理
      参数:
      oriImage - 原图
      templateImage - 模板图
      x - 随机扣取坐标X
      y - 随机扣取坐标y
    • readPixel

      private static void readPixel(BufferedImage img, int x, int y, int[] pixels)
    • fillMatrix

      private static void fillMatrix(int[][] matrix, int[] values)
    • avgMatrix

      private static int avgMatrix(int[][] matrix)