Crate colorimetry_plot

Crate colorimetry_plot 

Source
Expand description

§Colorimetry Plot Library

This colormimetry library provides functionality for generating SVG-based color plots, with both low-level and higher level API, based on top of the Rust-SVG library. It includes generating basic 2D (x,y) charts composed of several layers, and more complex chromaticity diagrams with the spectral locus, and gamut fills. Here is an example of a XY Chromaticity Diagram for the DisplayP3 color space, using the CIE 2015 observer: XY Chromaticity Diagram Plots are built up in Layers using coordinate transformations between plot space and world coordinates.

§Modules

  • chart: Chart composition and rendering.
  • layer: Layered rendering support for compositing multiple plot elements.
  • rendable: Traits and types for objects that can be rendered to SVG.
  • spectrum: Spectrum data visualization and color representation.
  • style_attr: SVG styling attributes and utilities.
  • svgdoc: SVG document creation and manipulation.
  • view: Viewport and plot area management.

§Core Features

  • Layered Architecture: Build complex plots by compositing multiple layers
  • Coordinate Transforms: Seamless conversion between plot and world coordinate systems
  • SVG Generation: High-quality vector graphics output
  • Configurable Styling: Flexible styling system for plot elements
  • Precision Control: Configurable floating-point precision for clean output

Re-exports§

pub use crate::style_attr::class;
pub use crate::style_attr::id;
pub use crate::style_attr::style;
pub use crate::style_attr::StyleAttr;

Modules§

chart
A two-dimensional chart implementation for plotting data in a Cartesian coordinate system.
layer
Layer module for SVG rendering
rendable
Rendable Trait Module
style_attr
Style attributes for SVG elements in the plotting library
svgdoc
SVG document representation and rendering.
view
View parameters for SVG rendering.

Macros§

css
A StyleAttr struct with either the class, style, id or any combination of fields set. This macro allows for flexible creation of style attributes for SVG elements. It supports various combinations of class, style, and id attributes, making it easy to define the styling of SVG elements in a concise manner.
delegate_xy_chart_methods
Macro to delegate all XYChart methods to a field of a struct, to avoid using Deref and DerefMut Add methods here when adding new methods to XYChart Usage: delegate_xy_chart_methods!(MyStruct, chart_field);

Functions§

last_id
Returns the last generated ID as a string. This can be useful for referencing the last created SVG element without generating a new ID.
new_id
Generates a new unique ID for SVG elements. The ID is prefixed with “id” and is incremented each time this function is called. This is useful for ensuring that each SVG element has a unique identifier.
round_to_default_precision
Rounds a floating-point value to the default precision. For example, round_to_default_precision(1.23456) returns 1.2. /// # Arguments
round_to_precision
Rounds a floating-point value to the specified precision. For example, round_to_precision(1.23456, 100.0) returns 1.23.