pub struct Gray<'a> { /* private fields */ }Implementations§
Source§impl<'a> Gray<'a>
impl<'a> Gray<'a>
Sourcepub fn new(context: &'a ClContext) -> Self
pub fn new(context: &'a ClContext) -> Self
Examples found in repository?
examples/gray.rs (line 6)
4fn main() {
5 let context = climage::ClContext::default();
6 let mut gray = climage::Gray::new(&context);
7 let img = climage::ClImageBuffer::from_readonly_host_image(
8 &context,
9 image::open("examples/lenna.png").unwrap().into_rgba8(),
10 );
11 let mut out = climage::ClImageBuffer::from_writeonly_host_image(
12 &context,
13 image::ImageBuffer::<image::Rgba<u8>, Vec<u8>>::new(img.dimensions().0, img.dimensions().1),
14 );
15 gray.build_kernel(&img, &mut out).run();
16 let mut out_img =
17 image::ImageBuffer::<image::Rgba<u8>, Vec<u8>>::new(out.dimensions().0, out.dimensions().1);
18 out.data.read(&mut out_img).enq().unwrap();
19 out_img.save("examples/lena_gray.png").unwrap();
20}Trait Implementations§
Source§impl<'a> ImageProc for Gray<'a>
impl<'a> ImageProc for Gray<'a>
fn build_kernel( &mut self, src_img: &ClImageBuffer, dst_img: &mut ClImageBuffer, ) -> &mut Self
fn run(&self)
Auto Trait Implementations§
impl<'a> !Freeze for Gray<'a>
impl<'a> !RefUnwindSafe for Gray<'a>
impl<'a> Send for Gray<'a>
impl<'a> !Sync for Gray<'a>
impl<'a> Unpin for Gray<'a>
impl<'a> UnwindSafe for Gray<'a>
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
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