looklook 0.5.0

Descriptive signal synthesiser.
// Copyright 2026 Gabriel Bjørnager Jensen.
//
// This file is part of LOOKLOOK.
//
// LOOKLOOK is free software: you can redistribute
// it and/or modify it under the terms of the GNU
// Affero General Public License as published by
// the Free Software Foundation, either version 3
// of the License, or (at your option) any later
// version.
//
// LOOKLOOK is distributed in the hope that it will
// be useful, but WITHOUT ANY WARRANTY; without
// even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Affero General Public License for more details.
//
// You should have received a copy of the GNU Af-
// fero General Public License along with LOOKLOOK.
// If not, see <https://www.gnu.org/licenses/>.

//! The [`Render`] type.

mod encode;

use crate::mode::Mode;
use crate::render::RenderBuf;

/// A render.
#[derive(Clone, Debug)]
pub struct Render {
	/// The render mode.
	mode: Mode,

	/// The render buffer.
	buf: RenderBuf,
}

impl Render {
	/// Creates a new, empty render.
	#[must_use]
	pub fn new(mode: Mode) -> Self {
		let buf = RenderBuf::new(mode.sample_depth(), mode.sample_count());

		Self { mode, buf }
	}

	/// Clears the render.
	pub fn clear(&mut self) {
		self.buf.clear();
	}

	/// Borrows the raw render data.
	#[inline]
	#[must_use]
	pub const fn data(&self) -> &[u8] {
		self.buf.data()
	}

	/// Mutably borrows the raw render data.
	#[inline]
	#[must_use]
	pub const fn data_mut(&mut self) -> &mut [u8] {
		self.buf.data_mut()
	}
}

impl Drop for Render {
	#[inline(always)]
	fn drop(&mut self) {}
}