rely on deriving traits instead

This commit is contained in:
2025-03-24 16:42:14 -04:00
parent f1b9f9ad30
commit 735a820799
4 changed files with 11 additions and 102 deletions

View File

@@ -2,23 +2,14 @@ use crate::{grid::Grid, palette::Palette};
use itertools::multizip;
// Stores data that is located in grids that is used for image generation
/// Stores data that is located in grids that is used for image generation
#[derive(Clone)]
pub struct ThinGridData {
pub width: usize,
pub height: usize,
pub data: Vec<f32>,
}
impl Clone for ThinGridData {
fn clone(&self) -> ThinGridData {
ThinGridData {
width: self.width,
height: self.height,
data: self.data.clone(),
}
}
}
impl ThinGridData {
// Convert Grid to ThinGridData
pub fn new_from_grid(in_grid: &Grid) -> Self {
@@ -69,23 +60,14 @@ impl ThinGridData {
}
}
// Class for storing data that will be used to create images
/// Class for storing data that will be used to create images
#[derive(Clone)]
pub struct ImgData {
pub grids: Vec<ThinGridData>,
pub palette: Palette,
pub iteration: i32,
}
impl Clone for ImgData {
fn clone(&self) -> ImgData {
ImgData {
grids: self.grids.clone(),
palette: self.palette,
iteration: self.iteration,
}
}
}
impl ImgData {
pub fn new(in_grids: Vec<ThinGridData>, in_palette: Palette, in_iteration: i32) -> Self {
ImgData {
@@ -105,7 +87,6 @@ impl ImgData {
output
}
#[inline]
pub fn save_to_image(&self) {
let (width, height) = (self.grids[0].width, self.grids[0].height);
let mut img = image::RgbImage::new(width as u32, height as u32);