Expand description
Scry: watch screen regions and receive typed events when patterns match.
Modules§
- patterns
- Text parsers for OCR output. Used with
WatcherBuilder::ocr.
Structs§
- Brightness
- Mean luma (0.0..=255.0) of the region, as
DetectorOutput::Number. Pair with.on_threshold(...)for “screen went dark”-style watchers. - Color
Dominance - Boolean detector/gate: at least
min_fractionof pixels are dominated by one channel (e.g. “the HP bar area is mostly red”). - Color
Match - Boolean detector/gate: at least
min_fractionof the region’s pixels are withintolerance(per channel) of the target RGB color. - Event
- An event emitted by a watcher.
- Event
Stream - An async stream of events for one or more watchers.
All session events flow through one broadcast channel; each
EventStreamfilters to its subscribed watcher names, somergeis just a name union. - Fake
Source - A scripted
FrameSourcefor tests and demos: yields its frames in order, then repeats the final frame forever. - Frame
- A single captured frame in BGRA8 layout, row-major, stride = width * 4.
- Frame
Diff - Boolean gate: did the region’s pixels change since the last evaluation? Hashes the region’s bytes; the first evaluation always reports changed.
- Frame
View - A borrowed rectangular view into a frame. Zero-copy; rows are slices of the frame.
- OcrDetector
- Adapts any
OcrEngineinto aDetector. - PxRect
- A resolved, pixel-space rectangle, guaranteed in-bounds by
Region::resolve. - Rate
- How often a watcher evaluates, or a source captures. Stored as a period.
- Session
- A capture session: owns the frame source, the capture loop, and all
watcher tasks. Dropping the last
Sessionhandle stops everything. - Session
Builder - Template
Matcher - Grayscale normalized cross-correlation template matcher.
- Text
Span - One recognized text region.
bboxis relative to the evaluated view. - Watcher
Builder - Configures one watcher. Created via
Session::watch; consumed bysubscribe.
Enums§
- Capture
Error - Channel
- A primary color channel, for
ColorDominance. - Detector
Error - Detector
Output - What a detector produced this tick.
- Error
- Event
Kind - Region
- A watch region. Fractional (
Percent) regions survive resolution changes; validation happens atresolvetime against actual frame dimensions. - Target
- What to capture: a display by index, or a window matched by exact title.
- Threshold
Direction
Traits§
- Detector
- Evaluates one region of one frame. Built-in detectors, gates, and user-defined detectors all implement this same trait.
- Frame
Source - A source of frames. The session’s capture loop calls
capture_frameat the session’s capture rate; implementations should return the freshest frame available. Real backends (scap) arrive in a later milestone. - OcrEngine
- Pluggable OCR backend. The default ONNX/PaddleOCR implementation lives in
the
visual-cortex-ocr-onnxcrate; any engine can slot in here. Returning an empty vec means “no text present” and is not an error.
Functions§
- from_fn
- Build a detector from a closure:
from_fn(|view| Ok(DetectorOutput::Bool(true))).