mirror of
https://github.com/bend-n/fimg.git
synced 2024-12-22 02:28:19 -06:00
divide idk
This commit is contained in:
parent
2c88066426
commit
fcb40e93be
|
@ -75,6 +75,8 @@ macro_rules! alg {
|
|||
.resize(&ChannelCount::<N>::handle(i).view(), &mut dst.view_mut())
|
||||
}
|
||||
|
||||
ChannelCount::<N>::unhandle(&mut dst);
|
||||
|
||||
// SAFETY: ctor
|
||||
unsafe { Image::new(dst.width(), dst.height(), dst.into_vec().into()) }
|
||||
}
|
||||
|
|
|
@ -49,6 +49,8 @@ pub trait AlphaDiv<const N: usize>: Sealed + ToImageView<N> {
|
|||
type P: fr::PixelExt + fr::Convolution + fr::AlphaMulDiv;
|
||||
#[doc(hidden)]
|
||||
fn handle(i: Image<&mut [u8], N>) -> fr::Image<'_, <Self as AlphaDiv<N>>::P>;
|
||||
#[doc(hidden)]
|
||||
fn unhandle(i: &mut fr::Image<<Self as AlphaDiv<N>>::P>);
|
||||
}
|
||||
|
||||
/// Generic helper for [`Image`] and [`fr::Image`] transfers.
|
||||
|
@ -83,6 +85,11 @@ macro_rules! adiv {
|
|||
|
||||
i
|
||||
}
|
||||
|
||||
fn unhandle(i: &mut fr::Image<<Self as AlphaDiv<$n>>::P>) {
|
||||
// SAFETY: mhm
|
||||
unsafe { fr::MulDiv::default().divide_alpha_inplace(&mut i.view_mut()) }
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue