Skip to main content

Crate sealed_surface

Crate sealed_surface 

Source
Expand description

Non-extractable data surface.

Paint tables, timeseries, scatter, and treemaps as glyphs on a bitmap so cell values never appear as Unicode in a host DOM. Framework-agnostic. Zero required dependencies.

Not DRM. Not OCR-proof. A human with a camera still wins. The crate signs DOM scrape, copy/paste, and tooltip-JSON layers when the host obeys the contract (see examples/host_contract.rs). Screen readers do not get cell values in sealed mode; the accessible egress is a licensed API the host already meters.

use sealed_surface::{
    AccessTier, CellValue, Column, FrameRequest, Grid, LicenseLens, Row, Surface,
    SurfaceMode, Viewport,
};

let grid = Grid::try_new(
    vec![Column::new(0, "sku"), Column::new(1, "price")],
    vec![Row::new(
        0,
        vec![CellValue::text("ACME-SKU-1"), CellValue::float(49.0, 2)],
    )],
)?;

let mut surface = Surface::new(
    SurfaceMode::Sealed,
    LicenseLens::from_tier(AccessTier::Trial),
);
let frame = surface.render(&grid, &FrameRequest::full(Viewport::window(640, 240)))?;
assert!(frame.host.clipboard.is_none());
assert!(!frame.host.audit_text().contains("49.00"));
assert!(frame.png.starts_with(b"\x89PNG"));

Structs§

Appearance
Full look. Default is compact 5×7 + dark high-readability theme.
ChartStyle
Timeseries look. Independent of table metrics.
Column
Column schema. Header text is treated as schema, not a datum.
ColumnId
Stable column identity (opaque to the host).
Frame
One painted frame plus the host leak surface.
FrameRequest
Inputs for one frame.
Grid
Owned table.
Hit
Opaque hit. No values.
HitMap
Spatial index of the visible window only.
HostProjection
Leak surface. Contract tests serialize this, not the pixmap.
HostText
One host-visible string. Must not be a cell datum in sealed mode.
LicenseLens
Row/column policy applied to a Grid before raster.
Pixmap
RGB888 pixmap.
Pointer
Pointer in pixmap (window) pixel space.
Rgb
RGB888 color.
Row
One data row.
RowId
Stable row identity (opaque to the host; not a grain id).
Series
Named polyline.
SeriesId
Identifier for a series. Opaque to the host.
SeriesLayout
Timeseries or scatter. Same samples; paint encoding differs.
SeriesPoint
One sample. x is the independent axis (time or category index).
Surface
Stateful renderer.
TableMetrics
Content size and column widths. Does not depend on the viewport.
Theme
Surface colors.
TreeId
Opaque tree-node id.
TreeLayout
Hierarchical area chart. Squarified layout (Bruls / van Wijk).
TreeNode
One node. Leaves carry area mass in Self::value; branches use the sum of children.
Viewport
Pixel viewport. origin_* is the scroll; width/height is the window.

Enums§

AccessTier
Product-agnostic entitlement bucket. Hosts map their plans onto this.
CellValue
A single cell. CellValue::Redacted must not carry a hidden scalar.
ClipboardPayload
Clipboard payload produced only in copyable mode.
Error
Recoverable failure from layout, lens, or encode.
HitKind
What a pixel hit.
MarkerStyle
Where to draw series markers.
RedactionStyle
How redacted cells are painted (never with the original scalar).
SurfaceMode
Whether the host may observe cell values as Unicode.
TypeScale
Glyph size and cell metrics.

Constants§

MAX_PIXMAP_AXIS
Hard cap on one pixmap axis. Hosts that need more should tile.