Rework the encoder, replace all unsafe code
This commit is contained in:
parent
239a22926c
commit
6ce544950d
2 changed files with 49 additions and 57 deletions
|
|
@ -8,6 +8,15 @@ impl<const N: usize> Pixel<N> {
|
|||
Self([0; N])
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn read(&mut self, s: &[u8]) {
|
||||
let mut i = 0;
|
||||
while i < N {
|
||||
self.0[i] = s[i];
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn as_rgba(self, with_a: u8) -> Pixel<4> {
|
||||
let mut i = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue