Class CaptchaBuilder

java.lang.Object
org.miaixz.bus.extra.captcha.CaptchaBuilder

public class CaptchaBuilder extends Object
图形验证码工具
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    ofCircle(int width, int height)
    创建圆圈干扰的验证码,默认5位验证码,15个干扰圈
    ofCircle(int width, int height, int codeCount, int circleCount)
    创建圆圈干扰的验证码
    ofCircle(int width, int height, int codeCount, int circleCount, float size)
    创建圆圈干扰的验证码
    ofGif(int width, int height)
    创建GIF验证码
    ofGif(int width, int height, int codeCount)
    创建GIF验证码
    ofGif(int width, int height, int codeCount, int thickness, float sizeBaseHeight)
    创建圆圈干扰的验证码
    ofLine(int width, int height)
    创建线干扰的验证码,默认5位验证码,150条干扰线
    ofLine(int width, int height, int codeCount, int lineCount)
    创建线干扰的验证码
    ofLine(int width, int height, int codeCount, int lineCount, float sizeBaseHeight)
    创建线干扰的验证码
    ofShear(int width, int height)
    创建扭曲干扰的验证码,默认5位验证码
    ofShear(int width, int height, int codeCount, int thickness)
    创建扭曲干扰的验证码,默认5位验证码
    ofShear(int width, int height, int codeCount, int thickness, float sizeBaseHeight)
    创建扭曲干扰的验证码,默认5位验证码

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CaptchaBuilder

      public CaptchaBuilder()
  • Method Details

    • ofLine

      public static LineProvider ofLine(int width, int height)
      创建线干扰的验证码,默认5位验证码,150条干扰线
      Parameters:
      width - 图片宽
      height - 图片高
      Returns:
      LineProvider
    • ofLine

      public static LineProvider ofLine(int width, int height, int codeCount, int lineCount)
      创建线干扰的验证码
      Parameters:
      width - 图片宽
      height - 图片高
      codeCount - 字符个数
      lineCount - 干扰线条数
      Returns:
      LineProvider
    • ofLine

      public static LineProvider ofLine(int width, int height, int codeCount, int lineCount, float sizeBaseHeight)
      创建线干扰的验证码
      Parameters:
      width - 图片宽
      height - 图片高
      codeCount - 字符个数
      lineCount - 干扰线条数
      sizeBaseHeight - 字体的大小 高度的倍数
      Returns:
      LineProvider
    • ofCircle

      public static CircleProvider ofCircle(int width, int height)
      创建圆圈干扰的验证码,默认5位验证码,15个干扰圈
      Parameters:
      width - 图片宽
      height - 图片高
      Returns:
      CircleProvider
    • ofCircle

      public static CircleProvider ofCircle(int width, int height, int codeCount, int circleCount)
      创建圆圈干扰的验证码
      Parameters:
      width - 图片宽
      height - 图片高
      codeCount - 字符个数
      circleCount - 干扰圆圈条数
      Returns:
      CircleProvider
    • ofCircle

      public static CircleProvider ofCircle(int width, int height, int codeCount, int circleCount, float size)
      创建圆圈干扰的验证码
      Parameters:
      width - 图片宽
      height - 图片高
      codeCount - 字符个数
      circleCount - 干扰圆圈条数
      size - 字体的大小 高度的倍数
      Returns:
      CircleProvider
    • ofShear

      public static ShearProvider ofShear(int width, int height)
      创建扭曲干扰的验证码,默认5位验证码
      Parameters:
      width - 图片宽
      height - 图片高
      Returns:
      ShearProvider
    • ofShear

      public static ShearProvider ofShear(int width, int height, int codeCount, int thickness)
      创建扭曲干扰的验证码,默认5位验证码
      Parameters:
      width - 图片宽
      height - 图片高
      codeCount - 字符个数
      thickness - 干扰线宽度
      Returns:
      ShearProvider
    • ofShear

      public static ShearProvider ofShear(int width, int height, int codeCount, int thickness, float sizeBaseHeight)
      创建扭曲干扰的验证码,默认5位验证码
      Parameters:
      width - 图片宽
      height - 图片高
      codeCount - 字符个数
      thickness - 干扰线宽度
      sizeBaseHeight - 字体的大小 高度的倍数
      Returns:
      ShearProvider
    • ofGif

      public static GifProvider ofGif(int width, int height)
      创建GIF验证码
      Parameters:
      width - 宽
      height - 高
      Returns:
      GifProvider
    • ofGif

      public static GifProvider ofGif(int width, int height, int codeCount)
      创建GIF验证码
      Parameters:
      width - 宽
      height - 高
      codeCount - 字符个数
      Returns:
      GifProvider
    • ofGif

      public static GifProvider ofGif(int width, int height, int codeCount, int thickness, float sizeBaseHeight)
      创建圆圈干扰的验证码
      Parameters:
      width - 图片宽
      height - 图片高
      codeCount - 字符个数
      thickness - 验证码干扰元素个数
      sizeBaseHeight - 字体的大小 高度的倍数
      Returns:
      GifProvider