chore: fix deprecation warnings introduced by new rgb version
This commit is contained in:
parent
33ae41ffd6
commit
f44496bb6c
2 changed files with 3 additions and 4 deletions
|
|
@ -3,7 +3,6 @@ use std::{fs, path::Path, sync::Arc};
|
|||
use bitvec::bitarr;
|
||||
use libdeflater::{CompressionLvl, Compressor};
|
||||
use log::warn;
|
||||
use rgb::ComponentSlice;
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use crate::{
|
||||
|
|
@ -192,7 +191,7 @@ impl PngData {
|
|||
ColorType::Indexed { palette } => {
|
||||
let mut palette_data = Vec::with_capacity(palette.len() * 3);
|
||||
for px in palette {
|
||||
palette_data.extend_from_slice(px.rgb().as_slice());
|
||||
palette_data.extend_from_slice(px.rgb().as_ref());
|
||||
}
|
||||
write_png_block(b"PLTE", &palette_data, &mut output);
|
||||
if let Some(last_trns) = palette.iter().rposition(|px| px.a != 255) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::hash::{BuildHasherDefault, Hash};
|
||||
|
||||
use indexmap::IndexSet;
|
||||
use rgb::{ComponentMap, ComponentSlice, FromSlice, RGB, RGBA, alt::Gray};
|
||||
use rgb::{ComponentMap, FromSlice, RGB, RGBA, alt::Gray};
|
||||
use rustc_hash::FxHasher;
|
||||
|
||||
use crate::{
|
||||
|
|
@ -193,7 +193,7 @@ pub fn indexed_to_channels(
|
|||
let mut data = Vec::with_capacity(out_size);
|
||||
for b in &png.data {
|
||||
let color = palette.get(*b as usize).unwrap_or(&black);
|
||||
data.extend_from_slice(&color.as_slice()[ch_start..=ch_end]);
|
||||
data.extend_from_slice(&color.as_ref()[ch_start..=ch_end]);
|
||||
}
|
||||
|
||||
Some(PngImage {
|
||||
|
|
|
|||
Loading…
Reference in a new issue