aboutsummaryrefslogtreecommitdiff
path: root/evc/src/pixel.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2022-12-05 21:22:00 +0100
committermetamuffin <metamuffin@disroot.org>2022-12-05 21:22:00 +0100
commit8e4ec0943973b96addbe01f4c02f91cf04d081a7 (patch)
tree0773eb5048703adae45538050ab3dffad29b01da /evc/src/pixel.rs
parent96e316ea16b7b915e02735457d5ac7495d3db305 (diff)
downloadvideo-codec-experiments-8e4ec0943973b96addbe01f4c02f91cf04d081a7.tar
video-codec-experiments-8e4ec0943973b96addbe01f4c02f91cf04d081a7.tar.bz2
video-codec-experiments-8e4ec0943973b96addbe01f4c02f91cf04d081a7.tar.zst
more code
Diffstat (limited to 'evc/src/pixel.rs')
-rw-r--r--evc/src/pixel.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/evc/src/pixel.rs b/evc/src/pixel.rs
new file mode 100644
index 0000000..adeaf84
--- /dev/null
+++ b/evc/src/pixel.rs
@@ -0,0 +1,19 @@
+use crate::ser::{Ser, Sink, Source};
+
+#[derive(Copy, Clone, Debug, Default)]
+pub struct Pixel {
+ pub r: u8,
+ pub g: u8,
+ pub b: u8,
+}
+
+impl Ser for Pixel {
+ fn write(&self, sink: &mut impl std::io::Write) -> std::io::Result<()> {
+ sink.put((self.r, self.g, self.b))
+ }
+
+ fn read(source: &mut impl std::io::Read) -> std::io::Result<Self> {
+ let (r, g, b) = source.get()?;
+ Ok(Self { r, g, b })
+ }
+}