rawkit 0.1.0

A library to extract images from camera raw files
Documentation
use crate::{Histogram, Pixel, PixelTransform, RawImage, CHANNELS_IN_RGB};

impl RawImage {
	pub fn record_histogram_fn(&self) -> RecordHistogram {
		RecordHistogram::new()
	}
}

pub struct RecordHistogram {
	pub histogram: Histogram,
}

impl RecordHistogram {
	fn new() -> RecordHistogram {
		RecordHistogram {
			histogram: [[0; 0x2000]; CHANNELS_IN_RGB],
		}
	}
}

impl PixelTransform for &mut RecordHistogram {
	fn apply(&mut self, pixel: Pixel) -> [u16; CHANNELS_IN_RGB] {
		self.histogram
			.iter_mut()
			.zip(pixel.values.iter())
			.for_each(|(histogram, &value)| histogram[value as usize >> CHANNELS_IN_RGB] += 1);
		pixel.values
	}
}