caprs 0.1.1

Image-based click, slide, drag and rotate CAPTCHA generation and verification
Documentation
# Porting notes

`caprs` implements the five user-facing CAPTCHA modes from [go-captcha v2.0.5](https://github.com/wenlng/go-captcha/tree/v2.0.5) (`de8cdfb`). The parity target is generation with configurable resources, the image formats and answer semantics, and point or angle verification. The Rust API uses typed configuration and returns errors for invalid settings.

| Go API | Rust API |
| --- | --- |
| `click.NewBuilder` and `Make` / `MakeWithShape` | `click::Captcha::new` with `click::Symbols` |
| `click.With*` options and resources | `click::Options`, `click::Backgrounds`, `click::Symbols`, `click::Font` and `click::Shape` |
| `slide.NewBuilder` and `Make` / `MakeDragDrop` | `slide::Captcha::new` with `slide::Mode` |
| `slide.With*`, `slide.GraphImage` | `slide::Options`, `slide::Resources` and `slide::Graph` |
| `rotate.NewBuilder`, `Make`, `WithImages`, `With*` options | `rotate::Captcha::new` with `rotate::Options` and backgrounds |
| `Generate`, `GetData`, `GetMasterImage`, `GetThumbImage` / `GetTileImage` | `generate`, `Challenge::answer`, `Challenge::images` |
| `click.Dot`, `slide.Block`, `rotate.Block` | `click::Target`, `slide::Answer`, `rotate::Answer` |
| `Validate` and deprecated `CheckPoint` / `CheckAngle` | Each module's `validate` and typed `Answer::verify` |
| JPEG and PNG `Get`, `ToBytes`, `ToBase64Data`, `ToBase64`, `SaveToFile` and JPEG quality variants | `Image::pixels`, `Image::to_bytes`, `Image::to_base64`, `Image::to_data_url`, `Image::save`, `Image::to_jpeg` |
| `base/option` geometry and range values | `Point`, `Size`, `Rect`, `RangeInclusive` |
| `base/codec`, canvas, and direct drawing APIs | PNG/JPEG resource loading through `caprs::image`. CAPTCHA drawing stays internal. |

## Compatibility decisions

- Click padding preserves Go's inclusive bounds and its asymmetric expansion toward the right and bottom. Slide uses symmetric padding on each axis. Rotation preserves the check that the submitted and stored angles sum to within the tolerance of 360 degrees.
- The image data exposed to clients has the same formats as Go: click and slide use JPEG masters and PNG prompts, and rotation uses two PNGs. The images are independently rendered. Glyph metrics, crop placement, interpolation, random sampling, and output bytes can differ.
- The click font size is expressed in pixels. Swash supplies the glyph metrics and shapes short, single-run labels of up to 32 Unicode code points. Go limits labels to one Chinese character or two other characters. The thumbnail noise configuration uses explicit pixel amplitudes and separate distortion targets. Generated targets are placed in disjoint regions, including when a symbol has multiple characters.
- The slider uses one set of mask, overlay and shadow graphics per challenge, with optional decoy holes. A fixed-axis slider always reserves space on the left. Free dragging chooses a configured starting edge. Nonzero configured angles rotate all three templates around the same center. A built-in jigsaw template allows callers to pass only the whole background image.
- Opacity settings apply to the rendered layers. Validation rejects invalid geometry, duplicate labels, unavailable glyphs, and missing resources. Challenge generation uses an OS-seeded generator.
- The deprecated Go aliases and numeric option constants are expressed through typed Rust options. The optional `serde` feature uses a Rust-specific server-side answer schema.

## Test mapping

| Upstream test | Rust integration test |
| --- | --- |
| `TestClickTextCaptcha` | `click_text_captcha` |
| `TestClickShapeCaptcha` | `click_shape_captcha` |
| `TestScale` | `shape_resize_preserves_transparency` |
| `TestSlideTileCaptcha` | `slide_tile_captcha` and `drag_drop_captcha` |
| `TestRotateDirectionCaptcha` | `rotate_direction_captcha` |

The integration suite also exercises boundary coordinates, image encoding, malformed configuration and resources, and optional answer serialization.

## Verification for 0.1.0

- The five original Go tests passed with locally generated image and font fixtures using Go 1.24.6 and `go test ./...`.
- `cargo fmt --all --check`, `cargo build --locked`, `cargo test --locked --all-features`, and `cargo clippy --locked --all-targets --all-features -- -D warnings` passed.
- The Rust 1.88.0 run passed all 12 integration tests and the rustdoc example. The dependency audit and rustdoc build also passed.
- The runnable example generated all five modes with both the bundled resources and a user-supplied JPEG and TrueType font.