Skip to main content

Crate stet_viewer

Crate stet_viewer 

Source
Expand description

Interactive egui/winit desktop viewer for stet — displays PostScript, EPS, and PDF pages with zoom, pan, page navigation, and a minimap.

The viewer consumes stet_graphics::display_list::DisplayList values over a channel, so it is agnostic about where the display list came from: the stet PostScript interpreter and stet-pdf-reader both produce the same type, and a single viewer window handles PS, EPS, and PDF input interchangeably. Zoom / pan / page changes re-rasterize the stored display list via stet-render — the source is never re-interpreted.

§Architecture

The viewer always runs on the main thread (egui/winit requirement). The PS interpreter or PDF reader runs on a background thread and streams display lists in over create_channels:

   background thread                          main thread
  ┌────────────────────┐   DisplayList    ┌──────────────────┐
  │ stet::Interpreter  │   messages       │   run_viewer()   │
  │ stet_pdf_reader    │ ───────────────► │  egui event loop │
  └────────────────────┘                  └──────────────────┘

§Typical use

Most users drive the viewer through the stet-cli binary rather than embedding it directly. See stet-cli’s run_viewer_mode for a worked example of wiring the PS interpreter thread and the PDF thread to a single viewer.

Structs§

InterpreterEnd
Interpreter-side channel endpoints.
PageReady
A page ready for display, carrying its resolution-independent display list.
ViewerEnd
Viewer-side channel endpoints.

Enums§

ScreenInfo
Screen information sent from viewer to interpreter for DPI calculation.
ViewerMsg
Message from interpreter to viewer via the relay thread.

Functions§

create_channels
Create matched channel pairs for interpreter <-> viewer communication.
run_viewer
Run the viewer window on the current thread (must be main thread).

Type Aliases§

DisplayListMsg
Raw display list tuple sent by Context at each showpage: (DisplayList, dpi, page_width, page_height, effective_cmyk_bytes, cmyk_proofing).