quadraui 0.1.2

Cross-platform Rust UI toolkit: write one AppLogic and run it unmodified on TUI, GTK4 (Linux), macOS, and Windows backends
Documentation
//! Direct2D / DirectWrite layout helper for
//! [`crate::primitives::chart::Chart`] (issue #26).
//!
//! Painting moved to the shared [`crate::primitives::chart::paint`]
//! (#810, PaintSurface Phase 2c) — see that fn's doc for the
//! divergences resolved while unifying `gtk::chart::draw_chart`,
//! `macos::chart::draw_chart` and `win::chart::draw_chart` into one
//! implementation, including the quadraui#791 clip this backend never
//! had before. This module now only carries [`win_chart_layout`], the
//! DIP-unit layout query used for both hit-testing
//! (`WinBackend::chart_layout`) and painting (`WinBackend::draw_chart`).
//!
//! Only compiled on `target_os = "windows"` — see `super::mod`'s
//! `#[cfg(target_os = "windows")] mod chart;` and `backend.rs`'s module
//! docs.

use crate::event::Rect;
use crate::primitives::chart::{Chart, ChartLayout};
use crate::primitives::layout_metrics::pixel_chart_layout;

/// Compute a [`Chart`]'s layout without painting — the DirectWrite twin
/// of `gtk_chart_layout`/`mac_chart_layout`, via [`pixel_chart_layout`]
/// (issue #1079).
pub fn win_chart_layout(
    chart: &Chart,
    rect: Rect,
    char_width: f32,
    line_height: f32,
) -> ChartLayout {
    pixel_chart_layout(
        chart,
        rect.x,
        rect.y,
        rect.width,
        rect.height,
        line_height,
        char_width,
    )
}