i didnt say im fancy fixing it
All checks were successful
Rust / build (pull_request) Successful in 8m19s
All checks were successful
Rust / build (pull_request) Successful in 8m19s
there is an off by one somewhere _shrug_
This commit is contained in:
parent
6a5af6b4f4
commit
57e784c6e9
|
@ -1,6 +1,7 @@
|
|||
//! Based on https://github.com/WarkerAnhaltRanger/CCCB_Ledwand
|
||||
|
||||
use image::GrayImage;
|
||||
use log::error;
|
||||
use servicepoint::{Bitmap, DisplayBitVec, PIXEL_HEIGHT};
|
||||
|
||||
type GrayHistogram = [usize; 256];
|
||||
|
@ -217,8 +218,15 @@ fn ostromoukhov_dither_pixel(
|
|||
destination.set(position, destination_value);
|
||||
|
||||
let mut diffuse = |to: usize, mat: i16| {
|
||||
let diffuse_value = source[to] as i16 + mat;
|
||||
source[to] = diffuse_value.clamp(u8::MIN.into(), u8::MAX.into()) as u8;
|
||||
match source.get(to) {
|
||||
None => {
|
||||
error!("ostromoukhov_dither_pixel - invalid index {to}");
|
||||
}
|
||||
Some(val) => {
|
||||
let diffuse_value = *val as i16 + mat;
|
||||
source[to] = diffuse_value.clamp(u8::MIN.into(), u8::MAX.into()) as u8;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
let lookup = if destination_value {
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::{
|
|||
};
|
||||
use clap::Parser;
|
||||
use log::debug;
|
||||
use servicepoint::{Brightness, HardResetCommand, UdpSocketExt};
|
||||
use servicepoint::{Brightness, HardResetCommand};
|
||||
|
||||
mod brightness;
|
||||
mod cli;
|
||||
|
|
Loading…
Reference in a new issue