summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2020-05-02 13:52:28 -0400
committerTavian Barnes <tavianator@tavianator.com>2020-05-03 00:16:33 -0400
commit5ac571d8d16a307cea2922587185557bc773e8ed (patch)
tree0a6fc2db7cd8cbd93ac5d03a75c506d690cb9a29
parent62e0fec044b5727efa1841138f44d9a1d9537bcf (diff)
downloadkd-forest-5ac571d8d16a307cea2922587185557bc773e8ed.tar.xz
frontier: New trait for choosing color locations
-rw-r--r--src/frontier.rs18
-rw-r--r--src/main.rs1
2 files changed, 19 insertions, 0 deletions
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)>;
+}
diff --git a/src/main.rs b/src/main.rs
index a59a0cf..07e138a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,4 +1,5 @@
pub mod color;
+pub mod frontier;
pub mod hilbert;
pub mod metric;