From 5ac571d8d16a307cea2922587185557bc773e8ed Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 2 May 2020 13:52:28 -0400 Subject: frontier: New trait for choosing color locations --- src/frontier.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/frontier.rs (limited to 'src/frontier.rs') diff --git a/src/frontier.rs b/src/frontier.rs new file mode 100644 index 0000000..2c6f43a --- /dev/null +++ b/src/frontier.rs @@ -0,0 +1,18 @@ +//! Frontiers on which to place pixels. + +use crate::color::Rgb8; + +/// A frontier of pixels. +pub trait Frontier { + /// The width of the image. + fn width(&self) -> u32; + + /// The height of the image. + fn height(&self) -> u32; + + /// The number of pixels currently on the frontier. + fn len(&self) -> usize; + + /// Place the given color on the frontier, and return its position. + fn place(&mut self, rgb8: Rgb8) -> Option<(u32, u32)>; +} -- cgit v1.2.3