Skip to content

Commit

Permalink
Removed the lifetime bounds on the grayscale functions, since the lif…
Browse files Browse the repository at this point in the history
…etime bounds have been removed from the traits and are no longer required to be specified
  • Loading branch information
ForgottenMaster committed Nov 1, 2021
1 parent f6b4ed8 commit 7f755d8
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/imageops/colorops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,20 @@ type Subpixel<I> = <<I as GenericImageView>::Pixel as Pixel>::Subpixel;

/// Convert the supplied image to grayscale. Alpha channel is discarded.
pub fn grayscale<I: GenericImageView>(image: &I) -> ImageBuffer<Luma<Subpixel<I>>, Vec<Subpixel<I>>>
where
Subpixel<I>: 'static,
<Subpixel<I> as Num>::FromStrRadixErr: 'static,
{
grayscale_with_type(image)
}

/// Convert the supplied image to grayscale. Alpha channel is preserved.
pub fn grayscale_alpha<I: GenericImageView>(image: &I) -> ImageBuffer<LumaA<Subpixel<I>>, Vec<Subpixel<I>>>
where
Subpixel<I>: 'static,
<Subpixel<I> as Num>::FromStrRadixErr: 'static,
{
grayscale_with_type_alpha(image)
}

/// Convert the supplied image to a grayscale image with the specified pixel type. Alpha channel is discarded.
pub fn grayscale_with_type<NewPixel, I: GenericImageView>(image: &I) -> ImageBuffer<NewPixel, Vec<NewPixel::Subpixel>>
where
Subpixel<I>: 'static,
<Subpixel<I> as Num>::FromStrRadixErr: 'static,
NewPixel: 'static + Pixel + FromColor<Luma<Subpixel<I>>>
NewPixel: Pixel + FromColor<Luma<Subpixel<I>>>
{
let (width, height) = image.dimensions();
let mut out = ImageBuffer::new(width, height);
Expand All @@ -54,9 +46,7 @@ where
/// Convert the supplied image to a grayscale image with the specified pixel type. Alpha channel is preserved.
pub fn grayscale_with_type_alpha<NewPixel, I: GenericImageView>(image: &I) -> ImageBuffer<NewPixel, Vec<NewPixel::Subpixel>>
where
Subpixel<I>: 'static,
<Subpixel<I> as Num>::FromStrRadixErr: 'static,
NewPixel: 'static + Pixel + FromColor<LumaA<Subpixel<I>>>
NewPixel: Pixel + FromColor<LumaA<Subpixel<I>>>
{
let (width, height) = image.dimensions();
let mut out = ImageBuffer::new(width, height);
Expand Down

0 comments on commit 7f755d8

Please sign in to comment.