mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 19:08:05 +08:00
Rename Raw-rs to Rawkit (#2088)
* Rename within files * Rename in CI * Rename the folder and file names * Rename raw_rs to rawkit * Add example to README * Add initial documentation * Small API changes and extra documentation * Bump versions and stuff * Readme improvements * Merge proc-macro crates into one * Add README to rawkit-proc-macros * Remove keywords and categories * Add licenses to rawkit-proc-macros --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
13
libraries/rawkit/src/postprocessing/convert_to_rgb.rs
Normal file
13
libraries/rawkit/src/postprocessing/convert_to_rgb.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
use crate::{Pixel, RawImage, CHANNELS_IN_RGB};
|
||||
|
||||
impl RawImage {
|
||||
pub fn convert_to_rgb_fn(&self) -> impl Fn(Pixel) -> [u16; CHANNELS_IN_RGB] {
|
||||
let Some(camera_to_rgb) = self.camera_to_rgb else { todo!() };
|
||||
|
||||
move |pixel: Pixel| {
|
||||
std::array::from_fn(|i| i)
|
||||
.map(|i| camera_to_rgb[i].iter().zip(pixel.values.iter()).map(|(&coeff, &value)| coeff * value as f64).sum())
|
||||
.map(|x: f64| (x as u16).clamp(0, u16::MAX))
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user