Function pathfinder::tools::range_color
source · pub fn range_color(
falloff: i16,
base: Rgba<u8>,
base_geo: Coordinate,
to_geo: Coordinate
) -> Rgba<u8>
Expand description
Returns a Rgba with a modified value depending on how close it is to it’s falloff point.
Examples
First declare the colors and the range at which it becomes darker.
extern crate image;
use pathfinder::{tools, Coordinate};
let falloff = 100;
let color = image::Rgba {
data: [100, 100, 100, 255],
};
Evaluate that based on the modified distance, in the small sense it is modified from the defined color above.
let base = Coordinate::new(0, 0);
let to = Coordinate::new(10, 10);
assert_eq!(
tools::range_color(falloff, color, base, to),
image::Rgba {
data: [77, 77, 77, 255]
}
);