# HeatFunctions

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-livecharts/heat_functions/struct-heatfunctions/

**struct** · [`ferroui-livecharts`](/docs/0.5.0/api/ferroui-livecharts/) · v0.5.0

```rust
struct HeatFunctions
```

The heat functions of the source (`HeatFunctions`).

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/heat_functions.rs#L9)

## Members

- [`build_color_stops`](#function-build_color_stops)
- [`interpolate_color`](#function-interpolate_color)

<a id="function-build_color_stops"></a>

### build_color_stops

```rust
fn build_color_stops(heat_map: &[Color], color_stops: Option<&[f64]>) -> Result<Vec<(f64, Color)>, ChartError>
```

The stops of a heat map (`BuildColorStops`): the given offsets, or offsets spread evenly
from 0 to 1. A heat map of fewer than two colours, or offsets of another count, is an error
where the source throws.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/heat_functions.rs#L15)

<a id="function-interpolate_color"></a>

### interpolate_color

```rust
fn interpolate_color(weight: f64, weight_bounds: &Bounds, heat_map: &[Color], heat_stops: &[(f64, Color)]) -> Color
```

The colour of a weight (`InterpolateColor`): its position between the bounds, clamped to
[0, 1], interpolated between the stops around it, each channel truncated as the source's
byte conversion; past the last stop, the last colour of the heat map. A zero range puts
every weight at the start.

Where the source extrapolates (a position before the first stop, two stops at the same
offset, a weight that is not a number) the colour is the nearest stop's.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/heat_functions.rs#L52)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
