Skip to main content

Crate fovea_display

Crate fovea_display 

Source
Expand description

§fovea-display

Crates.io Documentation License: MIT

fovea-display turns typed fovea images into display-ready pixels without hiding the decision of how values should be mapped to a screen.

That matters because a Mono16 inspection frame, a linear RgbF32 render target, and an already encoded Srgb8 image need different display policies. This crate makes that policy explicit with display strategies.

§Install

Core display conversion has no windowing dependency:

[dependencies]
fovea = "0.1.1"
fovea-display = "0.1.1"

Enable local debug windows only when you want interactive inspection during development:

[dependencies]
fovea-display = { version = "0.1.1", features = ["debug-window"] }

§Features

FeatureAPIsIntended use
(default)DisplayStrategy, Identity, LinearToDisplay, AutoContrast, FixedRange, TextureSourceConvert typed images for a renderer or GUI without depending on a windowing stack.
debug-windowshow, DebugDisplay, histogram debug windowsQuick local inspection of images and histograms while developing.

§Pick a display strategy

Every display operation names how image data becomes Srgba8 screen pixels.

StrategyUse when
IdentityPixels are already display-encoded sRGB.
LinearToDisplayPixels are linear-light and need sRGB gamma encoding.
AutoContrastYou are debugging high-bit-depth or float data and want to see its current range.
FixedRangeYou know the numeric range that should map to black/white.
use fovea::pixel::{Srgb8, Srgba8};
use fovea_display::{DisplayStrategy, Identity};

let px = Srgb8::new(128, 64, 200);
let display = Identity.to_display(&px);

assert_eq!(display, Srgba8::new(128, 64, 200, 255));

§Preview an image during development

use fovea::image::Image;
use fovea::pixel::Srgb8;
use fovea_display::{Identity, show};

let img = Image::fill(320, 240, Srgb8::new(128, 64, 200));
show("Preview", &img, Identity);

For linear or high-bit-depth data, do not use Identity. Choose the strategy that describes the display mapping:

use fovea::image::Image;
use fovea::pixel::Mono16;
use fovea_display::{AutoContrast, show};

let img = Image::generate(512, 512, |x, y| Mono16::new((x + y) as u16));
let strategy = AutoContrast::scan(&img);
show("Auto-contrast", &img, strategy);

§GPU and renderer integration

TextureSource is for renderer boundaries. It requires the stronger PlainImage/contiguous-byte-access path because GPU upload needs a stable memory layout, not just random pixel access.

Use DisplayStrategy when you need to decide what values should be shown. Use TextureSource when you need to hand bytes and texture metadata to a renderer.

§When NOT to use fovea-display

  • You need a full GUI toolkit: use egui, iced, winit, or your application framework.
  • You need video playback: use a media pipeline.
  • You need color-management policy for a production display system: integrate fovea’s typed pixels with your chosen color-management stack.

§Crate ecosystem

CratePurpose
foveaCore typed image model.
fovea-ioPNG/JPEG/BMP file boundaries.
fovea-displayDisplay mappings, texture metadata, and debug windows.
fovea-examplesRepo-only examples showing these crates together.

§License

Licensed under the MIT License.

Structs§

AutoContrast
Automatically determines display range by scanning the image.
DebugDisplaydebug-window
Entry point for the debug display system.
DisplayContextdebug-window
Handle for displaying images from a background thread.
FixedRange
Display with a fixed, user-specified value range.
HistogramLayerdebug-window
One translucent histogram layer in a multi-layer plot.
HistogramPlotOptionsdebug-window
Frame-level configuration for render_histogram_layers.
HistogramRenderOptionsdebug-window
Visual configuration for the single-histogram entry points.
Identity
Display sRGB pixels as-is. Only available for sRGB types.
LinearToDisplay
Apply sRGB gamma encoding to linear pixels for display.

Enums§

TextureFormat
Exhaustive GPU texture format descriptors for fovea pixel types.

Traits§

DisplayPixel
A pixel that can be written directly to a framebuffer.
DisplayStrategy
Named conversion from any pixel type to Srgba8 for display.
GpuPixel
Maps a pixel type to its GPU texture format.
TextureSource
Zero-copy texture data source for GPU upload.

Functions§

debug_histogramdebug-window
Display a histogram in a debug window using default render options.
debug_histogram_layersdebug-window
Display any number of histogram layers in a single debug window.
debug_histogram_withdebug-window
Display a histogram in a debug window with custom render options.
render_histogramdebug-window
Render a single histogram’s bin counts to an Image<Srgba8>.
render_histogram_layersdebug-window
Render any number of histogram layers into one Image<Srgba8>.
showdebug-window
Display a single image and block until the window is closed or a key is pressed.