mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
fix some rounding errors and color picker breaking everything from last change
This commit is contained in:
parent
ad5e02fc75
commit
51ed3e28ea
1 changed files with 7 additions and 6 deletions
|
@ -51,7 +51,7 @@ pub fn replace_color(image: &mut RgbaImage, main: Rgba<u8>, alt: Rgba<u8>, arm:
|
|||
}
|
||||
|
||||
fn to_u8(c: [f64; 4]) -> [u8; 4] {
|
||||
[c[0] as u8, c[1] as u8, c[2] as u8, c[3] as u8]
|
||||
[c[0].round() as u8, c[1].round() as u8, c[2].round() as u8, c[3].round() as u8]
|
||||
}
|
||||
|
||||
pub fn make_player_image(image: &mut RgbaImage, colors: PlayerColor) {
|
||||
|
@ -191,9 +191,10 @@ pub fn player_skin_display_color_picker(
|
|||
}
|
||||
|
||||
pub fn color_picker(ui: &mut Ui, color: &mut [f64; 4]) {
|
||||
let mut rgb = Color32::from_rgb(color[0] as u8, color[1] as u8, color[2] as u8);
|
||||
color_picker_color32(ui, &mut rgb, Alpha::Opaque);
|
||||
*color = [rgb.r() as f64, rgb.g() as f64, rgb.b() as f64, 255.0]
|
||||
let mut rgb = Color32::from_rgb(color[0].round() as u8, color[1].round() as u8, color[2].round() as u8);
|
||||
if color_picker_color32(ui, &mut rgb, Alpha::Opaque) {
|
||||
*color = [rgb.r() as f64, rgb.g() as f64, rgb.b() as f64, 255.0]
|
||||
}
|
||||
}
|
||||
|
||||
pub fn player_select_current_color_slot(ui: &mut Ui, app: &mut App) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue