Class CaptchaNoiseUtil
java.lang.Object
cloud.opencode.base.captcha.support.CaptchaNoiseUtil
Captcha Noise Utility - Noise generation utilities
验证码噪点工具 - 噪点生成工具
This class provides noise and distortion utilities for CAPTCHA.
此类提供验证码的噪点和干扰工具。
Features | 主要功能:
- Noise dot generation - 噪点生成
- Interference line drawing - 干扰线绘制
- Curve distortion - 曲线扭曲
Usage Examples | 使用示例:
CaptchaNoiseUtil.drawNoise(graphics, config);
CaptchaNoiseUtil.drawLines(graphics, config);
Security | 安全性:
- Thread-safe: Yes (stateless utility) - 线程安全: 是(无状态工具)
- Null-safe: No (graphics and config must not be null) - 空值安全: 否(图形和配置不能为null)
Performance | 性能特性:
- Time complexity: O(k) where k is the configured noise count - 时间复杂度: O(k),k 为配置的噪点数量
- Space complexity: O(1) - no intermediate data structures - 空间复杂度: O(1) 无中间数据结构
- Since:
- JDK 25, opencode-base-captcha V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic voiddrawBackgroundNoise(Graphics2D g, CaptchaConfig config) Draws background noise.static voiddrawCubicCurveLines(Graphics2D g, CaptchaConfig config) Draws cubic curve lines on the graphics.static voiddrawCurveLines(Graphics2D g, CaptchaConfig config) Draws curve lines on the graphics.static voiddrawGradientBackground(Graphics2D g, CaptchaConfig config) Draws background with gradient.static voiddrawInterferencePattern(Graphics2D g, CaptchaConfig config) Draws interference pattern.static voiddrawNoiseDots(Graphics2D g, CaptchaConfig config) Draws noise dots on the graphics.static voiddrawNoiseLines(Graphics2D g, CaptchaConfig config) Draws noise lines on the graphics.static voidshear(Graphics2D g, CaptchaConfig config) Draws a shear transform effect.
-
Method Details
-
drawNoiseLines
Draws noise lines on the graphics. 在图形上绘制干扰线。- Parameters:
g- the graphics | 图形config- the configuration | 配置
-
drawCurveLines
Draws curve lines on the graphics. 在图形上绘制曲线。- Parameters:
g- the graphics | 图形config- the configuration | 配置
-
drawCubicCurveLines
Draws cubic curve lines on the graphics. 在图形上绘制三次曲线。- Parameters:
g- the graphics | 图形config- the configuration | 配置
-
drawNoiseDots
Draws noise dots on the graphics. 在图形上绘制干扰点。- Parameters:
g- the graphics | 图形config- the configuration | 配置
-
drawBackgroundNoise
Draws background noise. 绘制背景噪点。- Parameters:
g- the graphics | 图形config- the configuration | 配置
-
shear
Draws a shear transform effect. 绘制剪切变换效果。- Parameters:
g- the graphics | 图形config- the configuration | 配置
-
drawGradientBackground
Draws background with gradient. 绘制渐变背景。- Parameters:
g- the graphics | 图形config- the configuration | 配置
-
drawInterferencePattern
Draws interference pattern. 绘制干扰图案。- Parameters:
g- the graphics | 图形config- the configuration | 配置
-