pub struct FilterOperation;Expand description
Convolution filter operations
Implementations§
Source§impl FilterOperation
impl FilterOperation
Sourcepub fn gaussian_blur(
device: &GpuDevice,
input: &[u8],
output: &mut [u8],
width: u32,
height: u32,
sigma: f32,
) -> Result<()>
pub fn gaussian_blur( device: &GpuDevice, input: &[u8], output: &mut [u8], width: u32, height: u32, sigma: f32, ) -> Result<()>
Apply Gaussian blur
§Arguments
device- GPU deviceinput- Input image buffer (packed RGBA format)output- Output image buffer (packed RGBA format)width- Image widthheight- Image heightsigma- Blur radius (standard deviation)
§Errors
Returns an error if buffer sizes are invalid or if the GPU operation fails.
Sourcepub fn sharpen(
device: &GpuDevice,
input: &[u8],
output: &mut [u8],
width: u32,
height: u32,
amount: f32,
) -> Result<()>
pub fn sharpen( device: &GpuDevice, input: &[u8], output: &mut [u8], width: u32, height: u32, amount: f32, ) -> Result<()>
Apply sharpening filter (unsharp mask)
§Arguments
device- GPU deviceinput- Input image buffer (packed RGBA format)output- Output image buffer (packed RGBA format)width- Image widthheight- Image heightamount- Sharpening strength
§Errors
Returns an error if buffer sizes are invalid or if the GPU operation fails.
Sourcepub fn edge_detect(
device: &GpuDevice,
input: &[u8],
output: &mut [u8],
width: u32,
height: u32,
) -> Result<()>
pub fn edge_detect( device: &GpuDevice, input: &[u8], output: &mut [u8], width: u32, height: u32, ) -> Result<()>
Sourcepub fn convolve(
device: &GpuDevice,
input: &[u8],
output: &mut [u8],
width: u32,
height: u32,
kernel: &[f32],
normalize: bool,
) -> Result<()>
pub fn convolve( device: &GpuDevice, input: &[u8], output: &mut [u8], width: u32, height: u32, kernel: &[f32], normalize: bool, ) -> Result<()>
Apply custom convolution kernel
§Arguments
device- GPU deviceinput- Input image buffer (packed RGBA format)output- Output image buffer (packed RGBA format)width- Image widthheight- Image heightkernel- Convolution kernel (must be square and odd-sized)normalize- Whether to normalize the kernel
§Errors
Returns an error if buffer sizes are invalid or if the GPU operation fails.
Auto Trait Implementations§
impl Freeze for FilterOperation
impl RefUnwindSafe for FilterOperation
impl Send for FilterOperation
impl Sync for FilterOperation
impl Unpin for FilterOperation
impl UnsafeUnpin for FilterOperation
impl UnwindSafe for FilterOperation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more