Initial scaffold
ober
33bf9eed846ad6e13f7a3d87f815308c3dff2c77
new file mode 100644 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +dist/ +build/ +target/ +*.log new file mode 100644 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. new file mode 100644 --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# jerboa-image + +`jerboa-image` defines the image data contract used by Jerboa apps and Rust/WASM +helpers. + +The first consumer is the SFB SSD reviewer. The goal is to avoid OpenCV and +NumPy while keeping image operations deterministic and easy to test. + +## Image Contract + +```json +{ + "width": 1224, + "height": 1584, + "channels": 4, + "format": "rgba8", + "source": "browser-canvas" +} +``` + +Native helpers may also use `rgb8`; browser/WASM helpers should accept `rgba8` +directly from Canvas `ImageData`. + +## Responsibilities + +- RGB/RGBA pixel access. +- RGB to HSV conversion. +- Cropping and coordinate transforms. +- Optional PNG/JPEG decode for native test tools. +- Optional PNG encode for cached browser assets. + +## Dependency Rule + +The Android default path must not depend on OpenCV, Qt, MuPDF, Poppler, or +Python. Rust crates are acceptable when they can build as static CLI tools or +WASM modules and do not pull GUI stacks. new file mode 100644 --- /dev/null +++ b/docs/pixel-contract.md @@ -0,0 +1,21 @@ +# Pixel Contract + +The SSD detector needs only a small pixel API. + +```scheme +(image-width image) +(image-height image) +(image-pixel-r image x y) +(image-pixel-g image x y) +(image-pixel-b image x y) +``` + +For browser/WASM use, the input is Canvas `ImageData`: + +- 4 bytes per pixel. +- Byte order: R, G, B, A. +- Row-major. +- Coordinates are integer source canvas pixels. + +For native CLI tests, PNG/JPEG decode can be provided by Rust's `image` crate, +but that crate is not required at runtime in the Android browser path.